[Libreoffice-commits] core.git: Branch 'feature/tiledrendering' - 3 commits - ios/shared sw/source

Tor Lillqvist tml at collabora.com
Mon Nov 4 11:21:59 CET 2013


 ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h |   14 ++++--
 sw/source/core/view/viewsh.cxx                                                                              |   23 +++++-----
 2 files changed, 22 insertions(+), 15 deletions(-)

New commits:
commit d0d8137358bda5a4dc7987998aa7abafb30bc465
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 4 12:21:25 2013 +0200

    Adjust parameter defaults to give pleasant result
    
    Change-Id: Ifee900344547ef25b2041d25c13fcbc50428485e

diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
index 3ca92f3..6c1aea2 100644
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
+++ b/ios/shared/ios_sharedlo/objective_c/view_controllers/testing_tiles/MLOTestingTileParametersViewController.h
@@ -9,12 +9,18 @@
 #import "MLOViewController.h"
 #import "MLOTestingTileSubviewControllerProtocol.h"
 
+// The size of the actual pixel tile
 static const CGFloat CONTEXT_WIDTH_DEFAULT = 450;
 static const CGFloat CONTEXT_HEIGHT_DEFAULT = 450;
-static const CGFloat TILE_POS_X_DEFAULT = 400;
-static const CGFloat TILE_POS_Y_DEFAULT = 420;
-static const CGFloat TILE_WIDTH_DEFAULT = 250;
-static const CGFloat TILE_HEIGHT_DEFAULT = 250;
+
+// In our "decatwips"
+static const CGFloat TILE_POS_X_DEFAULT = 0;
+static const CGFloat TILE_POS_Y_DEFAULT = 0;
+
+// "Tile" size here means the decatwip size of the part of the document
+// rendered into the pixel tile
+static const CGFloat TILE_WIDTH_DEFAULT = 500;
+static const CGFloat TILE_HEIGHT_DEFAULT = 500;
 
 @interface MLOTestingTileParametersViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
 @property CGFloat contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight;
commit f2dc050ed5375f587a052656a7b6ba296b60d734
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 4 12:18:14 2013 +0200

    Do use scaling after all
    
    It is needed because we want to be able to render different zoom
    levels of tiles of course.
    
    But invert the scale from how it was previously. Increasing what is
    here called "tile size" (i.e. the size in document coordinates of the
    rectangle to be rendered) should mean the rendered text gets smaller,
    not larger. Also, use the same units (twips) in numerator and
    denominator.
    
    Change-Id: I461f887461247777af1a9402de112d42c8423293

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 220b08e..eef78eb 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1782,10 +1782,12 @@ void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, MLOD
     MLORip tileRipPosY = tileRipPosition.y;
     MLORip tileRipWidth = rileRipSize.width;
     MLORip tileRipHeight = rileRipSize.height;
+    // tilePosX/Y and tileWidth/Height tell the part of the document,
+    // in twip units, to render
     int tilePosX = tileRipPosX;
     int tilePosY = tileRipPosY;
-    int tileWidth  = tileRipWidth;
-    int tileHeight = tileRipHeight;
+    long tileWidth  = tileRipWidth;
+    long tileHeight = tileRipHeight;
     // Currently we expect that only one document is open, so we are using the
     // current shell.  Should it turn out that we need to have more documents
     // open, we need to add a documentHandle that would hold the right
@@ -1799,7 +1801,6 @@ void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, MLOD
     if (pViewShell)
     {
         static bool bUseTileSize = getenv("USETILESIZE") != NULL;
-        static bool bCallSetScale = bUseTileSize && (getenv("CALLSETSCALE") != NULL);
         static bool bCallSetSwVisArea = bUseTileSize && getenv("CALLSETSWVISAREA") != NULL;
         // TODO create a VirtualDevice based on SystemGraphicsData instead so
         // that we get direct rendering; something like:
@@ -1808,14 +1809,12 @@ void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, MLOD
         MapMode aMapMode(aDevice.GetMapMode());
         aMapMode.SetMapUnit(MAP_TWIP);
         aMapMode.SetOrigin(Point(-tilePosX, -tilePosY));
-        if (bCallSetScale)
-        {
-            // scaling
-            Fraction scaleX(tileWidth,contextWidth);
-            Fraction scaleY(tileHeight,contextHeight);
-            aMapMode.SetScaleX(scaleX);
-            aMapMode.SetScaleY(scaleY);
-        }
+        // Scaling. Must convert from pixels to twips. We know
+        // that VirtualDevises use a DPI of 96.
+        Fraction scaleX = Fraction(contextWidth,96) * Fraction(1440L) / Fraction(tileWidth);
+        Fraction scaleY = Fraction(contextHeight,96) * Fraction(1440L) / Fraction(tileHeight);
+        aMapMode.SetScaleX(scaleX);
+        aMapMode.SetScaleY(scaleY);
         aDevice.SetMapMode(aMapMode);
         if (bCallSetSwVisArea)
         {
commit 2370959b83ac4774a67fc2469f22fe28a1d5aa75
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 4 10:43:39 2013 +0200

    Call MakeVisible() to "scroll" the requested area into view if necessary
    
    Change-Id: I72673d0529261239600eaf9f480f62c3d3dc85fd

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index a46291b..220b08e 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1827,6 +1827,8 @@ void touch_lo_draw_tile(void *context, int contextWidth, int contextHeight, MLOD
         }
         // resizes the virtual device so to contain the entrie context
         aDevice.SetOutputSizePixel(Size(contextWidth, contextHeight));
+        // scroll the requested area into view if necessary
+        pViewShell->MakeVisible(SwRect(Point(tilePosX, tilePosY), aDevice.PixelToLogic(Size(contextWidth, contextHeight))));
         // draw - works in logic coordinates
         if (bUseTileSize)
             pViewShell->PaintTile(&aDevice, Rectangle(Point(tilePosX, tilePosY), Size(tileWidth, tileHeight)));


More information about the Libreoffice-commits mailing list