[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - drawinglayer/source sw/source vcl/source

Oliver-Rainer Wittmann orw at apache.org
Wed Aug 28 07:07:59 PDT 2013


 drawinglayer/source/processor2d/vclprocessor2d.cxx |   24 +------------
 sw/source/filter/ww8/ww8scan.cxx                   |    5 +-
 vcl/source/gdi/outdev2.cxx                         |   38 +++++++++++++++++----
 3 files changed, 36 insertions(+), 31 deletions(-)

New commits:
commit 6c75da5f99a5654f486b0512d69294d14a7a17c3
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Wed Aug 28 13:01:56 2013 +0000

    123108: WW8 import: further adjustment to the validation check for PLCF position arrays

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index c71b27e..12052d8 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -944,8 +944,9 @@ namespace {
         for ( sal_Int32 i = 0; i <= nMaxIndex; ++i )
         {
             if ( pPLCFPosArray[i] < 0
-                 && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -63488 )   // pPLCFPosArray[nMaxIndex-1]==-63488 seems to be allowed
-                 && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -65536 ) ) // pPLCFPosArray[nMaxIndex-1]==-65536 seems to be allowed
+                 && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -63488 )   // pPLCFPosArray[nMaxIndex-1]==-63488 (0xffff0800) seems to be allowed
+                 && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -65536 )   // pPLCFPosArray[nMaxIndex-1]==-65536 (0xffff0000) seems to be allowed
+                 && !( i == nMaxIndex-1 && pPLCFPosArray[i] == -61440 ) ) // pPLCFPosArray[nMaxIndex-1]==-61440 (0xffff112c) seems to be allowed
             {
                 bIsValid = false;
                 break;
commit 2178fea0941c4abb624ecddf2453f670ba68878f
Author: Armin Le Grand <alg at apache.org>
Date:   Wed Aug 28 12:23:58 2013 +0000

    i122923 optimize place to add alpha to bitmaps which need rotation

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index b14fdb0..59ef189 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -409,28 +409,8 @@ namespace drawinglayer
                 }
             }
 
-            // decompose matrix to check for shear, rotate and mirroring
-            basegfx::B2DVector aScale, aTranslate;
-            double fRotate, fShearX;
-
-            aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
-
-            const bool bRotated(!basegfx::fTools::equalZero(fRotate));
-            const bool bSheared(!basegfx::fTools::equalZero(fShearX));
-
-            if(!aBitmapEx.IsTransparent() && (bSheared || bRotated))
-            {
-                // parts will be uncovered, extend aBitmapEx with a mask bitmap
-                const Bitmap aContent(aBitmapEx.GetBitmap());
-#if defined(MACOSX)
-                AlphaMask aMaskBmp( aContent.GetSizePixel());
-                aMaskBmp.Erase( 0);
-#else
-                Bitmap aMaskBmp( aContent.GetSizePixel(), 1);
-                aMaskBmp.Erase(Color(COL_BLACK)); // #122758# Initialize to non-transparent
-#endif
-                aBitmapEx = BitmapEx(aContent, aMaskBmp);
-            }
+            // #122923# do no longer add Alpha channel here; the right place to do this is when really
+            // the own transformer is used (see OutputDevice::DrawTransformedBitmapEx).
 
             // draw using OutputDevice'sDrawTransformedBitmapEx
             mpOutputDevice->DrawTransformedBitmapEx(aLocalTransform, aBitmapEx);
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index cbec937..bc892a6 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -891,7 +891,13 @@ void OutputDevice::DrawTransformedBitmapEx(
         basegfx::B2DRange aVisibleRange(0.0, 0.0, 1.0, 1.0);
 
         // limit maximum area to something looking good for non-pixel-based targets (metafile, printer)
-        double fMaximumArea(1000000.0);
+        // by using a fixed minimum (allow at least, but no need to utilize) for good smooting and an area
+        // dependent of original size for good quality when e.g. rotated/sheared. Still, limit to a maximum
+        // to avoid crashes/ressource problems (ca. 1500x3000 here)
+        const Size& rOriginalSizePixel(rBitmapEx.GetSizePixel());
+        const double fOrigArea(rOriginalSizePixel.Width() * rOriginalSizePixel.Height() * 0.5);
+        const double fOrigAreaScaled(bSheared || bRotated ? fOrigArea * 1.44 : fOrigArea);
+        double fMaximumArea(std::min(4500000.0, std::max(1000000.0, fOrigAreaScaled)));
 
         if(!bMetafile && !bPrinter)
         {
@@ -974,12 +980,30 @@ void OutputDevice::DrawTransformedBitmapEx(
         if(!aVisibleRange.isEmpty())
         {
             static bool bDoSmoothAtAll(true);
-            const BitmapEx aTransformed(
-                rBitmapEx.getTransformed(
-                    aFullTransform,
-                    aVisibleRange,
-                    fMaximumArea,
-                    bDoSmoothAtAll));
+            BitmapEx aTransformed(rBitmapEx);
+
+            // #122923# when the result needs an alpha channel due to being rotated or sheared
+            // and thus uncovering areas, add these channels so that the own transformer (used
+            // in getTransformed) also creates a transformed alpha channel
+            if(!aTransformed.IsTransparent() && (bSheared || bRotated))
+            {
+                // parts will be uncovered, extend aTransformed with a mask bitmap
+                const Bitmap aContent(aTransformed.GetBitmap());
+#if defined(MACOSX)
+                AlphaMask aMaskBmp(aContent.GetSizePixel());
+                aMaskBmp.Erase(0);
+#else
+                Bitmap aMaskBmp(aContent.GetSizePixel(), 1);
+                aMaskBmp.Erase(Color(COL_BLACK)); // #122758# Initialize to non-transparent
+#endif
+                aTransformed = BitmapEx(aContent, aMaskBmp);
+            }
+
+            aTransformed = aTransformed.getTransformed(
+                aFullTransform,
+                aVisibleRange,
+                fMaximumArea,
+                bDoSmoothAtAll);
             basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0);
 
             // get logic object target range


More information about the Libreoffice-commits mailing list