summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPatrick Luby <plubius@neooffice.org>2023-08-25 08:39:46 -0400
committerPatrick Luby <plubius@neooffice.org>2023-08-27 23:11:29 +0200
commite7496f41562b75ea9732ca48f9aa0c07b69e424f (patch)
treef7bd37cbdfb30952e00348412cdaedb2490b4df6 /vcl
parentaa3eea21fcf302ef4ddbba5841037378945f9d5e (diff)
tdf#150610 fix broken rendering of text meta actions
Even when drawing to a VirtualDevice where antialiasing is disabled, text will still be drawn with some antialiased pixels on HiDPI displays. So, expand the size of the VirtualDevice slightly to capture any of the pixles drawn past the edges of the destination bounds. Change-Id: Ibcba8234708d8784c12f984289ec0a8fcad6694e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156098 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Patrick Luby <plubius@neooffice.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/transparent.cxx28
1 files changed, 23 insertions, 5 deletions
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index f26ca5439982..11f89efc7a27 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -557,6 +557,13 @@ void OutputDevice::DrawTransparent( const tools::PolyPolygon& rPolyPoly,
void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
const Size& rSize, const Gradient& rTransparenceGradient )
{
+ DrawTransparent( rMtf, rPos, rSize, rPos, rSize, rTransparenceGradient );
+}
+
+void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, const Size& rSize,
+ const Point& rMtfPos, const Size& rMtfSize,
+ const Gradient& rTransparenceGradient )
+{
assert(!is_double_buffered_window());
const Color aBlack( COL_BLACK );
@@ -574,7 +581,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
( mnDrawMode & DrawModeFlags::NoTransparency ) )
{
const_cast<GDIMetaFile&>(rMtf).WindStart();
- const_cast<GDIMetaFile&>(rMtf).Play(*this, rPos, rSize);
+ const_cast<GDIMetaFile&>(rMtf).Play(*this, rMtfPos, rMtfSize);
const_cast<GDIMetaFile&>(rMtf).WindStart();
}
else
@@ -599,7 +606,13 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
if( xVDev->SetOutputSizePixel( aDstRect.GetSize(), true, true ) )
{
- if(GetAntialiasing() != AntialiasingFlags::NONE)
+ // tdf#150610 fix broken rendering of text meta actions
+ // Even when drawing to a VirtualDevice that has antialiasing
+ // disabled, text will still be drawn with some antialiased
+ // pixels on HiDPI displays. So, use the antialiasing enabled
+ // code to render if there are any text meta actions in the
+ // metafile.
+ if(GetAntialiasing() != AntialiasingFlags::NONE || rPos != rMtfPos || rSize != rMtfSize)
{
// #i102109#
// For MetaFile replay (see task) it may now be necessary to take
@@ -630,7 +643,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
// draw MetaFile to buffer
xVDev->EnableMapMode(bBufferMapModeEnabled);
const_cast<GDIMetaFile&>(rMtf).WindStart();
- const_cast<GDIMetaFile&>(rMtf).Play(*xVDev, rPos, rSize);
+ const_cast<GDIMetaFile&>(rMtf).Play(*xVDev, rMtfPos, rMtfSize);
const_cast<GDIMetaFile&>(rMtf).WindStart();
// get content bitmap from buffer
@@ -641,6 +654,11 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
// create alpha mask from gradient and get as Bitmap
xVDev->EnableMapMode(bBufferMapModeEnabled);
xVDev->SetDrawMode(DrawModeFlags::GrayGradient);
+ // Related tdf#150610 draw gradient to VirtualDevice bounds
+ // If we are here and the metafile bounds differs from the
+ // VirtualDevice bounds so that we apply the transparency
+ // gradient to any pixels drawn outside of the metafile
+ // bounds.
xVDev->DrawGradient(tools::Rectangle(rPos, rSize), rTransparenceGradient);
xVDev->SetDrawMode(DrawModeFlags::Default);
xVDev->EnableMapMode(false);
@@ -670,7 +688,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
// create paint bitmap
const_cast<GDIMetaFile&>(rMtf).WindStart();
- const_cast<GDIMetaFile&>(rMtf).Play(*xVDev, rPos, rSize);
+ const_cast<GDIMetaFile&>(rMtf).Play(*xVDev, rMtfPos, rMtfSize);
const_cast<GDIMetaFile&>(rMtf).WindStart();
xVDev->EnableMapMode( false );
BitmapEx aPaint = xVDev->GetBitmapEx(Point(), xVDev->GetOutputSizePixel());
@@ -678,7 +696,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
// create alpha mask from gradient
xVDev->SetDrawMode( DrawModeFlags::GrayGradient );
- xVDev->DrawGradient( tools::Rectangle( rPos, rSize ), rTransparenceGradient );
+ xVDev->DrawGradient( tools::Rectangle( rMtfPos, rMtfSize ), rTransparenceGradient );
xVDev->SetDrawMode( DrawModeFlags::Default );
xVDev->EnableMapMode( false );