summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
AgeCommit message (Collapse)Author
2014-04-10Minor whitespace changeChris Sherlock
Change-Id: Icf3cc0ece477a1370d6dbf609e6b121075b3b999
2014-04-10Check if polygon is a rectangle when drawing gradientChris Sherlock
DrawGradient should check to see if the polygon is a rectangle before adding the gradient to the metafile. If it's a rectangle, we are currently unnecessarily adding XGRAD_SEQ_(BEGIN|END) comment records. Change-Id: I38aef322469f45403ed105d971d7e1d1441ba6a0
2014-04-10Cannot draw metafile-based grayscale gradient into a polygonChris Sherlock
OutputDevice::DrawGradient doesn't check to see if it's meant to be drawing a grayscale gradient when it adds it into the OutputDevice metafile. Now fixed. Change-Id: I83cb5255c01901e33ca1f751e91e8a77292663e6
2014-04-10Remove unnecessary bound-box parameter from clipping functionsChris Sherlock
The bounding rectangle actually comes from the polygon. Therefore, it's not needed. Removed from the following functions in OutputDevice, et al + ClipAndDrawGradient + XORClipAndDrawGradient + ClipAndDrawGradientMetafile Change-Id: I4a87edcddb8895871982f0448854e1c0854124bc
2014-04-09Fix gradient regressionsChris Sherlock
1. Fix regression 8659d189ec04a - rect. gradients no longer do grayscale In commit 8659d189ec04aca78c8ffff97fcca507ca0a9ec3 I swapped the passing parameters going to ImplComplexGradient and ImplLinearGradient from aGradient (the copy) to rGradient (the original which didn't have the grayscale applied). 2. Fix regression 954d7ad4ea7 - grayscale applied at wrong time In commit 954d7ad4ea7ec3746b0f0cd3f850a25e82b39c14 grayscale was applied in DrawGradient (Rectangle &rRect...) after the gradient was written to the metafile. I was attempting to bring it into line with what DrawGradient (PolyPolygon &rPolyPoly...) does. However, it remains to be seen if that's actually doing the right thing - so best to revert this as in all likelihood I may have caused a regression with grayscaled gradients Change-Id: Id94549b3366adb8fcf3cddc59d30029579430a30 Reviewed-on: https://gerrit.libreoffice.org/8908 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-04-08Starting to bring DrawGradient functions into line with each otherChris Sherlock
OutputDevice's DrawGradient functions are remarkably similar - I've reorganized them and brought them into line with some extra checks that seem to be missing. This will allow for easier refactoring. Change-Id: I6f83bb9fe73d34e3668d87b4a4ee91c49d8cea0f
2014-04-08coverity#705329 Missing break in switchCaolán McNamara
Change-Id: I3718c2960dc0a7f760c3c7749417c1e497b7e04e
2014-04-08Clean up function declarations and some unused functionsStephan Bergmann
Change-Id: I382289c7188dfdc9839ff9e6362b6e039ffc5f9e
2014-04-08Remove unnecessary ImplDrawMask function in OutputDeviceChris Sherlock
Every DrawMask variant calls on a final DrawMask - we duplicate code and there is an unnecessary private ImplDrawMask function in OutputDevice. We should just forward calls to DrawMask. Change-Id: Ice24598e3a437ca51a047f6006acc5a66198ff22
2014-04-07Move functions back out of OutputDevice so they aren't exportedChris Sherlock
Moved DoesActionHandleTransparency and IsTransparentAction back to being ocal functions in an anonymous namespace so they aren't exported. Change-Id: Ic8335155c1a32035b02caacb29821bbd26197e49
2014-04-07Minor change to comment in print2.cxxChris Sherlock
Change-Id: Iacf42f6f4ae873a9af6fc60687f54549fa3774c0
2014-04-07Bring static functions into OutputDevice as private functionsChris Sherlock
Also rename them to something saner. ImplIsActionSpecial in particular is not a particularly useful function name, so updating this for clarity. Functions renamed: + ImplIsActionHandlingTransparency() -> DoesActionHandleTransparency() + ImplIsActionSpecial() -> IsTransparentAction() I've also updated some of the comments to clarify. Change-Id: I6c9d0c33d96ce40af2c877b52da66de17ed8ce78
2014-04-07Don't special-case iOS here, eitherTor Lillqvist
Again, no effect. Change-Id: Iab6f1a59d8fe85d3a671c60685496093b8aa1b88
2014-04-07Don't special-case iOS here, eitherTor Lillqvist
Again, no visual effect, though. Change-Id: Ib0c68ef9ee8ca61b31453be97026448e029ec579
2014-04-07Use same code path for iOS as for OS X here, tooTor Lillqvist
Again, no visible effect, which is both good (yay, convergence) and sad (sigh, doesn't fix the problems)... Change-Id: Ica010df4f115a7d47b25dea3613fb9f4b5f6a9ff
2014-04-07Refactored OutputDevice::DrawGradientChris Sherlock
There are two version of OutputDevice::DrawGradient(). They both have common code, I have moved this into their own private functions to allow for code reuse. The first function checks to see if the drawing mode is DRAWMODE_BLACKGRADIENT, DRAWMODE_WHITEGRADIENT or DRAWMODE_SETTINGSGRADIENT (for Window background color) - this just sets the color to black (for XOR operations), white (mainly used for printing) or the background color of a Window (not sure what this is used for!). The second function sets grayscale start and end colors. Change-Id: Idaa85c3b5cfbd8a211fd7b0714eeb8e5b9e9e434 Reviewed-on: https://gerrit.libreoffice.org/8880 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-04-07DrawGradient( const PolyPolygon&... etc) gets graphics instance too earlyChris Sherlock
The OutputDevice::DrawGradient function that takes a PolyPolygon checks for a graphics instance far too early. It then checks it again when it actually needs it, but we really only need to get it once. Change-Id: I2426dfe2e5c03f0e8e3939b53b16c99afe637812
2014-04-07Exit out of DrawGradient that uses PolyPolygon much fasterChris Sherlock
There are two DrawGradient(...) functions in OutputDevice. One uses a PolyPolygon, the other uses a Rectangle. The Rectangle version exits out a lot faster, the PolyPolygon one seems to try to getting clipping regions and a Graphics instance first which is entirely unnecessary if the drawing mode is DRAWMODE_NOGRADIENT! Therefore, I'm bailing out of this function much faster, bring the two functions into line with each other. Change-Id: I882862ab82a93c2c9dfd5fc86f2507926d28aaea
2014-04-06Change newly introduced Clip* functions to ClipAndDrawChris Sherlock
A number of new clipping functions have been introduced, but to make it more clear as to their purpose they have been renamed. They are: + ClipGradientToBounds -> ClipAndDrawGradientToBounds + ClipGradient -> ClipAndDrawGradient + XORClipGradient -> XORClipAndDrawGradient + ClipGradientMetafile -> ClipAndDrawGradientMetafile Change-Id: I2448a62d0473501a8d2613e685ee909cb6df7708 Reviewed-on: https://gerrit.libreoffice.org/8878 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-04-06fdo#74702 Refactor gradient clipping functionsChris Sherlock
There are two gradient clipping functions: one uses a normal intersection to get the symmetric difference to clip the gradient - this is used by OS X and when printing. The other uses XOR clipping, which is an elegant trick to implement complex clipping on graphics systems that have minimal capabilities. cf. http://www.openoffice.org/marketing/ooocon2008/programme/wednesday_1401.pdf Change-Id: Iab16258c8e758c41a29337525927ba780329e887 Reviewed-on: https://gerrit.libreoffice.org/8873 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-04-06Bin unused MAP_REALAPPFONT MapUnit enum valueTor Lillqvist
Change-Id: I759a981c68a899ba314f5b77efa450aa57528433
2014-04-06fdo#74702 use same gradient steps func. to draw linear and complex gradsChris Sherlock
Reworked Output::ImplGetGradientSteps to be usable for both linear and complex (actually, axial, but that's another story) gradients by adding a default parameter. This gets rid of another meOutDevType from gradient functions Change-Id: I1dc918e4c3153617d172560523cfca303f0b904c Reviewed-on: https://gerrit.libreoffice.org/8872 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-04-05coverity#708597 Uninitialized scalar fieldCaolán McNamara
Change-Id: I8f4e4a4502075a0672438cc4c59eddc5ee922228
2014-04-04WMF import: restore support for the ImplReadDIB(bFileHeader=false) versionMiklos Vajna
Regression from commit f7799c9317cc3187ae8aaedc36f829d478a59e77 (Resolves: #i124467# add check for image data offset..., 2014-03-28). Change-Id: I71e78aefca2ca5b07f763ec798226b9bb39a5254
2014-04-03vcl: sal_Bool->bool and cleanupNoel Grandin
- remove unused PFilterDlgCall typedef - remove bool parameter from PFilterCall typedef - it was always being called with false, and nothing was reading it Change-Id: Ic56127e7d55254a7b9b65849a21cb286f52344d1
2014-04-02coverity#708600 Uninitialized pointer fieldCaolán McNamara
Change-Id: I50da1da601981d55f413e03b063cda60b10893e6
2014-04-02Resolves: #i124580# corrected some conversions of scale values...Armin Le Grand
to integer positions (cherry picked from commit d3c4a0c2a87504007a30e6944f52da4654cfa784) Change-Id: Iae4c16250e95938999d60d1c60e1163dfba243cf
2014-04-02Kill superfluous vertical whitespaceTor Lillqvist
Change-Id: I81ce8fd7022bf283db668705efdfb0666f87bde9
2014-04-02fdo#63786 rhbz#1081968: fix PDF export of cropped SVGMichael Stahl
When a META_FLOATTRANSPARENT_ACTION is exported, the beginTransparencyGroup()/endTransparencyGroup() will write something like "Q 0 0 0 rg" where the Q clears the previously set clipping region, which is then not restored. bdf75c7d9bce985ed10a9c41d03420f33ce82142 appears to be a fix for a previous related problem; this essentially reverts it since it introduced the current cropping problem. (Particularly funny is the comment "force reemitting clip region" since the commit does the opposite.) It does not really make sense to me to write something to the page content stream from beginRedirect()/endRedirect(), because that does not actually have any effect on the _content_ of the substream, because the referencing of the substream is only written _after_ endRedirect() returns, so basically what is written can in the best case cancel itself out and in the worst case introduce bugs; the state manipulations there are just to modify the m_aCurrentPDFState following the push()/pop() (it is necessary to clear the clip region before starting the substream to avoid spurious "Q" at the beginning of the stream). Change-Id: I4a5f57b784068bd7d3ba187115444574f7418195
2014-04-02init a few more stream-read svm elementsCaolán McNamara
Change-Id: I3dfa2485afbe66131b86764374d53181b55c2346
2014-04-01valgrind: Conditional jump or move depends on uninitialised valueCaolán McNamara
Change-Id: Ia0b22f7c394d1c2387d1cad7e3d99c79eaeca81a
2014-04-02fdo#74702 update bad advise in comment in DrawTransparentNatively()Chris Sherlock
We really do *not* want to introduce the horror that is meOutDevType into our code. If we need to stop the Printer class from drawing a PolyPolygon then we should let Printer do this, not make OutputDevice make this decision on Printer's behalf! Change-Id: If74eccdf34688ce1164da2bb705ea48eefc18800
2014-04-01fdo#74702 Refactor code to use ClipToPaintRegion()Chris Sherlock
There is a fair amount of code that should use ClipToPaintRegion(). Not only does this remove meOutDevType and decouples classes, but we are using code, so code reuse FTW. Change-Id: I05a2623b73f4a523230dc01d02db33a6df9911ab Reviewed-on: https://gerrit.libreoffice.org/8810 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-04-01Resolves: #i124555# restore stream position after Seek to end of streamOliver-Rainer Wittmann
(cherry picked from commit 61efddf5ab8cd318e022ca1ac817ba0879a55e23) Conflicts: vcl/source/gdi/dibtools.cxx Change-Id: Ie6c0aeab5988b68954a0bdd460317ac9539d8a5f
2014-04-01Improved coding style as shown in examples fdo#75240Milan Zelenka
Change-Id: I6a19453637ea6de8e8c834ad14d7cdf712671e46
2014-03-31fdo#74702 New abstract function UsePolyPolygonForComplexGradient()Chris Sherlock
A new protected abstract function has been introduced only for complex gradients. As it stands, we currently need to work out if we should use a PolyPolygon or a Polygon because, as the comments say: // Determine if we output via Polygon or PolyPolygon // For all rasteroperations other then Overpaint always use // PolyPolygon, as we will get wrong results if we output multiple // times on top of each other. // Also for printers always use PolyPolygon, as not all printers // can print polygons on top of each other. Interestingly, the next line is either wrong or expressed badly, because the check uses PolyPolygons when a VirtualDevice is in use: // Also virtual devices are excluded, as some drivers are too slow. Therefore, I've removed that comment as it seems rather misleading. Change-Id: Ic496284cb2be8e7e2d348eae76aeeec994e1029c Reviewed-on: https://gerrit.libreoffice.org/8802 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-03-31fdo#74702 OutputDevice::ImplInitFontList() fails if no fonts on deviceChris Sherlock
It makes no sense that ImplInitFontList() only fails for Window instances. I have carefully checked all the functions that use this function, and there are no good cases when no fonts won't cause problems. In fact, we have a number of functions that specifically rely on the fact that ImplInitFontList will populate OutputDevice::mpFontCollection with at least one font. Therefore, I'm making this abort if it can't populate the collection, regardless of whether it is a Window, Printer or VirtualDevice. I have also refactored GetDefaultDevice - I now check the default pOutDev parameter to see if it is NULL (the default), in which case it is referring to the default window, so I call on Application::GetDefaultDevice() instead of going straight to the pimpl data structure used by the Application class. Change-Id: I2861521d876d776d7862fc4a7ec56b7acf818789 Reviewed-on: https://gerrit.libreoffice.org/8741 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-03-29typo: optimisation -> optimizationThomas Arnhold
2014-03-29fdo#74702 Refactor OutputDevice::DrawTransparent()Chris Sherlock
I have refactored OutputDevice::DrawTransparent() - functionality is now in the functions DrawInvisiblePolygon(), DrawTransparentNatively() and EmulateDrawTransparent(). DrawTransparentNatively() will return true if it is successful, otherwise it will return false if it isn't possible to draw the transparency natively. This allows us to fall back to a VCL based emulation. The function EmulateDrawTransparent() is virtual because Printer handles transparencies differently to pixel based devices. Change-Id: I300850ccea03c17673666dadd287bcddd40ec5ef Reviewed-on: https://gerrit.libreoffice.org/8779 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-03-29Fix another typo in a commentChris Sherlock
Change-Id: Ic998270701d2e8d2b562ccc869bca0a8d0aac728 Reviewed-on: https://gerrit.libreoffice.org/8778 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-03-29Fix comment typos in OutputDevice::DrawTransparent()Chris Sherlock
Change-Id: I52e9d505719b3f3b985cd5300ebacb5caa57873f Reviewed-on: https://gerrit.libreoffice.org/8777 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-03-28Resolves: #i124467# add check for image data offset...Jürgen Schmidt
against stream length, some further checks (cherry picked from commit 9ceda6fa56d31af717cc2c0c7572cf53cdc47af1) Conflicts: vcl/source/gdi/dibtools.cxx Change-Id: I8993b91ef4fa951e7bae702b0d056996015245ba
2014-03-28Bin rest of DBG_WARNING[123]Tor Lillqvist
Change-Id: Iaaf36d012e353f73f083c9c0ebbbb6d0953b16c8
2014-03-28Merge back branch alg_writerframes to trunkArmin Le Grand
(cherry picked from commit b635b4fa4e42053d30ab639643d2236a20243f62) Conflicts: comphelper/inc/comphelper/TypeGeneration.hxx comphelper/source/property/TypeGeneration.cxx cui/source/factory/dlgfact.hxx cui/source/inc/cuitabarea.hxx cui/source/tabpages/tabarea.cxx cui/source/tabpages/tabarea.hrc cui/source/tabpages/tabarea.src cui/source/tabpages/tparea.cxx drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx drawinglayer/source/texture/texture.cxx editeng/inc/editeng/unotext.hxx editeng/source/items/frmitems.cxx include/drawinglayer/texture/texture.hxx include/editeng/brushitem.hxx include/svx/sdr/primitive2d/sdrdecompositiontools.hxx include/svx/svxids.hrc include/xmloff/xmltypes.hxx reportdesign/source/ui/misc/UITools.cxx sc/source/ui/drawfunc/drawsh.cxx sfx2/source/dialog/tabdlg.cxx svl/source/undo/undo.cxx svx/inc/svx/unoshprp.hxx sw/Library_sw.mk sw/inc/doc.hxx sw/inc/format.hxx sw/inc/frmfmt.hxx sw/inc/swatrset.hxx sw/inc/unomap.hxx sw/inc/unoprnms.hxx sw/source/core/access/accpara.cxx sw/source/core/attr/format.cxx sw/source/core/attr/swatrset.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfly.cxx sw/source/core/doc/notxtfrm.cxx sw/source/core/inc/frame.hxx sw/source/core/inc/frmtool.hxx sw/source/core/layout/atrfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/text/inftxt.cxx sw/source/core/text/porfld.cxx sw/source/core/text/txtfly.cxx sw/source/core/txtnode/fntcache.cxx sw/source/core/uibase/app/docst.cxx sw/source/core/uibase/app/docstyle.cxx sw/source/core/uibase/shells/drawdlg.cxx sw/source/core/uibase/shells/frmsh.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unomap.cxx sw/source/core/unocore/unoprnms.cxx sw/source/core/unocore/unostyle.cxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/fmtui/tmpdlg.src sw/source/ui/frmdlg/frmdlg.cxx sw/source/ui/frmdlg/frmpage.src sw/source/ui/inc/frmsh.hxx xmloff/source/text/txtprhdl.cxx xmloff/source/text/txtprmap.cxx Change-Id: Id3ffaa83bb5594d287f1ac8f2c1c9cf55c70946d
2014-03-26First batch of adding SAL_OVERRRIDE to overriding function declarationsStephan Bergmann
...mostly done with a rewriting Clang plugin, with just some manual tweaking necessary to fix poor macro usage. Change-Id: I71fa20213e86be10de332ece0aa273239df7b61a
2014-03-26fdo#74702 Move device specific bitmap drawing to its own functionChris Sherlock
Device specific drawing has been moved to its own function. VirtualDevice and Window draw in the same way, so can be shared in OutputDevice, however Printer has its only specific ways of drawing so it needs its own method. Change-Id: I051fee029a1ec022a131bb12588189178c4109b2 Reviewed-on: https://gerrit.libreoffice.org/8724 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-03-26Bin DestroyVirtualDevice(): Just use delete directly at call sitesTor Lillqvist
Change-Id: I47c67d3d89ab22b07b3ec6fe7ea6e035d21e85b6
2014-03-25Fix to commit 03568b2e2405fc44435b95720f3680ab1daea836Chris Sherlock
During a rebase I accidentally removed the VirtualDevice::EnableRTL(). Also taking the opportunity to make the function virtual in window.hxx. Change-Id: Ic239d8dc131dfcc6b049c30d2fad4d2d12059059 Reviewed-on: https://gerrit.libreoffice.org/8745 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-03-25fdo#74702 DrawTransformedBitmapEx simplifiedChris Sherlock
Removed bPrinter check from DrawTransformedBitmapEx, also removes meOutDevType. Change-Id: I5fd09efc4f3467702ab9671dc45da1a9c0e3f927 Reviewed-on: https://gerrit.libreoffice.org/8723 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2014-03-25fdo#74702 Move GetBitCount() and GetAlphaBitCount into correct classesChris Sherlock
GetBitCount() works differently for VirtualDevices. GetAlphaBitCount() is really only used by VirtualDevice, so moved functionality from OutputDevice to VirtualDevice. Change-Id: Ic00e32f1fa385542bcce8c9475f0ea5eb9a077f9 Reviewed-on: https://gerrit.libreoffice.org/8722 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>