summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-01 16:51:01 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-21 10:21:22 +0200
commit606ad3c7961ced06a9c4278d64a7913090f03abe (patch)
treefd504198b49e8aff2c2509900fc14f44fb2fc9c9
parenta3a0692cb2c44dc60ef385710aa5eda1e98cb980 (diff)
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. Reviewed-on: https://gerrit.libreoffice.org/26860 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit cca44fe22978c6c1c5f3ec500e5ac07becf53745) Conflicts: scp2/source/ooo/module_libreofficekit.scp Change-Id: Ib4456fd5155862d52e3ffa79ee49c7bfd16fb742
-rw-r--r--android/source/res/drawable/handle_graphic.pngbin289 -> 0 bytes
-rw-r--r--libreofficekit/Package_selectionhandles.mk1
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx34
3 files changed, 7 insertions, 28 deletions
diff --git a/android/source/res/drawable/handle_graphic.png b/android/source/res/drawable/handle_graphic.png
deleted file mode 100644
index 7317eee67d05..000000000000
--- a/android/source/res/drawable/handle_graphic.png
+++ /dev/null
Binary files differ
diff --git a/libreofficekit/Package_selectionhandles.mk b/libreofficekit/Package_selectionhandles.mk
index 5d87805c2c28..77c70b4e6352 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 c79e0980a4c8..a6fbe7871d9a 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}),
@@ -1264,20 +1261,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);
@@ -1326,11 +1319,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);
}
}
@@ -1589,16 +1580,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))
@@ -3117,8 +3099,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));