summaryrefslogtreecommitdiff
path: root/vcl/opengl/gdiimpl.cxx
AgeCommit message (Collapse)Author
2017-09-18Acknowledge that WinSalGraphicsImpl::drawPolyLine modifies pPtAryStephan Bergmann
Change-Id: Idde44857f8ace883cc759321c71e2ca7a4359334 Reviewed-on: https://gerrit.libreoffice.org/42406 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-08-17remove UL/L suffixes from integer constants on the RHS of expressionsNoel Grandin
Change-Id: I899a8126c9d971601fea6c77eca165718aea0ac5 Reviewed-on: https://gerrit.libreoffice.org/41237 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-31loplugin:oncevarNoel Grandin
extend oncevar to any POD type Change-Id: Ia98ee0a67f183e40fb0c38477760124b2c411dc0 Reviewed-on: https://gerrit.libreoffice.org/40564 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-18loplugin:constparams in vclNoel Grandin
Change-Id: I36afe2107e07ffb9b73c0b76be600e3e999a0fd4 Reviewed-on: https://gerrit.libreoffice.org/40116 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-14vcl: If we fail to create an OpenGLContext for a window - don't crash.Michael Meeks
Change-Id: I362724911ac60df7ac699495bac852be9e7c6b13 Reviewed-on: https://gerrit.libreoffice.org/36684 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-04-28loplugin:checkunusedparams in configmgr and vclNoel Grandin
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-25clang-tidy readability-simplify-boolean-expr in vclNoel Grandin
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-03-31tdf#82580 tools: rename Rectangle to tools::RectangleMiklos Vajna
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-01-27Related: tdf#105514 recursive fallback GetOpenGLContextCaolán McNamara
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-17Refactor Scheduler to add Task classJan-Marek Glogowski
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
2016-12-07convert PolyFlags to scoped enumNoel Grandin
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-11-28don't leak impl. detailsDavid Tardon
Also, returning std::unique_ptr<>& doesn't make any sense. Change-Id: Iefb2a0bfe614264bc7b5d15652fcc15243df3d06
2016-11-23loplugin:unnecessaryoverride (dtors) in vclStephan Bergmann
Change-Id: I38e24991308bf52e75259a30d332145aef9a757b
2016-11-09tdf#103804 reduced register areaScale shader and detection for intelTomaž Vajngerl
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-10-19opengl: blit offscreen framebuffer instead of drawingTomaž Vajngerl
Change-Id: I3ab0da9cf83e0e85b8442b34ecd6eb91dd3d1bd3 Reviewed-on: https://gerrit.libreoffice.org/27875 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-09-13loplugin:override: No more need for the "MSVC dtor override" workaroundStephan Bergmann
The issue of 362d4f0cd4e50111edfae9d30c90602c37ed65a2 "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-05convert GradientStyle to scoped enumNoel Grandin
Change-Id: Ib740da708612df7a5f4b8c82262b9b1bd436604d
2016-08-04tdf#101008 fix XOR renderingTomaž Vajngerl
Change-Id: Ied73966633e5ffd56faccea7ec1408bd83642b58 Reviewed-on: https://gerrit.libreoffice.org/27862 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2016-06-24tdf#100411 start the flush timer when batching (PostBatchDraw)Tomaž Vajngerl
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-09tdf#96971 SetXORMode - remove un-needed parametermelikeyurtoglu
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-09tdf#99795 drawAlphaBitmap should scale the bitmap if necessaryTomaž Vajngerl
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-08opengl: batch drawing of polylinesTomaž Vajngerl
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-08opengl: deferred texture drawing in RenderList, add drawAlphaRectTomaž Vajngerl
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-08opengl: fix transparency when drawing polypolygonsTomaž Vajngerl
Change-Id: I963b1bbf322acb20bf4e21834ba9c7ae400eaf7d
2016-06-08opengl: batch draw polypolygonsTomaž Vajngerl
Change-Id: Ie9c41f95815a57c3a9e68ce7b7b0c1e09291988b
2016-06-08opengl: batch drawing of pixel, line, rect draw callsTomaž Vajngerl
Change-Id: Ib1619fa476f488c5315411b1ad4d1b7464c70c69
2016-06-08opengl: VertexUtils, deferred flush update, remove unneeded callsTomaž Vajngerl
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-05-29tdf#100080 set unused shader attribs with values, fixes GL on AMDTomaž Vajngerl
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-23opengl: combined shaders to reduce shader switchingTomaž Vajngerl
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-23opengl: use line shader for all line drawing not just polylinesTomaž Vajngerl
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-23opengl: use existing code for "legacy" polyline, polygon render.Tomaž Vajngerl
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-19loplugin:defaultparamsTor Lillqvist
Change-Id: Ib3d2367fc5c0e97b269e6a4b18f85c20ca89221e
2016-05-19opengl: track the state of blend, DrawArrays on OpenGLProgramTomaž Vajngerl
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-17tdf#99130 use subdivision on B2DPolygon, angle based subdivisionTomaž Vajngerl
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-13clang-tidy modernize-loop-convert in vclNoel Grandin
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-12simplify SalGraphics::copyArea flags argumentNoel Grandin
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-11There is nothing called 'flushAndSwap'Tor Lillqvist
Probably what is meant is the name of the function, which is doFlush(). Change-Id: Ia949a2f8ce19950b1cd0b676c5146488ce7182ee
2016-05-10Convert SAL_INVERT to scoped enumNoel Grandin
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-10Check if we have an OpenGL context before using API that requires itTor Lillqvist
Avoid GL errors when glDisable() is called without a context. Change-Id: Ie9eae498c207a82934228ad2f74b7096308f5530
2016-04-30opengl: track the state of glViewportTomaž Vajngerl
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-30opengl: sync scissor and stencil state, generic capability stateTomaž Vajngerl
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-30opengl: track the state of stencil testTomaž Vajngerl
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-30opengl: track the state of scissor test and the dimensionsTomaž Vajngerl
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-26tdf#48066 render stroke-miterlimit correctly in SVG importRegina Henschel
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-14use atan2 from std instead of glmTomaž Vajngerl
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-14tdf#99244 opengl: miter limit for poly linesTomaž Vajngerl
Change-Id: I1c363a8f1d21bbacab0c5785544aa8becfe39363
2016-04-12clang-tidy performance-unnecessary-value-param in vclNoel Grandin
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-08opengl: fix wrong clipping when drawing textTomaž Vajngerl
Change-Id: I41a182c5309586337032328dfe82b1c6715f0dc2
2016-04-08opengl: use packed texture atlas for glyph cache in win. backendTomaž Vajngerl
Change-Id: I6a627699d49bad47213788877fa3947ad2ef83f4
2016-04-08opengl: deferred and optimized (text) texture drawingTomaz Vajngerl
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