[Libreoffice-commits] core.git: Branch 'feature/skia' - vcl/inc vcl/skia
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Oct 24 10:56:49 UTC 2019
vcl/inc/skia/gdiimpl.hxx | 2 ++
vcl/skia/gdiimpl.cxx | 20 +++++++++++---------
2 files changed, 13 insertions(+), 9 deletions(-)
New commits:
commit 31ed4055e2a6b4fb99fb91dc76d37e11cca27232
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Oct 24 12:50:45 2019 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Oct 24 12:52:23 2019 +0200
skia: drawAlphaRect and drawRect use common code
Change-Id: Ib7fc850d024b1fc7ec0ab933842bf1868b70a6d2
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index d0cd0dc2d52b..a5036fbb3075 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -206,6 +206,8 @@ protected:
void checkSurface();
void resetSurface();
+ void privateDrawAlphaRect(long nX, long nY, long nWidth, long nHeight, double nTransparency);
+
void setProvider(SalGeometryProvider* provider) { mProvider = provider; }
bool isOffscreen() const { return mProvider == nullptr || mProvider->IsOffScreen(); }
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 5fd44115cb44..24dbcab59e50 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -337,26 +337,32 @@ void SkiaSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2)
postDraw();
}
-void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
+void SkiaSalGraphicsImpl::privateDrawAlphaRect(long nX, long nY, long nWidth, long nHeight,
+ double fTransparency)
{
preDraw();
SkCanvas* canvas = mSurface->getCanvas();
SkPaint paint;
if (mFillColor != SALCOLOR_NONE)
{
- paint.setColor(toSkColor(mFillColor));
+ paint.setColor(toSkColorWithTransparency(mFillColor, fTransparency));
paint.setStyle(SkPaint::kFill_Style);
canvas->drawIRect(SkIRect::MakeXYWH(nX, nY, nWidth, nHeight), paint);
}
if (mLineColor != SALCOLOR_NONE)
{
- paint.setColor(toSkColor(mLineColor));
+ paint.setColor(toSkColorWithTransparency(mLineColor, fTransparency));
paint.setStyle(SkPaint::kStroke_Style);
canvas->drawIRect(SkIRect::MakeXYWH(nX, nY, nWidth - 1, nHeight - 1), paint);
}
postDraw();
}
+void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
+{
+ privateDrawAlphaRect(nX, nY, nWidth, nHeight, 0.0);
+}
+
void SkiaSalGraphicsImpl::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry)
{
basegfx::B2DPolygon aPolygon;
@@ -834,12 +840,8 @@ bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
bool SkiaSalGraphicsImpl::drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
sal_uInt8 nTransparency)
{
- (void)nX;
- (void)nY;
- (void)nWidth;
- (void)nHeight;
- (void)nTransparency;
- return false;
+ privateDrawAlphaRect(nX, nY, nWidth, nHeight, nTransparency / 100.0);
+ return true;
}
bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolygon,
More information about the Libreoffice-commits
mailing list