summaryrefslogtreecommitdiff
path: root/libreofficekit
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-01 16:02:01 +0000
commitcca44fe22978c6c1c5f3ec500e5ac07becf53745 (patch)
treea2dff98c371e5087ec57277e1c914cfcd256ef1b /libreofficekit
parentd77d81604d8604652772e0819e5cf5e472865c65 (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. Change-Id: Ib4456fd5155862d52e3ffa79ee49c7bfd16fb742 Reviewed-on: https://gerrit.libreoffice.org/26860 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/Package_selectionhandles.mk1
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx34
2 files changed, 7 insertions, 28 deletions
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 cb2118e02087..502ae5dbead5 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));