summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-22 11:47:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-06-22 16:57:58 +0200
commit9709798ae416516037011565c151a54831008082 (patch)
treec99da28eccb429e568c840a7a1fa8d73e0f3afe8
parent89594b646eb53df91329d5e68cba068b1ec49492 (diff)
Resolves: tdf#108452 gtk3 xbm cursors invisible on black bg
Change-Id: I5c9b27862da6ac76ae38542f85a51f9aefdd013d Reviewed-on: https://gerrit.libreoffice.org/39111 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk3/gtk3gtkdata.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index c5835e69f15a..f59034a50657 100644
--- a/vcl/unx/gtk3/gtk3gtkdata.cxx
+++ b/vcl/unx/gtk3/gtk3gtkdata.cxx
@@ -170,13 +170,22 @@ GdkCursor* GtkSalDisplay::getFromXBM( const unsigned char *pBitmap,
int nWidth, int nHeight,
int nXHot, int nYHot )
{
- int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_A1, nWidth);
+ cairo_surface_t *source = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight);
+ cairo_t *cr = cairo_create(source);
+ cairo_set_source_rgba(cr, 1, 1, 1, 1);
+ cairo_paint(cr);
+
+ const int cairo_stride = cairo_format_stride_for_width(CAIRO_FORMAT_A1, nWidth);
unsigned char *pPaddedXBM = ensurePaddedForCairo(pBitmap, nWidth, nHeight, cairo_stride);
- cairo_surface_t *source = cairo_image_surface_create_for_data(
+ cairo_surface_t *xbm = cairo_image_surface_create_for_data(
pPaddedXBM,
CAIRO_FORMAT_A1, nWidth, nHeight,
cairo_stride);
+ cairo_set_source_rgba(cr, 0, 0, 0, 1);
+ cairo_mask_surface(cr, xbm, 0, 0);
+ cairo_surface_destroy(xbm);
+ cairo_destroy(cr);
unsigned char *pPaddedMaskXBM = ensurePaddedForCairo(pMask, nWidth, nHeight, cairo_stride);
cairo_surface_t *mask = cairo_image_surface_create_for_data(
@@ -184,10 +193,12 @@ GdkCursor* GtkSalDisplay::getFromXBM( const unsigned char *pBitmap,
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_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight);
+ cr = cairo_create(s);
cairo_set_source_surface(cr, source, 0, 0);
cairo_mask_surface(cr, mask, 0, 0);
+ cairo_surface_destroy(mask);
+ cairo_surface_destroy(source);
cairo_destroy(cr);
#if GTK_CHECK_VERSION(3,10,0)
@@ -199,8 +210,6 @@ GdkCursor* GtkSalDisplay::getFromXBM( const unsigned char *pBitmap,
#endif
cairo_surface_destroy(s);
- cairo_surface_destroy(mask);
- cairo_surface_destroy(source);
if (pPaddedMaskXBM != pMask)
delete [] pPaddedMaskXBM;