[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-0' - 2 commits - translations vcl/source

Jan Holesovsky kendy at collabora.com
Mon Jan 27 13:27:12 PST 2014


 translations               |    2 +-
 vcl/source/gdi/outdev2.cxx |   23 ++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 3eb562503e94c25b6eb37bf66219f10ec67486bc
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Jan 27 20:11:26 2014 +0100

    fdo#74124: Scale the pictures before calling ImplDrawAlpha().
    
    When the source and destination bitmap do not have the same size,
    ImplDrawAlpha() does not use direct paint, but instead it gets the image from
    the screen, blends it with the provided bitmap, and again draws it.
    
    Unfortunately, the blending uses the most trivial (and ugly) way of scaling;
    so to produce much better results, let's scale to the destination size before
    even calling ImplDrawAlpha().
    
    The sideeffect is that we use the direct paint in most cases now; so hopefully
    it pays off to do the (a bit more expensive) scale first.
    
    Change-Id: I3b6b275710220910709ae4345ad6be3d6e4bf79c
    Reviewed-on: https://gerrit.libreoffice.org/7701
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit 39f0062a074c24fd2bdc5b20f457e51fc322c82b)
    Reviewed-on: https://gerrit.libreoffice.org/7702
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>
    Reviewed-by: Joren De Cuyper <jorendc at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 759c3b4..8ec9c21 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1001,7 +1001,25 @@ void OutputDevice::ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize
 
     if(aBmpEx.IsAlpha())
     {
-        ImplDrawAlpha( aBmpEx.GetBitmap(), aBmpEx.GetAlpha(), rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
+        Size aDestSizePixel(LogicToPixel(rDestSize));
+
+        BitmapEx aScaledBitmapEx(aBmpEx);
+        Point aSrcPtPixel(rSrcPtPixel);
+        Size aSrcSizePixel(rSrcSizePixel);
+
+        // we have beautiful scaling algorithms, let's use them
+        if (aDestSizePixel != rSrcSizePixel && rSrcSizePixel.Width() != 0 && rSrcSizePixel.Height() != 0)
+        {
+            double fScaleX = double(aDestSizePixel.Width()) / rSrcSizePixel.Width();
+            double fScaleY = double(aDestSizePixel.Height()) / rSrcSizePixel.Height();
+
+            aScaledBitmapEx.Scale(fScaleX, fScaleY);
+
+            aSrcSizePixel = aDestSizePixel;
+            aSrcPtPixel.X() = rSrcPtPixel.X() * fScaleX;
+            aSrcPtPixel.Y() = rSrcPtPixel.Y() * fScaleY;
+        }
+        ImplDrawAlpha(aScaledBitmapEx.GetBitmap(), aScaledBitmapEx.GetAlpha(), rDestPt, rDestSize, aSrcPtPixel, aSrcSizePixel);
         return;
     }
 
@@ -2063,6 +2081,9 @@ void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
         if( !bNativeAlpha
                 &&  !aBmpRect.Intersection( Rectangle( rSrcPtPixel, rSrcSizePixel ) ).IsEmpty() )
         {
+            // The scaling in this code path produces really ugly results - it
+            // does the most trivial scaling with no smoothing.
+
             GDIMetaFile*    pOldMetaFile = mpMetaFile;
             const bool      bOldMap = mbMap;
             mpMetaFile = NULL; // fdo#55044 reset before GetBitmap!
commit 04c7b6fa027e525abf6fd0e1573ada76663ff6de
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Mon Jan 27 21:37:30 2014 +0100

    Updated core
    Project: translations  85b75bf12d8bb33d67c57c5a8e7c470732da289a

diff --git a/translations b/translations
index 51243d8..85b75bf 160000
--- a/translations
+++ b/translations
@@ -1 +1 @@
-Subproject commit 51243d88a433300e67c53a58febea269cca9ee31
+Subproject commit 85b75bf12d8bb33d67c57c5a8e7c470732da289a


More information about the Libreoffice-commits mailing list