Blame SOURCES/0029-tilebuffer-tileSize-as-member-variable-is-superfluou.patch

135360
From f72510427d6076b304ed14879b00eb253367e161 Mon Sep 17 00:00:00 2001
135360
From: Pranav Kant <pranavk@gnome.org>
135360
Date: Mon, 8 Jun 2015 15:24:12 +0530
135360
Subject: [PATCH 029/398] tilebuffer: tileSize as member variable is
135360
 superfluous
135360
135360
Change-Id: I1eae8c96c12ba4d272341f45fee6c1fd66ab9e28
135360
(cherry picked from commit 2afe94dbfc85cbcde1399267379a466d527998a4)
135360
---
135360
 libreofficekit/source/gtk/lokdocview.cxx |  4 +---
135360
 libreofficekit/source/gtk/tilebuffer.cxx | 12 ++++++------
135360
 libreofficekit/source/gtk/tilebuffer.hxx |  7 ++-----
135360
 3 files changed, 9 insertions(+), 14 deletions(-)
135360
135360
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
135360
index d790b2b43c08..0124704d6784 100644
135360
--- a/libreofficekit/source/gtk/lokdocview.cxx
135360
+++ b/libreofficekit/source/gtk/lokdocview.cxx
135360
@@ -274,7 +274,7 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo
135360
 LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView)
135360
     : m_pDocView(pDocView),
135360
       m_pDrawingArea(gtk_drawing_area_new()),
135360
-      m_aTileBuffer(TileBuffer(0,0,0,0)),
135360
+      m_aTileBuffer(TileBuffer(0,0,0)),
135360
       m_fZoom(1),
135360
       m_pOffice(0),
135360
       m_pDocument(0),
135360
@@ -1236,7 +1236,6 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView,
135360
 
135360
 
135360
         pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument,
135360
-                                                      nTileSizePixels,
135360
                                                       nRows,
135360
                                                       nColumns);
135360
         gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
135360
@@ -1263,7 +1262,6 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ
135360
     guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
135360
 
135360
     pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument,
135360
-                                                  nTileSizePixels,
135360
                                                   nRows,
135360
                                                   nColumns);
135360
     gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
135360
diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx
135360
index 774806bc414d..1d6a8b66ec80 100644
135360
--- a/libreofficekit/source/gtk/tilebuffer.cxx
135360
+++ b/libreofficekit/source/gtk/tilebuffer.cxx
135360
@@ -79,7 +79,7 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom)
135360
     if(m_mTiles.find(index) == m_mTiles.end() || !m_mTiles[index].valid)
135360
     {
135360
 
135360
-        GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, m_nTileSize, m_nTileSize);
135360
+        GdkPixbuf* pPixBuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, nTileSizePixels, nTileSizePixels);
135360
         if (!pPixBuf)
135360
         {
135360
             g_info ("Error allocating memory to pixbuf");
135360
@@ -88,16 +88,16 @@ Tile& TileBuffer::getTile(int x, int y, float aZoom)
135360
 
135360
         unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf);
135360
         GdkRectangle aTileRectangle;
135360
-        aTileRectangle.x = pixelToTwip(m_nTileSize, aZoom) * y;
135360
-        aTileRectangle.y = pixelToTwip(m_nTileSize, aZoom) * x;
135360
+        aTileRectangle.x = pixelToTwip(nTileSizePixels, aZoom) * y;
135360
+        aTileRectangle.y = pixelToTwip(nTileSizePixels, aZoom) * x;
135360
 
135360
         g_info ("Rendering (%d, %d)", x, y);
135360
         m_pLOKDocument->pClass->paintTile(m_pLOKDocument,
135360
                                           pBuffer,
135360
-                                          m_nTileSize, m_nTileSize,
135360
+                                          nTileSizePixels, nTileSizePixels,
135360
                                           aTileRectangle.x, aTileRectangle.y,
135360
-                                          pixelToTwip(m_nTileSize, aZoom),
135360
-                                          pixelToTwip(m_nTileSize, aZoom));
135360
+                                          pixelToTwip(nTileSizePixels, aZoom),
135360
+                                          pixelToTwip(nTileSizePixels, aZoom));
135360
 
135360
         //create a mapping for it
135360
         m_mTiles[index].setPixbuf(pPixBuf);
135360
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx
135360
index 59660042f544..ea8e52452c8d 100644
135360
--- a/libreofficekit/source/gtk/tilebuffer.hxx
135360
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
135360
@@ -83,11 +83,9 @@ class TileBuffer
135360
 {
135360
  public:
135360
  TileBuffer(LibreOfficeKitDocument *document,
135360
-            int tileSize,
135360
             int rows,
135360
             int columns)
135360
      : m_pLOKDocument(document)
135360
-        , m_nTileSize(tileSize)
135360
         , m_nWidth(columns)
135360
         , m_nHeight(rows)
135360
     {  }
135360
@@ -104,10 +102,11 @@ class TileBuffer
135360
 
135360
        @param x the tile along the x-axis of the buffer
135360
        @param y the tile along the y-axis of the buffer
135360
+       @param aZoom This function needs the zoom factor to draw the tile using paintTile()
135360
 
135360
        @return the tile at the mentioned position (x, y)
135360
      */
135360
-    Tile& getTile(int x, int y);
135360
+    Tile& getTile(int x, int y, float aZoom);
135360
     /// Destroys all the tiles in the tile buffer; also frees the memory allocated
135360
     /// for all the Tile objects.
135360
     void resetAllTiles();
135360
@@ -123,8 +122,6 @@ class TileBuffer
135360
  private:
135360
     /// Contains the reference to the LOK Document that this tile buffer is for.
135360
     LibreOfficeKitDocument *m_pLOKDocument;
135360
-    /// The side of each squared tile in pixels.
135360
-    int m_nTileSize;
135360
     /// Stores all the tiles cached by this tile buffer.
135360
     std::map<int, Tile> m_mTiles;
135360
     /// Width of the current tile buffer (number of columns)
135360
-- 
135360
2.12.0
135360