Author: alg
Date: Wed May 29 09:54:44 2013
New Revision: 1487427

URL: http://svn.apache.org/r1487427
Log:
i121591 Corrected some transparent printing stuff for windows

Modified:
    openoffice/trunk/main/vcl/source/gdi/outdev6.cxx
    openoffice/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx

Modified: openoffice/trunk/main/vcl/source/gdi/outdev6.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/gdi/outdev6.cxx?rev=1487427&r1=1487426&r2=1487427&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/gdi/outdev6.cxx (original)
+++ openoffice/trunk/main/vcl/source/gdi/outdev6.cxx Wed May 29 09:54:44 2013
@@ -302,9 +302,15 @@ void OutputDevice::DrawTransparent( cons
                const double fTransparency = 0.01 * nTransparencePercent;
                if( mbFillColor )
                {
-                       // draw the transparent polygon
-                       // NOTE: filled polygons are assumed to be drawn as if 
they were always closed
-                       bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, 
fTransparency, this );
+            // #121591#
+            // CAUTION: Only non printing (pixel-renderer) VCL commands from 
OutputDevices
+            // should be used when printing. Normally this is avoided by the 
printer being
+            // non-AAed and thus e.g. on WIN GdiPlus calls are not used. It 
may be necessary
+            // to add (OUTDEV_PRINTER != meOutDevType) to the entering if 
statement, thus
+            // using the fallbacl some lines below (which is not very good, 
though). For
+            // now, WinSalGraphics::drawPolyPolygon will detect printer usage 
and correct
+            // the wrong mapping (see there for details)
+            bDrawn = mpGraphics->DrawPolyPolygon( aB2DPolyPolygon, 
fTransparency, this );
                }
 
                if( mbLineColor )

Modified: openoffice/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx?rev=1487427&r1=1487426&r2=1487427&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx (original)
+++ openoffice/trunk/main/vcl/win/source/gdi/salgdi_gdiplus.cxx Wed May 29 
09:54:44 2013
@@ -178,6 +178,33 @@ bool WinSalGraphics::drawPolyPolygon( co
                aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone);
         }
 
+        if(mbPrinter)
+        {
+            // #121591#
+            // Normally GdiPlus should not be used for printing at all since 
printers cannot
+            // print transparent filled polygon geometry and normally this 
does not happen
+            // since OutputDevice::RemoveTransparenciesFromMetaFile is used as 
preparation
+            // and no transparent parts should remain for printing. But this 
can be overriden
+            // by the user and thus happens. This call can only come 
(currently) from 
+            // OutputDevice::DrawTransparent, see comments sthere with the 
same TaskID.
+            // If it is used, the mapping for the printer is wrong and needs 
to be corrected. I
+            // checked that there is *no* transformation set (testcode 
commented out below) and
+            // estimated that a stable factor dependent of the printer's DPI 
is used. Create
+            // and set a transformation here to correct this
+            const Gdiplus::REAL aDpiX(aGraphics.GetDpiX());
+            const Gdiplus::REAL aDpiY(aGraphics.GetDpiY());
+
+            // test code to check the current transformation at the graphics 
device
+            //Gdiplus::Matrix matrix;
+            //aGraphics.GetTransform(&matrix);
+            //Gdiplus::REAL elements[6];
+            //matrix.GetElements(elements);
+
+            Gdiplus::Matrix aPrinterTransform;
+            aPrinterTransform.Scale(Gdiplus::REAL(100.0) / aDpiX, 
Gdiplus::REAL(100.0) / aDpiY);
+            aGraphics.SetTransform(&aPrinterTransform);
+        }
+
                aGraphics.FillPath(&aTestBrush, &aPath);
        }
 


Reply via email to