vcl/skia/gdiimpl.cxx | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-)
New commits: commit 77da137bc5238bd16a6ccb5286a08195dda87869 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Fri Nov 22 12:58:50 2019 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Fri Nov 22 18:17:07 2019 +0100 fix SkiaSalGraphicsImpl::drawPolyLine() Code pretty much copy&pasted from the vcl/quartz version. Fixes e.g. Writer marks showing paper corners. Change-Id: I3c9d2ed00efe409abd0a730a6f7dc0ea2a31c90a diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index b109b698914b..3996965e9760 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -620,16 +620,13 @@ bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectTo return true; } -// TODO implement rObjectToDevice - need to take the matrix into account bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice, const basegfx::B2DPolygon& rPolyLine, double fTransparency, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin, css::drawing::LineCap eLineCap, double fMiterMinimumAngle, - bool /*bPixelSnapHairline*/) + bool bPixelSnapHairline) { - //(void)bPixelSnapHairline; // TODO - if (rPolyLine.count() == 0 || fTransparency < 0.0 || fTransparency >= 1.0 || mLineColor == SALCOLOR_NONE) return true; @@ -637,27 +634,16 @@ bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDev preDraw(); SAL_INFO("vcl.skia", "drawpolyline(" << this << "): " << rPolyLine << ":" << mLineColor); - basegfx::B2DVector aLineWidths(rLineWidths); - const bool bObjectToDeviceIsIdentity(rObjectToDevice.isIdentity()); - const basegfx::B2DVector aDeviceLineWidths( - bObjectToDeviceIsIdentity ? rLineWidths : rObjectToDevice * rLineWidths); - const bool bCorrectLineWidth(!bObjectToDeviceIsIdentity && aDeviceLineWidths.getX() < 1.0 - && aLineWidths.getX() >= 1.0); - - // on-demand inverse of ObjectToDevice transformation - basegfx::B2DHomMatrix aObjectToDeviceInv; + // need to check/handle LineWidth when ObjectToDevice transformation is used + const basegfx::B2DVector aDeviceLineWidths(rObjectToDevice * rLineWidths); + const bool bCorrectLineWidth(aDeviceLineWidths.getX() < 1.0 && rLineWidths.getX() >= 1.0); + const basegfx::B2DVector aLineWidths(bCorrectLineWidth ? rLineWidths : aDeviceLineWidths); - if (bCorrectLineWidth) - { - if (aObjectToDeviceInv.isIdentity()) - { - aObjectToDeviceInv = rObjectToDevice; - aObjectToDeviceInv.invert(); - } - - // calculate-back logical LineWidth for a hairline - aLineWidths = aObjectToDeviceInv * basegfx::B2DVector(1.0, 1.0); - } + // Transform to DeviceCoordinates, get DeviceLineWidth, execute PixelSnapHairline + basegfx::B2DPolygon aPolyLine(rPolyLine); + aPolyLine.transform(rObjectToDevice); + if (bPixelSnapHairline) + aPolyLine = basegfx::utils::snapPointsOfHorizontalOrVerticalEdges(aPolyLine); // Setup Line Join SkPaint::Join eSkLineJoin = SkPaint::kMiter_Join; @@ -704,7 +690,7 @@ bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDev aPaint.setAntiAlias(mParent.getAntiAliasB2DDraw()); SkPath aPath; - addPolygonToPath(rPolyLine, aPath); + addPolygonToPath(aPolyLine, aPath); aPath.setFillType(SkPath::kEvenOdd_FillType); // Apply the same adjustment as toSkX()/toSkY() do. Do it here even in the non-GPU // case as it seems to produce better results. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits