summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-02-01 12:50:47 +0000
committerMichael Stahl <mstahl@redhat.com>2017-02-01 16:26:25 +0000
commit0c6728a675a5844c384a34d5538f10e6d2916efa (patch)
tree7ca0b4d5775f03ddbc4e87315da511fcf53e19a1 /vcl
parentfe85d526323ef562504289c2a0d76a1af94e7a82 (diff)
gtk3 hidpi xor hack needs to use unscaled extents
so that e.g. the xor cursor in csv dialog can be seen when moving the mouse across the ruler Change-Id: Ia2f367d5f610d486a8e10b6bc278cbc8029cf2a1 (cherry picked from commit 00c4679641bc2b84c6496258c0c5bd84df75ae42) Reviewed-on: https://gerrit.libreoffice.org/33792 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/headless/svpgdi.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 57093f6c3d09..11f408aaf773 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1270,12 +1270,17 @@ cairo_surface_t* SvpSalGraphics::createCairoSurface(const BitmapBuffer *pBuffer)
return target;
}
-static cairo_t* createTmpCompatibleCairoContext(cairo_surface_t* pSurface)
+static cairo_t* createTmpCompatibleCairoContext(cairo_surface_t* pSurface, double fScale)
{
cairo_surface_t *target = cairo_image_surface_create(
cairo_image_surface_get_format(pSurface),
cairo_image_surface_get_width(pSurface),
cairo_image_surface_get_height(pSurface));
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
+ cairo_surface_set_device_scale(target, fScale, fScale);
+#else
+ (void)fScale;
+#endif
return cairo_create(target);
}
@@ -1283,7 +1288,7 @@ cairo_t* SvpSalGraphics::getCairoContext(bool bXorModeAllowed) const
{
cairo_t* cr;
if (m_ePaintMode == XOR && bXorModeAllowed)
- cr = createTmpCompatibleCairoContext(m_pSurface);
+ cr = createTmpCompatibleCairoContext(m_pSurface, m_fScale);
else
cr = cairo_create(m_pSurface);
cairo_set_line_width(cr, 1);
@@ -1335,13 +1340,17 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons
cairo_format_t nFormat = cairo_image_surface_get_format(m_pSurface);
assert(nFormat == CAIRO_FORMAT_ARGB32 && "need to implement CAIRO_FORMAT_A1 after all here");
sal_Int32 nStride = cairo_format_stride_for_width(nFormat, nWidth);
- for (sal_Int32 y = nExtentsTop; y < nExtentsBottom; ++y)
+ sal_Int32 nUnscaledExtentsLeft = nExtentsLeft * m_fScale;
+ sal_Int32 nUnscaledExtentsRight = nExtentsRight * m_fScale;
+ sal_Int32 nUnscaledExtentsTop = nExtentsTop * m_fScale;
+ sal_Int32 nUnscaledExtentsBottom = nExtentsBottom * m_fScale;
+ for (sal_Int32 y = nUnscaledExtentsTop; y < nUnscaledExtentsBottom; ++y)
{
unsigned char *true_row = true_surface_data + (nStride*y);
unsigned char *xor_row = xor_surface_data + (nStride*y);
- unsigned char *true_data = true_row + (nExtentsLeft * 4);
- unsigned char *xor_data = xor_row + (nExtentsLeft * 4);
- for (sal_Int32 x = nExtentsLeft; x < nExtentsRight; ++x)
+ unsigned char *true_data = true_row + (nUnscaledExtentsLeft * 4);
+ unsigned char *xor_data = xor_row + (nUnscaledExtentsLeft * 4);
+ for (sal_Int32 x = nUnscaledExtentsLeft; x < nUnscaledExtentsRight; ++x)
{
sal_uInt8 b = unpremultiply(true_data[SVP_CAIRO_BLUE], true_data[SVP_CAIRO_ALPHA]) ^
unpremultiply(xor_data[SVP_CAIRO_BLUE], xor_data[SVP_CAIRO_ALPHA]);