vcl/inc/skia/gdiimpl.hxx | 12 +++++++----- vcl/skia/gdiimpl.cxx | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-)
New commits: commit 9791aaaa31749857e719ab8b6926b180966f959b Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Aug 5 14:40:41 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Tue Aug 5 15:53:14 2025 +0200 tdf#167643 Selection is black regression from commit 088a7c7c451321a800ca8d3523a18b6bb93239b7 Author: Noel Grandin <noelgran...@gmail.com> Date: Tue Sep 24 16:18:11 2024 +0200 remove alpha device from OutputDevice I am a little confused here. I would have thought kSrcOver would be the right blend mode, but instead it is kSrcATop which produces the "right" answer. Change-Id: If5bfb0ab139cbed5acaba2cc66c5036ca091818c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188957 Reviewed-by: Patrick Luby <guibomac...@gmail.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 5d376cc94539..5244cebf02b5 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -305,11 +305,11 @@ protected: // Create SkPaint to use when drawing to the surface. It is not to be used // when doing internal drawing such as when merging two bitmaps together. // This may apply some default settings to the paint as necessary. - SkPaint makePaintInternal() const; + SkPaint makePaintInternal(bool bSrcATop = false) const; // Create SkPaint set up for drawing lines (using mLineColor etc.). SkPaint makeLinePaint(double transparency = 0) const; // Create SkPaint set up for filling (using mFillColor etc.). - SkPaint makeFillPaint(double transparency = 0) const; + SkPaint makeFillPaint(double transparency = 0, bool bSrcATop = false) const; // Create SkPaint set up for bitmap drawing. SkPaint makeBitmapPaint() const; // Create SkPaint set up for gradient drawing. @@ -370,7 +370,7 @@ protected: bool mInWindowBackingPropertiesChanged; }; -inline SkPaint SkiaSalGraphicsImpl::makePaintInternal() const +inline SkPaint SkiaSalGraphicsImpl::makePaintInternal(bool bSrcATop) const { SkPaint paint; // Invert could be done using a blend mode like invert() does, but @@ -381,6 +381,8 @@ inline SkPaint SkiaSalGraphicsImpl::makePaintInternal() const SkiaHelper::setBlenderInvert(&paint); else if (mXorMode == XorMode::Xor) SkiaHelper::setBlenderXor(&paint); + else if (bSrcATop) + paint.setBlendMode(SkBlendMode::kSrcATop); else paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha return paint; @@ -397,10 +399,10 @@ inline SkPaint SkiaSalGraphicsImpl::makeLinePaint(double transparency) const return paint; } -inline SkPaint SkiaSalGraphicsImpl::makeFillPaint(double transparency) const +inline SkPaint SkiaSalGraphicsImpl::makeFillPaint(double transparency, bool bSrcATop) const { assert(moFillColor.has_value()); - SkPaint paint = makePaintInternal(); + SkPaint paint = makePaintInternal(bSrcATop); paint.setColor(transparency == 0 ? SkiaHelper::toSkColor(*moFillColor) : SkiaHelper::toSkColorWithTransparency(*moFillColor, transparency)); diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index bcc6cc01c0f0..20801881d3a9 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -965,7 +965,7 @@ void SkiaSalGraphicsImpl::performDrawPolyPolygon(const basegfx::B2DPolyPolygon& } if (moFillColor) { - SkPaint aPaint = makeFillPaint(fTransparency); + SkPaint aPaint = makeFillPaint(fTransparency, /*bSrcATop*/ true); aPaint.setAntiAlias(useAA); // HACK: If the polygon is just a line, it still should be drawn. But when filling // Skia doesn't draw empty polygons, so in that case ensure the line is drawn.