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

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