summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/skia/gdiimpl.hxx2
-rw-r--r--vcl/skia/gdiimpl.cxx9
-rw-r--r--vcl/skia/x11/cairotextrender.cxx16
3 files changed, 14 insertions, 13 deletions
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index c72c5979464d..28f088179611 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -183,6 +183,8 @@ public:
virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
const Gradient& rGradient) override;
+ void drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& bitmap);
+
// To be called after any drawing.
void scheduleFlush();
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 4a42ea503985..07937c6b9cb0 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -490,14 +490,19 @@ bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBi
&paint);
paint.setBlendMode(SkBlendMode::kSrcIn);
canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSourceBitmap).GetSkBitmap(), 0, 0, &paint);
+ drawBitmap(rPosAry, tmpBitmap);
+ return true;
+}
+
+void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SkBitmap& bitmap)
+{
mSurface->getCanvas()->drawBitmapRect(
- tmpBitmap,
+ bitmap,
SkRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight),
SkRect::MakeXYWH(rPosAry.mnDestX, rPosAry.mnDestY, rPosAry.mnDestWidth,
rPosAry.mnDestHeight),
nullptr);
scheduleFlush();
- return true;
}
bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
diff --git a/vcl/skia/x11/cairotextrender.cxx b/vcl/skia/x11/cairotextrender.cxx
index 7c2402b2c869..f3cc30b709fe 100644
--- a/vcl/skia/x11/cairotextrender.cxx
+++ b/vcl/skia/x11/cairotextrender.cxx
@@ -38,7 +38,6 @@ cairo_t* SkiaX11CairoTextRender::getCairoContext()
if (!surface)
return nullptr;
cairo_t* cr = cairo_create(surface);
- // TODO
cairo_surface_destroy(surface);
return cr;
}
@@ -56,7 +55,6 @@ void SkiaX11CairoTextRender::getSurfaceOffset(double& nDX, double& nDY)
void SkiaX11CairoTextRender::releaseCairoContext(cairo_t* cr)
{
- // XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV
SkiaSalGraphicsImpl* pImpl = dynamic_cast<SkiaSalGraphicsImpl*>(mrParent.GetImpl());
if (!pImpl)
{
@@ -70,19 +68,15 @@ void SkiaX11CairoTextRender::releaseCairoContext(cairo_t* cr)
cairo_surface_flush(pSurface);
unsigned char* pSrc = cairo_image_surface_get_data(pSurface);
- // XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV
tools::Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect();
-
SalTwoRect aRect(0, 0, nWidth, nHeight, aClipRect.Left(), aClipRect.Top(), nWidth, nHeight);
- // Cairo surface data is ARGB with premultiplied alpha and is Y-inverted
- // TODO
- // SkiaTexture aTexture( nWidth, nHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pSrc );
- // pImpl->PreDraw();
- // pImpl->DrawAlphaTexture( aTexture, aRect, true, true );
- // pImpl->PostDraw();
- // abort();
+ SkBitmap bitmap;
+ if (!bitmap.installPixels(SkImageInfo::MakeN32Premul(nWidth, nHeight), pSrc, nWidth * 4))
+ abort();
+ pImpl->drawBitmap(aRect, bitmap);
+ bitmap.reset();
cairo_destroy(cr);
}