[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - vcl/unx
Caolán McNamara
caolanm at redhat.com
Thu May 26 08:22:29 UTC 2016
vcl/unx/gtk/gtkdata.cxx | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
New commits:
commit fffe6ce631502ee846de103be70e763c567a2678
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 23 15:02:21 2016 +0100
Resolves: tdf#99874 gtk3: all-black xbm cursors
(cherry picked from commit 81a8d1250319023f6ca272e0b233ef638cae40f7)
Change-Id: I1feca80dd75f7a09e05ac43293e8645da391a775
Reviewed-on: https://gerrit.libreoffice.org/25436
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/vcl/unx/gtk/gtkdata.cxx b/vcl/unx/gtk/gtkdata.cxx
index b5c64e0..22ac431 100644
--- a/vcl/unx/gtk/gtkdata.cxx
+++ b/vcl/unx/gtk/gtkdata.cxx
@@ -301,31 +301,41 @@ GdkCursor* GtkSalDisplay::getFromXBM( const unsigned char *pBitmap,
int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_A1, nWidth);
unsigned char *pPaddedXBM = ensurePaddedForCairo(pBitmap, nWidth, nHeight, cairo_stride);
- cairo_surface_t *s = cairo_image_surface_create_for_data(
+ cairo_surface_t *source = cairo_image_surface_create_for_data(
pPaddedXBM,
CAIRO_FORMAT_A1, nWidth, nHeight,
cairo_stride);
- cairo_t *cr = cairo_create(s);
unsigned char *pPaddedMaskXBM = ensurePaddedForCairo(pMask, nWidth, nHeight, cairo_stride);
cairo_surface_t *mask = cairo_image_surface_create_for_data(
pPaddedMaskXBM,
CAIRO_FORMAT_A1, nWidth, nHeight,
cairo_stride);
+
+ cairo_surface_t *s = cairo_surface_create_similar(source, CAIRO_CONTENT_ALPHA, nWidth, nHeight);
+ cairo_t *cr = cairo_create(s);
+ cairo_set_source_surface(cr, source, 0, 0);
cairo_mask_surface(cr, mask, 0, 0);
cairo_destroy(cr);
+
+#if GTK_CHECK_VERSION(3,10,0)
+ GdkCursor *cursor = gdk_cursor_new_from_surface(m_pGdkDisplay, s, nXHot, nYHot);
+#else
+ GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, nWidth, nHeight);
+ GdkCursor *cursor = gdk_cursor_new_from_pixbuf(m_pGdkDisplay, pixbuf, nXHot, nYHot);
+ g_object_unref(pixbuf);
+#endif
+
+ cairo_surface_destroy(s);
cairo_surface_destroy(mask);
+ cairo_surface_destroy(source);
+
if (pPaddedMaskXBM != pMask)
delete [] pPaddedMaskXBM;
- GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, nWidth, nHeight);
- cairo_surface_destroy(s);
if (pPaddedXBM != pBitmap)
delete [] pPaddedXBM;
- GdkCursor *cursor = gdk_cursor_new_from_pixbuf(m_pGdkDisplay, pixbuf, nXHot, nYHot);
- g_object_unref(pixbuf);
-
return cursor;
#else
GdkScreen *pScreen = gdk_display_get_default_screen( m_pGdkDisplay );
More information about the Libreoffice-commits
mailing list