[Libreoffice-commits] core.git: android/source libreofficekit/Package_selectionhandles.mk libreofficekit/source scp2/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jul 1 16:02:31 UTC 2016


 dev/null                                   |binary
 libreofficekit/Package_selectionhandles.mk |    1 
 libreofficekit/source/gtk/lokdocview.cxx   |   34 +++++------------------------
 scp2/source/ooo/module_libreofficekit.scp  |   10 --------
 4 files changed, 8 insertions(+), 37 deletions(-)

New commits:
commit cca44fe22978c6c1c5f3ec500e5ac07becf53745
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jul 1 16:51:01 2016 +0200

    lokdocview: replace handle_graphic.png with manual drawing
    
    If we draw a black graphic handle manually, then it's possible to color
    it later, this isn't easy if a bitmap is painted.
    
    Change-Id: Ib4456fd5155862d52e3ffa79ee49c7bfd16fb742
    Reviewed-on: https://gerrit.libreoffice.org/26860
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/android/source/res/drawable/handle_graphic.png b/android/source/res/drawable/handle_graphic.png
deleted file mode 100644
index 7317eee..0000000
Binary files a/android/source/res/drawable/handle_graphic.png and /dev/null differ
diff --git a/libreofficekit/Package_selectionhandles.mk b/libreofficekit/Package_selectionhandles.mk
index 5d87805..77c70b4 100644
--- a/libreofficekit/Package_selectionhandles.mk
+++ b/libreofficekit/Package_selectionhandles.mk
@@ -13,7 +13,6 @@ $(eval $(call gb_Package_add_files,libreofficekit_selectionhandles,$(LIBO_SHARE_
 	handle_image_start.png \
 	handle_image_middle.png \
 	handle_image_end.png \
-	handle_graphic.png \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index cb2118e..502ae5d 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -131,8 +131,6 @@ struct LOKDocViewPrivateImpl
 
     /// @name Graphic handles.
     ///@{
-    /// Bitmap of a graphic selection handle.
-    cairo_surface_t* m_pGraphicHandle;
     /// Rectangle of a graphic selection handle, to know if the user clicked on it or not.
     GdkRectangle m_aGraphicHandleRects[8];
     /// If we are in the middle of a drag of a graphic selection handle.
@@ -189,7 +187,6 @@ struct LOKDocViewPrivateImpl
         m_pHandleEnd(nullptr),
         m_aHandleEndRect({0, 0, 0, 0}),
         m_bInDragEndHandle(false),
-        m_pGraphicHandle(nullptr),
         m_nViewId(0),
         m_nTileSizeTwips(0),
         m_aVisibleArea({0, 0, 0, 0}),
@@ -1270,20 +1267,16 @@ renderHandle(LOKDocView* pDocView,
     rRectangle.height = nHandleHeight * fHandleScale;
 }
 
-/// Renders pHandle around an rSelection rectangle on pCairo.
+/// Renders handles around an rSelection rectangle on pCairo.
 static void
 renderGraphicHandle(LOKDocView* pDocView,
                     cairo_t* pCairo,
-                    const GdkRectangle& rSelection,
-                    cairo_surface_t* pHandle)
+                    const GdkRectangle& rSelection)
 {
     LOKDocViewPrivate& priv = getPrivate(pDocView);
-    int nHandleWidth, nHandleHeight;
+    int nHandleWidth = 9, nHandleHeight = 9;
     GdkRectangle aSelection;
 
-    nHandleWidth = cairo_image_surface_get_width(pHandle);
-    nHandleHeight = cairo_image_surface_get_height(pHandle);
-
     aSelection.x = twipToPixel(rSelection.x, priv->m_fZoom);
     aSelection.y = twipToPixel(rSelection.y, priv->m_fZoom);
     aSelection.width = twipToPixel(rSelection.width, priv->m_fZoom);
@@ -1332,11 +1325,9 @@ renderGraphicHandle(LOKDocView* pDocView,
         priv->m_aGraphicHandleRects[i].width = nHandleWidth;
         priv->m_aGraphicHandleRects[i].height = nHandleHeight;
 
-        cairo_save (pCairo);
-        cairo_translate(pCairo, x, y);
-        cairo_set_source_surface(pCairo, pHandle, 0, 0);
-        cairo_paint(pCairo);
-        cairo_restore (pCairo);
+        cairo_set_source_rgb(pCairo, 0, 0, 0);
+        cairo_rectangle(pCairo, x, y, nHandleWidth, nHandleHeight);
+        cairo_fill(pCairo);
     }
 }
 
@@ -1595,16 +1586,7 @@ renderOverlay(LOKDocView* pDocView, cairo_t* pCairo)
     }
 
     if (!isEmptyRectangle(priv->m_aGraphicSelection))
-    {
-        gchar* handleGraphicPath = g_strconcat (priv->m_aLOPath, CURSOR_HANDLE_DIR, "handle_graphic.png", nullptr);
-        if (!priv->m_pGraphicHandle)
-        {
-            priv->m_pGraphicHandle = cairo_image_surface_create_from_png(handleGraphicPath);
-            assert(cairo_surface_status(priv->m_pGraphicHandle) == CAIRO_STATUS_SUCCESS);
-        }
-        renderGraphicHandle(pDocView, pCairo, priv->m_aGraphicSelection, priv->m_pGraphicHandle);
-        g_free (handleGraphicPath);
-    }
+        renderGraphicHandle(pDocView, pCairo, priv->m_aGraphicSelection);
 
     // Draw the cell cursor.
     if (!isEmptyRectangle(priv->m_aCellCursor))
@@ -3123,8 +3105,6 @@ lok_doc_view_reset_view(LOKDocView* pDocView)
     memset(&priv->m_aHandleEndRect, 0, sizeof(priv->m_aHandleEndRect));
     priv->m_bInDragEndHandle = false;
 
-    cairo_surface_destroy(priv->m_pGraphicHandle);
-    priv->m_pGraphicHandle = nullptr;
     memset(&priv->m_aGraphicHandleRects, 0, sizeof(priv->m_aGraphicHandleRects));
     memset(&priv->m_bInDragGraphicHandles, 0, sizeof(priv->m_bInDragGraphicHandles));
 
diff --git a/scp2/source/ooo/module_libreofficekit.scp b/scp2/source/ooo/module_libreofficekit.scp
index 09b3220..4a31923 100644
--- a/scp2/source/ooo/module_libreofficekit.scp
+++ b/scp2/source/ooo/module_libreofficekit.scp
@@ -19,8 +19,7 @@ Module gid_Module_Libreofficekit
     Files = (
         gid_File_Dat_HandleImageStart,
         gid_File_Dat_HandleImageMiddle,
-        gid_File_Dat_HandleImageEnd,
-        gid_File_Dat_HandleGraphic);
+        gid_File_Dat_HandleImageEnd);
 End
 
 Directory gid_Dir_Share_Libreofficekit
@@ -49,13 +48,6 @@ File gid_File_Dat_HandleImageEnd
     Name = "handle_image_end.png";
     Styles = (PACKED);
 End
-
-File gid_File_Dat_HandleGraphic
-    TXT_FILE_BODY;
-    Dir = gid_Dir_Share_Libreofficekit;
-    Name = "handle_graphic.png";
-    Styles = (PACKED);
-End
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list