[Libreoffice-commits] core.git: sc/source svx/source vcl/source

Ashod Nakashian ashod.nakashian at collabora.co.uk
Fri Jun 17 23:33:11 UTC 2016


 sc/source/ui/view/gridwin4.cxx                     |    3 ++
 svx/source/sdr/contact/objectcontactofpageview.cxx |   28 ++++++++++++++++++++-
 vcl/source/outdev/bitmap.cxx                       |   15 +++++++++--
 3 files changed, 43 insertions(+), 3 deletions(-)

New commits:
commit 9d6f4cf26e59b846bcdf4139c6aeb76db5a554f7
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Jun 4 21:29:30 2016 -0400

    LOK: fast tile rendering (graphics and buttons)
    
    Since embedded graphics and buttons use
    absolute coordinates, we set the origin
    to be the top-left corner of the tile.
    This includes the origin + ScrPos (see
    previous patch).
    
    Then, the coordinates of the graphic is
    shifted by this amount to make sure it
    renders in its relative position to the tile.
    
    This renders embedded graphics and buttons
    at their correct position, with some limitations.
    
    Tiles large enough to cover a graphic object
    show the graphic object where it should be.
    However, rendering a relatively small tile
    doesn't render the graphic. This seems to be
    an issue with moving the graphic's coordinate
    at a later stage than the 2D Processor decides
    what objects intersect with the 'view area'
    that is rendered.
    
    Another issue is that graphs don't render.
    What they seem to suffer is incorrect scale
    and a fix coordinates (they show up as tiny
    thumbnails at the top-left corner and grow
    in proportion to the real graph when resized).
    
    These shall be addressed in a separate patch.
    
    Reviewed-on: https://gerrit.libreoffice.org/26204
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit 5f01d80f75dc86b393cc2fdb66b94aece964c674)
    
    Change-Id: I4b71bf5f2e357d1114d46022bc00905ceed0c2f9
    Reviewed-on: https://gerrit.libreoffice.org/26376
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 315fba7..fb2a9c1 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -821,6 +821,9 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
         auto aOrigin = aOriginalMode.GetOrigin();
         aOrigin.setX(aOrigin.getX() / TWIPS_PER_PIXEL + nScrX);
         aOrigin.setY(aOrigin.getY() / TWIPS_PER_PIXEL + nScrY);
+        static const double twipFactor = 15 * 1.76388889; // 26.45833335
+        aOrigin = Point(aOrigin.getX() - aOrigin.getX() / twipFactor,
+                        aOrigin.getY() - aOrigin.getY() / twipFactor);
         aNew.SetOrigin(aOrigin);
         pContentDev->SetMapMode(aNew);
     }
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index 6dcd577..cead940 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -36,6 +36,7 @@
 #include <drawinglayer/processor2d/processor2dtools.hxx>
 #include <svx/unoapi.hxx>
 #include <unotools/configmgr.hxx>
+#include <comphelper/lok.hxx>
 
 #include "eventhandler.hxx"
 #include <memory>
@@ -168,7 +169,7 @@ namespace sdr
             bool bClipRegionPushed(false);
             const vcl::Region& rRedrawArea(rDisplayInfo.GetRedrawArea());
 
-            if(!rRedrawArea.IsEmpty())
+            if(!rRedrawArea.IsEmpty() && !comphelper::LibreOfficeKit::isActive())
             {
                 bClipRegionPushed = true;
                 pOutDev->Push(PushFlags::CLIPREGION);
@@ -231,6 +232,14 @@ namespace sdr
 
                 // transform to world coordinates
                 aViewRange.transform(rTargetOutDev.GetInverseViewTransformation());
+                if (comphelper::LibreOfficeKit::isActive())
+                {
+                    const int TWIPS_PER_PIXEL = 15;
+                    aViewRange = basegfx::B2DRange(aViewRange.getMinimum().getX(),
+                                                   aViewRange.getMinimum().getY(),
+                                                   aViewRange.getMaximum().getX() * TWIPS_PER_PIXEL,
+                                                   aViewRange.getMaximum().getY() * TWIPS_PER_PIXEL);
+                }
             }
 
             // update local ViewInformation2D
@@ -292,15 +301,32 @@ namespace sdr
                 rDisplayInfo.ClearGhostedDrawMode(); // reset, else the VCL-paint with the processor will not do the right thing
                 pOutDev->SetLayoutMode(ComplexTextLayoutFlags::Default); // reset, default is no BiDi/RTL
 
+                // Save the map-mode since creating the 2D processor will replace it.
+                const MapMode aOrigMapMode = pOutDev->GetMapMode();
+
                 // create renderer
                 std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
                     drawinglayer::processor2d::createProcessor2DFromOutputDevice(
                         rTargetOutDev, getViewInformation2D()));
 
+                if (comphelper::LibreOfficeKit::isActive())
+                {
+                    // Restore the origin.
+                    MapMode aMapMode = pOutDev->GetMapMode();
+                    aMapMode.SetOrigin(aOrigMapMode.GetOrigin());
+                    pOutDev->SetMapMode(aMapMode);
+                }
+
                 if(pProcessor2D)
                 {
                     pProcessor2D->process(xPrimitiveSequence);
                 }
+
+                if (comphelper::LibreOfficeKit::isActive())
+                {
+                    // Restore the original map-mode.
+                    pOutDev->SetMapMode(aOrigMapMode);
+                }
             }
 
             // #114359# restore old ClipReghion
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 1c54f0e..c86de38 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -38,6 +38,7 @@
 
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <memory>
+#include <comphelper/lok.hxx>
 
 void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap )
 {
@@ -1177,7 +1178,6 @@ void OutputDevice::DrawTransformedBitmapEx(
     if ( mnDrawMode & DrawModeFlags::NoBitmap )
         return;
 
-
     // decompose matrix to check rotation and shear
     basegfx::B2DVector aScale, aTranslate;
     double fRotate, fShearX;
@@ -1194,12 +1194,23 @@ void OutputDevice::DrawTransformedBitmapEx(
         // with no rotation, shear or mirroring it can be mapped to DrawBitmapEx
         // do *not* execute the mirroring here, it's done in the fallback
         // #i124580# the correct DestSize needs to be calculated based on MaxXY values
-        const Point aDestPt(basegfx::fround(aTranslate.getX()), basegfx::fround(aTranslate.getY()));
+        Point aDestPt(basegfx::fround(aTranslate.getX()), basegfx::fround(aTranslate.getY()));
         const Size aDestSize(
             basegfx::fround(aScale.getX() + aTranslate.getX()) - aDestPt.X(),
             basegfx::fround(aScale.getY() + aTranslate.getY()) - aDestPt.Y());
+        const Point aOrigin = GetMapMode().GetOrigin();
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            aDestPt.Move(aOrigin.getX(), aOrigin.getY());
+            EnableMapMode(false);
+        }
 
         DrawBitmapEx(aDestPt, aDestSize, rBitmapEx);
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            EnableMapMode(true);
+            aDestPt.Move(-aOrigin.getX(), -aOrigin.getY());
+        }
         return;
     }
 


More information about the Libreoffice-commits mailing list