summaryrefslogtreecommitdiff
path: root/vcl/headless
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-01-25 16:49:49 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-01-25 20:40:50 +0100
commit67240ca4191bfda561b2949905d29e6c2ed4a09f (patch)
tree6cce71694e16aeaaf428f988c32f2eceece22a55 /vcl/headless
parent02363fb279d60f3f5a0328f43a048960028ac5c3 (diff)
don't use oversized surfaces
which leads to warnings of "rendering text failed with stretch ratio of: 10, invalid value (typically too big) for the size of the input (surface, pattern, etc.)" on my 200% scaled hidpi a problem since: commit cf9be3417bc2be5f772c03180b7cbd248b82cad5 Date: Tue Jan 11 19:08:50 2022 +0100 avoid Xlib cairo surfaces for small virtual devices (bsc#1183308) where the nNewDX/nNewDY passed to the cairo_surface_create_similar branch should remain as the unscaled sizes. This does change the meaning of (nNewDX <= 32 && nNewDY <= 32) for the hidpi case, but presumably that's ok Change-Id: I663a399c0e9c8480437a5663329cf753d69eb155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128938 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/headless')
-rw-r--r--vcl/headless/svpvd.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index 92c54a013e0e..76cb53fc1745 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -85,18 +85,22 @@ void SvpSalVirtualDevice::CreateSurface(tools::Long nNewDX, tools::Long nNewDY,
else
{
dl_cairo_surface_get_device_scale(m_pRefSurface, &fXScale, &fYScale);
- nNewDX *= fXScale;
- nNewDY *= fYScale;
}
if (pBuffer)
{
+ nNewDX *= fXScale;
+ nNewDY *= fYScale;
+
m_pSurface = cairo_image_surface_create_for_data(pBuffer, CAIRO_FORMAT_ARGB32,
nNewDX, nNewDY, cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nNewDX));
dl_cairo_surface_set_device_scale(m_pSurface, fXScale, fYScale);
}
else if(nNewDX <= 32 && nNewDY <= 32)
{
+ nNewDX *= fXScale;
+ nNewDY *= fYScale;
+
// Force image-based surface if small. Small VirtualDevice instances are often used for small
// temporary bitmaps that will eventually have GetBitmap() called on them, which would cause
// X Server roundtrip with Xlib-based surface, which may be way more costly than doing the drawing