Blame SOURCES/0027-lokdocview-Make-tilebuffer-an-instance.patch

f325b2
From bcb1637523f79f0b26bb28d4304969eb95a09944 Mon Sep 17 00:00:00 2001
f325b2
From: Pranav Kant <pranavk@gnome.org>
f325b2
Date: Mon, 8 Jun 2015 14:17:17 +0530
f325b2
Subject: [PATCH 027/398] lokdocview: Make tilebuffer an instance
f325b2
f325b2
Change-Id: I06dae2e7a5067160326f4c65f5975c4e5afb05ce
f325b2
(cherry picked from commit 03655e67cbb26a6a7b8da4b5e5a18eae4742b412)
f325b2
---
f325b2
 libreofficekit/source/gtk/lokdocview.cxx | 81 +++++++++++++++++---------------
f325b2
 1 file changed, 42 insertions(+), 39 deletions(-)
f325b2
f325b2
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
f325b2
index a5cf7aaac741..2997feddf1d4 100644
f325b2
--- a/libreofficekit/source/gtk/lokdocview.cxx
f325b2
+++ b/libreofficekit/source/gtk/lokdocview.cxx
f325b2
@@ -42,7 +42,7 @@ struct LOKDocView_Impl
f325b2
 {
f325b2
     LOKDocView* m_pDocView;
f325b2
     GtkWidget *m_pDrawingArea;
f325b2
-    TileBuffer *m_pTileBuffer;
f325b2
+    TileBuffer m_aTileBuffer;
f325b2
 
f325b2
     float m_fZoom;
f325b2
 
f325b2
@@ -192,7 +192,7 @@ struct LOKDocView_Impl
f325b2
     void searchNotFound(const std::string& rPayload);
f325b2
     /// LOK decided to change parts, need to update UI.
f325b2
     void setPart(const std::string& rPayload);
f325b2
-    /// Sets the tiles enclosed by rRectangle as invalid in m_pTileBuffer
f325b2
+    /// Sets the tiles enclosed by rRectangle as invalid in m_aTileBuffer
f325b2
     void setTilesInvalid(const GdkRectangle& rRectangle);
f325b2
 };
f325b2
 
f325b2
@@ -273,35 +273,36 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo
f325b2
 
f325b2
 LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView)
f325b2
     : m_pDocView(pDocView),
f325b2
-    m_pDrawingArea(gtk_drawing_area_new()),
f325b2
-    m_fZoom(1),
f325b2
-    m_pOffice(0),
f325b2
-    m_pDocument(0),
f325b2
-    m_nDocumentWidthTwips(0),
f325b2
-    m_nDocumentHeightTwips(0),
f325b2
-    m_bEdit(false),
f325b2
-    m_aVisibleCursor({0, 0, 0, 0}),
f325b2
-    m_bCursorOverlayVisible(false),
f325b2
-    m_bCursorVisible(true),
f325b2
-    m_nLastButtonPressTime(0),
f325b2
-    m_nLastButtonReleaseTime(0),
f325b2
-    m_aTextSelectionStart({0, 0, 0, 0}),
f325b2
-    m_aTextSelectionEnd({0, 0, 0, 0}),
f325b2
-    m_aGraphicSelection({0, 0, 0, 0}),
f325b2
-    m_bInDragGraphicSelection(false),
f325b2
-
f325b2
-    // Start/middle/end handle.
f325b2
-    m_pHandleStart(0),
f325b2
-    m_aHandleStartRect({0, 0, 0, 0}),
f325b2
-    m_bInDragStartHandle(false),
f325b2
-    m_pHandleMiddle(0),
f325b2
-    m_aHandleMiddleRect({0, 0, 0, 0}),
f325b2
-    m_bInDragMiddleHandle(false),
f325b2
-    m_pHandleEnd(0),
f325b2
-    m_aHandleEndRect({0, 0, 0, 0}),
f325b2
-    m_bInDragEndHandle(false),
f325b2
-
f325b2
-    m_pGraphicHandle(0)
f325b2
+      m_pDrawingArea(gtk_drawing_area_new()),
f325b2
+      m_aTileBuffer(TileBuffer(0,0,0,0)),
f325b2
+      m_fZoom(1),
f325b2
+      m_pOffice(0),
f325b2
+      m_pDocument(0),
f325b2
+      m_nDocumentWidthTwips(0),
f325b2
+      m_nDocumentHeightTwips(0),
f325b2
+      m_bEdit(false),
f325b2
+      m_aVisibleCursor({0, 0, 0, 0}),
f325b2
+      m_bCursorOverlayVisible(false),
f325b2
+      m_bCursorVisible(true),
f325b2
+      m_nLastButtonPressTime(0),
f325b2
+      m_nLastButtonReleaseTime(0),
f325b2
+      m_aTextSelectionStart({0, 0, 0, 0}),
f325b2
+      m_aTextSelectionEnd({0, 0, 0, 0}),
f325b2
+      m_aGraphicSelection({0, 0, 0, 0}),
f325b2
+      m_bInDragGraphicSelection(false),
f325b2
+
f325b2
+      // Start/middle/end handle.
f325b2
+      m_pHandleStart(0),
f325b2
+      m_aHandleStartRect({0, 0, 0, 0}),
f325b2
+      m_bInDragStartHandle(false),
f325b2
+      m_pHandleMiddle(0),
f325b2
+      m_aHandleMiddleRect({0, 0, 0, 0}),
f325b2
+      m_bInDragMiddleHandle(false),
f325b2
+      m_pHandleEnd(0),
f325b2
+      m_aHandleEndRect({0, 0, 0, 0}),
f325b2
+      m_bInDragEndHandle(false),
f325b2
+
f325b2
+      m_pGraphicHandle(0)
f325b2
 {
f325b2
     memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
f325b2
     memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
f325b2
@@ -683,7 +684,7 @@ void LOKDocView_Impl::setTilesInvalid(const GdkRectangle& rRectangle)
f325b2
 
f325b2
     for (int i = aStart.x; i < aEnd.x; i++)
f325b2
         for (int j = aStart.y; j < aEnd.y; j++)
f325b2
-            m_pTileBuffer->setInvalid(i, j);
f325b2
+            m_aTileBuffer.setInvalid(i, j);
f325b2
 }
f325b2
 
f325b2
 void LOKDocView_Impl::renderHandle(cairo_t* pCairo, const GdkRectangle& rCursor, cairo_surface_t* pHandle, GdkRectangle& rRectangle)
f325b2
@@ -845,7 +846,7 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial)
f325b2
             {
f325b2
                 //g_info("tile_buffer_get_tile (%d, %d)", nRow, nColumn);
f325b2
 
f325b2
-                Tile& currentTile = m_pTileBuffer->getTile(nRow, nColumn);
f325b2
+                Tile& currentTile = m_aTileBuffer.getTile(nRow, nColumn);
f325b2
                 GdkPixbuf* pPixBuf = currentTile.getBuffer();
f325b2
 
f325b2
                 gdk_cairo_set_source_pixbuf (pcairo, pPixBuf,
f325b2
@@ -969,7 +970,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
f325b2
             setTilesInvalid(aRectangle);
f325b2
         }
f325b2
         else
f325b2
-            m_pTileBuffer->resetAllTiles();
f325b2
+            m_aTileBuffer.resetAllTiles();
f325b2
 
f325b2
         gtk_widget_queue_draw(m_pDrawingArea);
f325b2
     }
f325b2
@@ -1232,10 +1233,12 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_doc_view_open_document( LOKDocView* pDocView,
f325b2
         // Total number of rows / columns in this document.
f325b2
         guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
f325b2
         guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
f325b2
-        pDocView->m_pImpl->m_pTileBuffer = new TileBuffer(pDocView->m_pImpl->m_pDocument,
f325b2
-                                                          nTileSizePixels,
f325b2
-                                                          nRows,
f325b2
-                                                          nColumns);
f325b2
+
f325b2
+
f325b2
+        pDocView->m_pImpl->m_aTileBuffer = TileBuffer(pDocView->m_pImpl->m_pDocument,
f325b2
+                                                      nTileSizePixels,
f325b2
+                                                      nRows,
f325b2
+                                                      nColumns);
f325b2
         gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
f325b2
                                     nDocumentWidthPixels,
f325b2
                                     nDocumentHeightPixels);
f325b2
@@ -1259,7 +1262,7 @@ SAL_DLLPUBLIC_EXPORT void lok_doc_view_set_zoom ( LOKDocView* pDocView, float fZ
f325b2
     guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
f325b2
     guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
f325b2
 
f325b2
-    pDocView->m_pImpl->m_pTileBuffer->setZoom(fZoom, nRows, nColumns);
f325b2
+    pDocView->m_pImpl->m_aTileBuffer.setZoom(fZoom, nRows, nColumns);
f325b2
     gtk_widget_set_size_request(pDocView->m_pImpl->m_pDrawingArea,
f325b2
                                 nDocumentWidthPixels,
f325b2
                                 nDocumentHeightPixels);
f325b2
-- 
f325b2
2.12.0
f325b2