Commit Graph

104 Commits

Author SHA1 Message Date
Noel Grandin
a08cb3b52e convert PolyFlags to scoped enum
and remove the XPolyFlags enum, which has the same values and was being
converted to PolyFlags anyhow

Change-Id: Iaead84933c79a7603698a4e50257dd944df89c41
Reviewed-on: https://gerrit.libreoffice.org/31627
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-07 10:34:17 +00:00
Stephan Bergmann
91dd2db17b loplugin:override: No more need for the "MSVC dtor override" workaround
The issue of 362d4f0cd4 "Explicitly mark
overriding destructors as 'virtual'" appears to no longer be a problem with
MSVC 2013.

(The little change in the rewriting code of compilerplugins/clang/override.cxx
was necessary to prevent an endless loop when adding "override" to

  OOO_DLLPUBLIC_CHARTTOOLS    virtual ~CloseableLifeTimeManager();

in chart2/source/inc/LifeTime.hxx, getting stuck in the leading
OOO_DLLPUBLIC_CHARTTOOLS macro.  Can't remember what that
isAtEndOfImmediateMacroExpansion thing was originally necessary for, anyway.)

Change-Id: I534c634504d7216b9bb632c2775c04eaf27e927e
2016-09-13 13:19:22 +02:00
Noel Grandin
500a3be0ea loplugin:countusersofdefaultparams in vcl..xmlsecurity
Change-Id: I538596a99e632178d928ff7e66ad45c71b73c6fd
Reviewed-on: https://gerrit.libreoffice.org/28018
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-12 06:54:08 +00:00
Noel Grandin
9870f02b31 loplugin:countusersofdefaultparams in tools..xmlsecurity
find methods with default params with only zero or one call site

Change-Id: Ie5b30f60e9fe00ba1acf0dfc79b005ded46f05a0
Reviewed-on: https://gerrit.libreoffice.org/27512
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-07-27 06:44:50 +00:00
Tomaž Vajngerl
e1296e295e tdf#100411 start the flush timer when batching (PostBatchDraw)
When we batch a draw command we need to start the flush timer
(if not already started) as otherwise it could happen that we
won't flush the offscreen texture at the correct time or at all.
This fixes a problem with drawing of pop-up "help" text.

Change-Id: I6afcf173c3ac517ed0612cd413d95e28c19faa81
2016-06-24 17:09:51 +08:00
melikeyurtoglu
258301879b tdf#96971 SetXORMode - remove un-needed parameter
Change-Id: I901e5de3e4e25f0cae5c71d6e83fd94459fe7b7e
Signed-off-by: melikeyurtoglu <aysemelikeyurtoglu@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/21951
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: jan iversen <jani@documentfoundation.org>
2016-06-09 11:31:11 +00:00
Tomaž Vajngerl
ce72e34b35 opengl: batch drawing of polylines
To get polylines to draw in a batch it was necessary to refactor
the polyline code to work with GL_TRIANGLES instead of the previous
used GL_TRIANGLE_STRIP. For this and to make the code easier to
handle a new class was introduced: LineBuilder, which purpose is
to assemble vertices for a polyline (line ends, line joints).

In addition we need to know the line width, anti-aliasing (AA) per
vertex basis (in addition to color, normal and extrusion) so we
can draw many polylines with one draw call. This info is now
stored in Vertex struct which is used when drawing lines or
triangles (fills).

Uploading of vertices has also been changed, previously we
uploaded the vertices with the drawcall. a convention in Modern
OpenGL is however to use VBO (Vertex Buffer Object) for this.
With this we can upload the to the GPU vertices independently
and not upload them if this is not needed (which is currently
not used yet). A vector of Vertex structs is now uploaded to the
GPU using a VBO which is handeled with a new VertexBufferObject
class.

In addition to reduce the ammount of duplicated vertices, we use
a index vector (handled by IndexBufferObject class) where we only
define the indices of the vertex buffer which should be drawn.

Change-Id: I49dc9c6260b459f4f4ce3a5e4fa4c8ad05a7b878
2016-06-08 17:12:28 +09:00
Tomaž Vajngerl
18260a0d9a opengl: deferred texture drawing in RenderList, add drawAlphaRect
Drawing accumulated textures (in Accumulatedtextures) is independent
of drawing with render list which causes problems with rendering
order when render list and accumulated textures are flushed. To
solve this we need to combine both so we can check for overlapped
drawing.

Previously drawRect was using RenderList batch drawing but not
drawAlphaRect which is essentially the same as drawRect but
additionally supports alpha value. This adds support to draw
alpha rectangles to RenderList and converts drawAlphaRect.

Change-Id: I82bf0b410e5ebabb13bab7b29a2e53a6fdaa404f
2016-06-08 11:39:22 +09:00
Tomaž Vajngerl
344dc6939c opengl: batch drawing of pixel, line, rect draw calls
Change-Id: Ib1619fa476f488c5315411b1ad4d1b7464c70c69
2016-06-08 11:39:22 +09:00
Tomaž Vajngerl
c8fc1f40ad opengl: use line shader for all line drawing not just polylines
Change-Id: I9c2d5c5ca4761867a0a38cb3bc3c4973454ee992
Reviewed-on: https://gerrit.libreoffice.org/25157
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-05-23 08:47:04 +00:00
Tomaž Vajngerl
6473093d4f opengl: use existing code for "legacy" polyline, polygon render.
Rendering polylines, polygons, polypolygons which take an array
as parameter ("legacy" code) can re-use the other, already
existing code paths (same thing as "headless" svp backend does).

Change-Id: Ie45812d7fce6bc70484e9f0c05cc81e995800bcb
Reviewed-on: https://gerrit.libreoffice.org/25156
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-05-23 08:46:30 +00:00
Noel Grandin
899e8cedd7 simplify SalGraphics::copyArea flags argument
Change-Id: Iaaef4d90d7fe817a32cd51652d41c2e49c8909a4
Reviewed-on: https://gerrit.libreoffice.org/24832
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-12 07:13:45 +00:00
Regina Henschel
32cec4ca8b tdf#48066 render stroke-miterlimit correctly in SVG import
The property stroke-miterlimit is transported to the renderers
via a new member mfMiterMinimumAngle in class LineAttribute
Several drawPolyLine methods are adapted. This patch does not
include changes in MetaAction. Presentation mode, printing, and
PDF-export is still wrong.

Corrected LineJoinMiter to LineJoinBevel in canvas, that s closer
to NONE. Removed DrawPolyLine method without MiterMinimumAngle
and adapted calls accordingly.

Change-Id: I6bcd24add5d85c4d9a39e3788e0682091c5fc9c4
Reviewed-on: https://gerrit.libreoffice.org/23946
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2016-04-26 16:42:27 +00:00
Tomaž Vajngerl
094faaae69 opengl: fix wrong clipping when drawing text
Change-Id: I41a182c5309586337032328dfe82b1c6715f0dc2
2016-04-08 19:10:13 +09:00
Tomaž Vajngerl
80d0b2916d opengl: use packed texture atlas for glyph cache in win. backend
Change-Id: I6a627699d49bad47213788877fa3947ad2ef83f4
2016-04-08 19:10:12 +09:00
Tomaz Vajngerl
96a098c0e8 opengl: deferred and optimized (text) texture drawing
Switching between textures is not cheap, so minimizing the amount
of switching performs better. So instead of immediate drawing we
can accumulate texture draw actions and defer drawing as long as
possible. After that switch all accumulated textures and draw
everything needed with one GL draw call.

This is beneficial for text drawing as we cache many glyphs in
per textue.

Change-Id: I1b94b9ac6a5f2c1a3dbbd75f4df76436a5d40f31
2016-04-08 19:10:11 +09:00
Noel Grandin
f0f973da85 loplugin:constantparams in vcl/
also some improvements to the plugin

Change-Id: I0e3a519d70756e577fcb1bd47dd66864b5b4c871
Reviewed-on: https://gerrit.libreoffice.org/23289
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-03-16 08:42:37 +00:00
Tomaž Vajngerl
d18ad8a7fb opengl: shader based polyline rendering - fixes tdf#97137 for OGL
Adds native opengl polyline rendering to draw polylines, line joins
and line caps as triangle strips. The vertex shader allows for the
dynamic line width by calculating the correct vertex posiitons,
and the fragment shader is used for anti-aliasing.

Change-Id: If7982c828cae1fae59c57194c8ac77e5ad7f1d26
2016-02-25 11:16:19 +01:00
Chris Sherlock
5f507aa76c vcl: readd std headers to openglgdiimpl.hxx
Change-Id: I1207a62adbdc764c72c47238c80f47061fc461e6
2016-01-27 22:16:45 +11:00
Tor Lillqvist
2fc2f75244 Bin unused field
Change-Id: I664e3815bcdaff82a03309ae387154914471a80b
2016-01-13 07:58:54 +02:00
Michael Meeks
c71de1458c tdf#96919 - vcl opengl: implement missing XOR mode.
Also revert "tdf#96257: Silly work-around to produce same result ..."
    from commit ec8bc26505.

XOR rendering (it turns out) behaves oddly, and not for all operations.

Change-Id: Ie07d988bbf7fed10fb5625ac547a01a306b05319
Reviewed-on: https://gerrit.libreoffice.org/21282
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2016-01-09 09:33:43 +00:00
Chris Sherlock
8900ffa6fb vcl: update documentation of drawAlphaRect
Change-Id: Ib70e01f4047a4af8ab152541c4234737ec6e5816
2016-01-08 14:58:35 +11:00
Chris Sherlock
c89f9b19ce vcl: silence doxygen warning
Change-Id: I132672582136abfcec0eeafd2400757def824dbf
2016-01-08 14:04:16 +11:00
Michael Meeks
1479ad1c63 vcl: opengl - Kill the last glErrors on common paths.
Re-work the makeSomeOpenGLContextCurrent logic into a shared function
with the existing AcquireContext logic in the SalOpenGLGraphics impl.
Use an OpenGLVCLContextZone placeholder to do both context and zone
management - to include destructors into the zone.

Fix a number of error cases around SalBitmaps where we did not have
a GL context associated when allocating, and/or freeing textures..

Don't drag a (potentially) slower context around in the
OpenGLSalBitmap when we're going to check / fetch a better VCL
context anyway.

Change-Id: Ibbb2358c47156cd078ad28b6aad4f03af36aaf23
Reviewed-on: https://gerrit.libreoffice.org/21127
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2016-01-06 09:17:16 +00:00
Michael Meeks
e81c4d3ea0 tdf#95507 - implement opengl / 50% invert method.
Change-Id: I8488cb8e8074831a6f81e6c8c122462c9819d25d
Reviewed-on: https://gerrit.libreoffice.org/21025
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-12-31 22:38:44 +00:00
Michael Meeks
ce326521f3 vcl: opengl - lean on the default window's context much more.
Avoid creating our own OpenGLContext to render until we need to
refresh the screen.

Change-Id: I29d4a1cb6193c92ed77ae98566f8b897a6bc67b5
Reviewed-on: https://gerrit.libreoffice.org/20709
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2015-12-18 12:00:39 +00:00
Tor Lillqvist
1cb87bf384 Get rid of :: prefix for basegfx in include/vcl and vcl
We already used it without the :: prefix, in many cases in the same
files even. It is nice to have some consistency.

I was not bored enough to do it everywhere.

Change-Id: Ic8ac5bd9b4b2c02c41e5ea937a3d9477824f21cf
2015-12-15 16:41:41 +02:00
Michael Meeks
6c68b71058 vcl: use a custom tag for VCL OpenGLContext's to avoid re-use.
Other code is out of legacy mode now, so can't legacy as a proxy.

Change-Id: Ie3807a3af680b707f2f08d058db955bc9cae6c2b
Reviewed-on: https://gerrit.libreoffice.org/20647
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2015-12-11 20:39:15 +00:00
Stephan Bergmann
878be3cff2 loplugin:staticmethods
Change-Id: I92bafb3459f4a2847aac05f114691b39144dc7c9
2015-12-11 15:09:10 +01:00
Michael Meeks
7bc1f1285e tdf#93529 - move to a Mac-like double-buffered OpenGL model.
This moves us to always rendering to an off-screen texture, and then
(at idle) blitting this to the screen & swapping buffers. Ideally we
should never see any rendering, or flicker again with this approach.

Several fixes are included:
   + avoid multiple OpenGL contexts being created for the same window,
     created excessive flicker problems.
   + de-virtualize UseContext - which context we use is less critical.
   + kill 'mbOffscreen' distinction - all VCL rendering is offscreen.
   + implement 'doFlush' and high priority idle flushing.
   + bind stencil buffer for clipping vs. textures - fixing complex
     clopping when rendering to virtual-devices, and off-screen.
   + document environment. variables.
   + use white as default background glClear color, but red or
     random color for DBGUTIL.

Change-Id: I6be08595b6c8deb7e6db0dbd81308b2c97d2b4ff
2015-12-11 11:39:55 +00:00
Noel Grandin
5a4d508bd6 com::sun::star->css in vcl/
Change-Id: Ifad76177673cf93746ba221838be80ff76fed228
Reviewed-on: https://gerrit.libreoffice.org/20032
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-18 09:03:16 +00:00
Matteo Casalin
48a3359070 Reduce scope of #include <tools/poly.hxx>
Change-Id: I0d64393c029d27c8e6f3b6d360d2509dad16d860
2015-11-05 20:32:47 +01:00
Stephan Bergmann
b36963c0a6 Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY code
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-10-12 17:52:29 +02:00
Michael Meeks
86fc660353 tdf#94281 - don't mix legacy and VCL OpenGLContext's.
Each has rather different assumptions about how life should be.

Change-Id: I85fffc77d14f3a5335a077fcb541a2b31c372043
2015-09-16 17:02:51 +01:00
Michael Meeks
bfceb557ef GL paint-flushing guard re-work.
Unfortunately, since we can have 2x SalGraphics' on a OutputDevice,
and one of these can be a printer - things got very confused around
which context to glFlush. This de-tangles the various reference-counts.

Change-Id: I1062be0b02a91fc9009deaa3ec29c5dbb227df20
Reviewed-on: https://gerrit.libreoffice.org/18604
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-09-16 09:50:43 +00:00
Michael Meeks
2456cf8306 tdf#94006 - re-factor to use rtl::Reference for OpenGLContexts.
Don't use rtl::Reference for the global / list state, so the
ref-count reflects the number of real users.
Hold a reference during ~OpenGLContext.

Change-Id: I4e57a7246159acd58ae7d5a0dfc8704b9795c894
2015-09-08 13:04:02 +01:00
Michael Meeks
6a12aecf6f tdf#93839 - Encourage vdevs to pick up new GL Contexts when they go invalid.
Change-Id: I21726d0dd052fdc87e8dd36ff7122518325f6313
2015-09-01 15:16:08 +01:00
Michael Meeks
b27b9084c5 tdf#93772 - handle framebuffer unbinding on GL context switch.
Also start gl tests in vcldemo:
    $ SAL_FORCEGL=1 vcldemo --gltests

Change-Id: I8f0022770d57cd60c830659e3f7fcc0721320a10
Reviewed-on: https://gerrit.libreoffice.org/18132
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-08-31 19:48:14 +00:00
Norbert Thiebaud
ef46917ff3 Put Polygon from tools under tools:: namespace
Polygon is one of these names that Clash with some system objects
A similar work has been done earlier with PolyPolygon.

Change-Id: Icf2217cb2906292b7275760f1a16be0e150312f5
Reviewed-on: https://gerrit.libreoffice.org/17789
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
2015-08-17 02:07:43 +00:00
Tomaž Vajngerl
dea885f80a opengl: cache native widget textures also for Windows
Change-Id: I476f0ffaef383f3227c0c12b50fcdebf393190f6
Reviewed-on: https://gerrit.libreoffice.org/17487
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2015-08-07 00:58:19 +00:00
Noel Grandin
001e694ecd loplugin:unusedmethods vcl(part2)
Change-Id: I12356b3fdce68282a30cae2b270b02e46558860a
Reviewed-on: https://gerrit.libreoffice.org/16847
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-10 08:21:20 +00:00
Tomaž Vajngerl
2e99e4e11d opengl: use MVP matrix in vertex shaders, pixel offsets
ChangChange all vertex shaders to accept model, view, projection
matrix to calculate the vertex position. So now we don't need to
convert the coordinates to OpenGL coordinate space [-1.0, 1.0]
anymore.

Additionally make it possible to offset vertex coordinates so
we can apply 0.5 px offset (to hit the pixel center) at some
operations.

Change-Id: I8e0a61d5fd4ab6aaa1c0c94439061725918577a0
2015-07-09 10:09:17 +09:00
Noel Grandin
449d272daf loplugin:unusedmethods vcl
Change-Id: I98b88ca3369a2c888fd63796e39d42376d513002
2015-07-08 09:51:27 +02:00
Stephan Bergmann
a9a4d46ce7 loplugin:simplifybool
Change-Id: I8276e8b356ff26241613de64bcd90b5dbcd92f29
2015-04-24 12:36:31 +02:00
Noel Grandin
3e672693e3 loplugin:staticfunction
Change-Id: I909cf7e77f9d7194575636248196fda311fffdb6
2015-04-01 10:37:02 +02:00
Caolán McNamara
09f4a21d1b this drawAlphaBitmap variant is unused
Change-Id: Id2f9073969babe7ad5984f87949ed870f9d5a8f7
2015-03-05 14:05:09 +00:00
Luboš Luňák
df290c6345 make it possible to easily have variants of glsl programs
Now it's possible to add a preamble to the compiled program, so there can
be just one program with #ifdef's inside and the small variants can be
selected using #define in the preamble instead of having several almost
identical programs.

Change-Id: I6c5112313b91b6269ebdecdfc896e0f96209ea2b
2015-01-27 18:42:48 +01:00
Noel Grandin
b44cbb26ef new loplugin: change virtual methods to non-virtual
Where we can prove that the virtual method is never overriden.

In the case of pure-virtual methods, we remove the method entirely.
Sometimes this leads to entire methods and fields being
eliminated.

Change-Id: I138ef81c95f115dbd8c023a83cfc7e9d5d6d14ae
2015-01-26 08:42:28 +02:00
Luboš Luňák
90630adcc1 draw polypolygons properly in opengl backend
The polygons that make the polypolygon cannot be simply drawn one onto another,
because if they overlap, it's actually xor (as used e.g. for drawing the border
when editing a text box Impress, which without this fix just made it a full
rectangle instead of a frame).

Change-Id: I67c7f6448fb3ee0f9742a2299c612515abff68d8
2015-01-19 12:17:52 +01:00
Luboš Luňák
b8b37e6ef2 fix opengl hairline special casing
Apparently polygons can consist of curves too.

Change-Id: Ie35861e6d182e4bd4ac0523e78a90618c96f09a6
2015-01-19 12:17:52 +01:00