[Libreoffice-commits] core.git: Branch 'feature/gsoc-tiled-rendering' - libreofficekit/source

Pranav Kant pranavk at gnome.org
Wed Jun 3 12:53:02 PDT 2015


 libreofficekit/source/gtk/lokdocview.cxx |   32 +++++++++++--------------------
 libreofficekit/source/gtk/tilebuffer.hxx |    8 +++----
 2 files changed, 16 insertions(+), 24 deletions(-)

New commits:
commit 62074927bf1849169b2c84e0fae1fffcf0fff257
Author: Pranav Kant <pranavk at gnome.org>
Date:   Thu Jun 4 01:16:11 2015 +0530

    clean up; removed warnings
    
    Change-Id: I38614726ca8e3127439faf79d491d9e5a336f962

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index b34a501..f476a23 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -66,11 +66,7 @@ void payloadToSize(const char* pPayload, long& rWidth, long& rHeight)
 struct LOKDocView_Impl
 {
     LOKDocView* m_pDocView;
-    GtkWidget* m_pEventBox;
-    GtkWidget* m_pTable;
-    GtkWidget** m_pCanvas;
-    GtkWidget *darea;
-
+    GtkWidget *m_pDrawingArea;
     TileBuffer *m_pTileBuffer;
 
     float m_fZoom;
@@ -266,10 +262,7 @@ LOKDocView_Impl::CallbackData::CallbackData(int nType, const std::string& rPaylo
 
 LOKDocView_Impl::LOKDocView_Impl(LOKDocView* pDocView)
     : m_pDocView(pDocView),
-    m_pEventBox(gtk_event_box_new()),
-    darea(gtk_drawing_area_new()),
-    m_pTable(0),
-    m_pCanvas(0),
+    m_pDrawingArea(gtk_drawing_area_new()),
     m_fZoom(1),
     m_pOffice(0),
     m_pDocument(0),
@@ -317,7 +310,7 @@ void LOKDocView_Impl::destroy(LOKDocView* pDocView, gpointer /*pData*/)
     delete pDocView->m_pImpl;
 }
 
-void LOKDocView_Impl::on_exposed(GtkWidget *widget, GdkEvent *event, gpointer userdata)
+void LOKDocView_Impl::on_exposed(GtkWidget* /*widget*/, GdkEvent* /*event*/, gpointer userdata)
 {
     LOKDocView *pDocView = LOK_DOCVIEW (userdata);
     pDocView->m_pImpl->renderDocument(0);
@@ -777,7 +770,7 @@ gboolean LOKDocView_Impl::handleTimeoutImpl()
             m_bCursorOverlayVisible = false;
         else
             m_bCursorOverlayVisible = true;
-        gtk_widget_queue_draw(GTK_WIDGET(m_pEventBox));
+        gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
     }
 
     return G_SOURCE_CONTINUE;
@@ -794,8 +787,8 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial)
     guint nRows = ceil((double)nDocumentHeightPixels / nTileSizePixels);
     guint nColumns = ceil((double)nDocumentWidthPixels / nTileSizePixels);
 
-    gtk_widget_set_size_request(darea, nDocumentWidthPixels, nDocumentHeightPixels);
-    cairo_t *pcairo = gdk_cairo_create(darea->window);
+    gtk_widget_set_size_request(m_pDrawingArea, nDocumentWidthPixels, nDocumentHeightPixels);
+    cairo_t *pcairo = gdk_cairo_create(m_pDrawingArea->window);
 
     // Render the tiles.
     for (guint nRow = 0; nRow < nRows; ++nRow)
@@ -832,7 +825,6 @@ void LOKDocView_Impl::renderDocument(GdkRectangle* pPartial)
 
                 Tile& currentTile = m_pTileBuffer->tile_buffer_get_tile(nRow, nColumn);
                 GdkPixbuf* pPixBuf = currentTile.tile_get_buffer();
-                unsigned char* pBuffer = gdk_pixbuf_get_pixels(pPixBuf);
 
                 gdk_cairo_set_source_pixbuf (pcairo, pPixBuf, twipToPixel(aTileRectangleTwips.x), twipToPixel(aTileRectangleTwips.y));
                 cairo_paint(pcairo);
@@ -952,7 +944,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
     {
         m_aVisibleCursor = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str());
         m_bCursorOverlayVisible = true;
-        gtk_widget_queue_draw(GTK_WIDGET(m_pEventBox));
+        gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
     }
     break;
     case LOK_CALLBACK_TEXT_SELECTION:
@@ -969,7 +961,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
         }
         else
             memset(&m_aHandleMiddleRect, 0, sizeof(m_aHandleMiddleRect));
-        gtk_widget_queue_draw(GTK_WIDGET(m_pEventBox));
+        gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
     }
     break;
     case LOK_CALLBACK_TEXT_SELECTION_START:
@@ -993,7 +985,7 @@ gboolean LOKDocView_Impl::callbackImpl(CallbackData* pCallback)
             m_aGraphicSelection = LOKDocView_Impl::payloadToRectangle(pCallback->m_aPayload.c_str());
         else
             memset(&m_aGraphicSelection, 0, sizeof(m_aGraphicSelection));
-        gtk_widget_queue_draw(GTK_WIDGET(m_pEventBox));
+        gtk_widget_queue_draw(GTK_WIDGET(m_pDrawingArea));
     }
     break;
     case LOK_CALLBACK_HYPERLINK_CLICKED:
@@ -1147,9 +1139,9 @@ static void lok_docview_init( GTypeInstance* pInstance, gpointer )
 
     pDocView->m_pImpl = new LOKDocView_Impl(pDocView);
     gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView),
-                                           pDocView->m_pImpl->darea );
+                                           pDocView->m_pImpl->m_pDrawingArea );
 
-    g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->darea),
+    g_signal_connect(GTK_OBJECT(pDocView->m_pImpl->m_pDrawingArea),
                      "expose-event",
                      GTK_SIGNAL_FUNC(LOKDocView_Impl::on_exposed), pDocView);
 
@@ -1295,7 +1287,7 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_edit( LOKDocView* pDocView,
     }
     pDocView->m_pImpl->m_bEdit = bEdit;
     g_signal_emit(pDocView, docview_signals[EDIT_CHANGED], 0, bWasEdit);
-    gtk_widget_queue_draw(GTK_WIDGET(pDocView->m_pImpl->m_pEventBox));
+    gtk_widget_queue_draw(GTK_WIDGET(pDocView->m_pImpl->m_pDrawingArea));
 }
 
 SAL_DLLPUBLIC_EXPORT gboolean lok_docview_get_edit(LOKDocView* pDocView)
diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx
index 7912428..a5ed0dc 100644
--- a/libreofficekit/source/gtk/tilebuffer.hxx
+++ b/libreofficekit/source/gtk/tilebuffer.hxx
@@ -50,9 +50,9 @@ public:
              int tileSize,
              int rows,
              int columns)
-    : m_fZoomFactor(1)
+    : m_pLOKDocument(document)
     , m_nTileSize(tileSize)
-    , m_pLOKDocument(document)
+    , m_fZoomFactor(1)
     , m_nWidth(columns)
     , m_nHeight(rows)
   {
@@ -67,12 +67,12 @@ public:
   void tile_buffer_reset_all_tiles();
 private:
   LibreOfficeKitDocument *m_pLOKDocument;
+  int m_nTileSize;
+  float m_fZoomFactor;
   std::vector<Tile> m_aTiles;
   //TODO: Also set width and height when document size changes
   int m_nWidth;
   int m_nHeight;
-  float m_fZoomFactor;
-  int m_nTileSize;
 };
 
 #endif // INCLUDED_TILEBUFFER_HXX


More information about the Libreoffice-commits mailing list