Commit Graph

243 Commits

Author SHA1 Message Date
Noel Grandin
3a36cf434f loplugin:checkunusedparams in configmgr and vcl
Change-Id: I7226d01f38e6edaf3868d7267d9b02dbdbc9e5ba
Reviewed-on: https://gerrit.libreoffice.org/36975
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-28 08:32:56 +02:00
Noel Grandin
a334e85a2f clang-tidy readability-simplify-boolean-expr in vcl
Change-Id: I10ad38bcb5b05a754de9a396f4aaa79d97458d6f
Reviewed-on: https://gerrit.libreoffice.org/36930
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-25 12:15:17 +02:00
Miklos Vajna
a5a571307f tdf#82580 tools: rename Rectangle to tools::Rectangle
Mostly generated using

make check COMPILER_EXTERNAL_TOOL=1 CCACHE_PREFIX=clang-rename-wrapper RENAME_ARGS="-qualified-name=Rectangle -new-name=tools::Rectangle"

Except some modules have their own foo::tools namespace, so there have
to use ::tools::Rectangle. This commit just moves the class from the
global namespace, it does not update pre/postwin.h yet.

Change-Id: I42b2de3c6f769fcf28cfe086f98eb31e42a305f2
Reviewed-on: https://gerrit.libreoffice.org/35923
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2017-03-31 06:27:11 +00:00
Caolán McNamara
9a61fdbf0b Related: tdf#105514 recursive fallback GetOpenGLContext
Change-Id: Icb8f3751806ef9c1c7c92cd8b7cc7c28595eca22
Reviewed-on: https://gerrit.libreoffice.org/33580
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-01-27 08:53:13 +00:00
Jan-Marek Glogowski
fdc612619c Refactor Scheduler to add Task class
Moves all the "task-specific" stuff into a Task class and just
keeps the "real" static Scheduler functions in the original
Scheduler class.

Change-Id: I9eb02d46e2bcf1abb06af5bab1fa0ee734d1984c
2017-01-17 16:08:47 +01:00
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
David Tardon
c03090c97d don't leak impl. details
Also, returning std::unique_ptr<>& doesn't make any sense.

Change-Id: Iefb2a0bfe614264bc7b5d15652fcc15243df3d06
2016-11-28 17:25:58 +01:00
Stephan Bergmann
aafc083257 loplugin:unnecessaryoverride (dtors) in vcl
Change-Id: I38e24991308bf52e75259a30d332145aef9a757b
2016-11-23 21:48:33 +01:00
Tomaž Vajngerl
d115a235bf tdf#103804 reduced register areaScale shader and detection for intel
Some intel drivers crash when areaScale shader with "large" array
is used. This adds a "reduced register" version of the areaScale
shader. We still use the first version of the shader for other
drivers and switch between the 2 implementations with a runtime
detection.

Change-Id: I1860f898c03b40a600eb1b41f7262719382a7171
Reviewed-on: https://gerrit.libreoffice.org/30571
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-11-09 09:56:59 +00:00
Tomaž Vajngerl
94b6b4678b opengl: blit offscreen framebuffer instead of drawing
Change-Id: I3ab0da9cf83e0e85b8442b34ecd6eb91dd3d1bd3
Reviewed-on: https://gerrit.libreoffice.org/27875
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-10-19 08:08:51 +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
1256980239 convert GradientStyle to scoped enum
Change-Id: Ib740da708612df7a5f4b8c82262b9b1bd436604d
2016-09-05 08:21:46 +02:00
Tomaž Vajngerl
24d1904264 tdf#101008 fix XOR rendering
Change-Id: Ied73966633e5ffd56faccea7ec1408bd83642b58
Reviewed-on: https://gerrit.libreoffice.org/27862
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-08-04 09:54:18 +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
19baa61e1d tdf#99795 drawAlphaBitmap should scale the bitmap if necessary
drawAlphaBitmap didn't use a high quality scaler for scaling
the texture but used the default scaling method in OpenGL (either
GL_NEAREST or GL_LINEAR, whichever is defined when texture
is created) which are low quality scalers - especially when
downscaling textures.

Change-Id: I6236b2ee92b9e5044b176a40a444027072b09b58
2016-06-09 19:11:30 +09: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
bb15752331 opengl: fix transparency when drawing polypolygons
Change-Id: I963b1bbf322acb20bf4e21834ba9c7ae400eaf7d
2016-06-08 11:39:22 +09:00
Tomaž Vajngerl
2003076c43 opengl: batch draw polypolygons
Change-Id: Ie9c41f95815a57c3a9e68ce7b7b0c1e09291988b
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
d0ec6c7b72 opengl: VertexUtils, deferred flush update, remove unneeded calls
VertexUtils - collection of utils for working with Vertices.

Add deferred flush to some places directly where it is called
indirectly. This is to assure that we don't produce regressions
if we change the behavior in the future.

drawAlphaBitmap is the same as drawBitmap so when drawBitmap is
called just redirect to drawAlphaBitmap

Change-Id: Ibef1ba88865856d92d9e93734cf5d6561af785c0
2016-06-08 11:39:22 +09:00
Tomaž Vajngerl
fdcd13c1c2 tdf#100080 set unused shader attribs with values, fixes GL on AMD
AMD drivers don't work well if a shader has a defined but not
enabled shader attributes. For this reason we need to make sure
that all attributes are set to some value even if the shader
doesn't use that attribute. Intel drivers, on the other hand,
crash if you enable an attribute and don't set it (set it
to null) - so we can't use this workaround.

Change-Id: Ic076cf8a5fac8ef048d0054e6e4340b47b4d5188
Reviewed-on: https://gerrit.libreoffice.org/25591
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-05-29 06:20:36 +00:00
Tomaž Vajngerl
3cac38b231 opengl: combined shaders to reduce shader switching
Combine most common shaders for non-texture drawing and texture
drawing into two combined shaders. Inside the shader we switch
between the code paths with if statements.

Using if statements (or any other branching statements) is
discouraged inside shaders but on the other hand we reduce program
state changes if we have less shader changes - which is more
important for us as we want to push more work to the GPU.

Change-Id: I6701b93faa9b0f55dd0af6d983ce4c2de4539c70
Reviewed-on: https://gerrit.libreoffice.org/25357
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-05-23 23:34:31 +00: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
Tor Lillqvist
5cf5dc3220 loplugin:defaultparams
Change-Id: Ib3d2367fc5c0e97b269e6a4b18f85c20ca89221e
2016-05-19 10:03:28 +03:00
Tomaž Vajngerl
e480b2cf3e opengl: track the state of blend, DrawArrays on OpenGLProgram
This adds tracking of GL_BLEND and glBlendFunc which are usually
set when setting up the current draw call on OpenGLProgram with
SetBlendFunc method.

Until now the final draw call (glDrawArrays) was called outside
of OpenGLProgram. This is a problem because we need to know if
we did call SetBlendFunc or not between when we used or reused
the current program. So we added DrawArrays to OpenGLProgram and
refactored all draw calls in OpenGLSalGraphicsImpl to use this.

From now on glDrawArrays should not be called directly but always
through OpenGLProgram.

Change-Id: I530b4b948af8a962669a3751e1a95ff3986ffec9
Reviewed-on: https://gerrit.libreoffice.org/25083
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-05-19 02:47:57 +00:00
Tomaž Vajngerl
37ed508022 tdf#99130 use subdivision on B2DPolygon, angle based subdivision
Remove the subdivider we used until now as there is a better
way to subdivide a polygon with getDefaultAdaptiveSubdivision,
which in additiona also caches the result. The subdivider used in
getDefaultAdaptiveSubdivision was a limited count based subdivider
so this exchanges that with an angle based one which gives much
better results.

Change-Id: I95c009ccf3d54305df0d8eef177cab0df0a23bea
Reviewed-on: https://gerrit.libreoffice.org/25033
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-05-17 11:31:43 +00:00
Noel Grandin
f12b17867e clang-tidy modernize-loop-convert in vcl
Change-Id: I79e97a4826bfe3918de223cccf48646a1404f901
Reviewed-on: https://gerrit.libreoffice.org/24922
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-13 08:09:28 +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
Tor Lillqvist
9b1febead3 There is nothing called 'flushAndSwap'
Probably what is meant is the name of the function, which is doFlush().

Change-Id: Ia949a2f8ce19950b1cd0b676c5146488ce7182ee
2016-05-11 15:10:26 +03:00
Noel Grandin
9058b06443 Convert SAL_INVERT to scoped enum
Change-Id: If9f725c791f9d01efba098caed8387f21862fa04
Reviewed-on: https://gerrit.libreoffice.org/24825
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-10 12:08:40 +00:00
Tor Lillqvist
347e46da39 Check if we have an OpenGL context before using API that requires it
Avoid GL errors when glDisable() is called without a context.

Change-Id: Ie9eae498c207a82934228ad2f74b7096308f5530
2016-05-10 13:14:59 +03:00
Tomaž Vajngerl
540fee2dc7 opengl: track the state of glViewport
We don't want to set the viewport over and over again.

Change-Id: I60b84a009d4058743e30587616604f9b6fc0f601
Reviewed-on: https://gerrit.libreoffice.org/24507
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-04-30 03:08:30 +00:00
Tomaž Vajngerl
a57d048f88 opengl: sync scissor and stencil state, generic capability state
Scissor and stencil test needed to be disabled in flush() (which
means every postDraw call) because sometimes the state became out
of sync with the current state. This commit adds sync() function
which synchronises the actual OpenGL state and adds debugging
mechanisms to warn when the state becomes out of sync (so we can
inspect the exact moment in apitrace).

Added a GenericCapabilityState for GL capabilities like
GL_SCISSORS_TEST, GL_STENCIL_TEST, GL_BLEND,... and refactored
existing ScissorState and StencilState to inherit from it.

Change-Id: Ifc159108a5ce850c78a89b1f5b8d12ecdd84f459
Reviewed-on: https://gerrit.libreoffice.org/24506
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-04-30 03:08:08 +00:00
Tomaž Vajngerl
b8f0e6452c opengl: track the state of stencil test
Change-Id: Id3e15e91316df740f04a42ed8c95b77d83240b5a
Reviewed-on: https://gerrit.libreoffice.org/24505
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-04-30 03:07:51 +00:00
Tomaž Vajngerl
51e953a357 opengl: track the state of scissor test and the dimensions
For performance reasons we shouldn't set glScissors if it is not
necessary so we remember to what dimensions we set the glScissor
and don't set it again if this is not necessary. The same goes for
enabling/disabling the GL_SCISSOR_TEST.

Change-Id: I5e1383081b4e76bdded04525c780d3a724f9db5c
Reviewed-on: https://gerrit.libreoffice.org/24504
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-04-30 03:07:25 +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
cb4015bb28 use atan2 from std instead of glm
Some system glm libs don't (yet) have atan2 available and it is not
really needed in this case anyway (as we don't use it for glm::vec2
for example) so just replace it with std::atan2.

Change-Id: I5d417338ec167489f0252821650c64be454cca8a
2016-04-14 16:16:36 +09:00
Tomaž Vajngerl
ea6196f0a5 tdf#99244 opengl: miter limit for poly lines
Change-Id: I1c363a8f1d21bbacab0c5785544aa8becfe39363
2016-04-14 14:19:10 +09:00
Noel Grandin
03fd8d24c2 clang-tidy performance-unnecessary-value-param in vcl
Change-Id: I403f148060891feec56d7d2ef173a9c4934baf9e
Reviewed-on: https://gerrit.libreoffice.org/23995
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-12 06:32:52 +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
Stephan Bergmann
662b327bfb loplugin:stringconstant
Change-Id: I35551656e5d5d65fd94d60b04e7a07cf1f4be003
2016-04-07 08:34:11 +02:00
Marco Cecchetti
641840dc0f tdf#98960 - DrawTransformedTexture adapted to the new area scale shader
Change-Id: I7c911f2aaccbffacfa5673b120b6177b8bea0672
Reviewed-on: https://gerrit.libreoffice.org/23864
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-04-07 00:25:46 +00: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
Marco Cecchetti
7fdc29469d tdf#95616 - fix flickering issue
Change-Id: I0d5bfdf44dde2cd06c193f34e81c6ce71291bba1
Reviewed-on: https://gerrit.libreoffice.org/23238
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2016-03-14 11:08:43 +00:00
Michael Meeks
368d7a1a40 vcldemo: improved text rendering test.
Merge in some interesting font / unicode combinations from bugs.

Change-Id: I2c89cf505a7850fcc482826328e1cdb8e37508aa
Reviewed-on: https://gerrit.libreoffice.org/23056
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2016-03-09 15:23:16 +00:00