[Libreoffice-commits] core.git: Branch 'feature/skia' - 5 commits - include/sal RepositoryExternal.mk vcl/inc vcl/README.vars vcl/skia
Luboš Luňák (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 5 16:36:58 UTC 2019
RepositoryExternal.mk | 1
include/sal/log-areas.dox | 1
vcl/README.vars | 7 +-
vcl/inc/skia/gdiimpl.hxx | 14 +++++
vcl/inc/skia/salbmp.hxx | 11 ++++
vcl/skia/gdiimpl.cxx | 98 ++++++++++++++++++++++++++++++++-------
vcl/skia/salbmp.cxx | 25 ++++++++-
vcl/skia/win/gdiimpl.cxx | 3 +
vcl/skia/x11/cairotextrender.cxx | 9 +++
vcl/skia/x11/gdiimpl.cxx | 3 +
10 files changed, 149 insertions(+), 23 deletions(-)
New commits:
commit a524a73e7c25bff4e053a680dd0c7dff23a4d972
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Nov 5 14:04:39 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Nov 5 17:35:55 2019 +0100
add SAL log group vcl.skia for tracing Skia usage
Change-Id: Ife21bbe0b86c3edd20e657da09c6e218fa4fced3
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index c7963c83c380..90c63982635d 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -116,6 +116,7 @@ define gb_LinkTarget__use_skia
$(call gb_LinkTarget_set_include,$(1),\
-I$(call gb_UnpackedTarball_get_dir,skia)/include/core \
-I$(call gb_UnpackedTarball_get_dir,skia)/include/effects \
+ -I$(call gb_UnpackedTarball_get_dir,skia)/include/gpu \
-I$(call gb_UnpackedTarball_get_dir,skia)/include/config \
-I$(call gb_UnpackedTarball_get_dir,skia)/include/third_party/vulkan \
-I$(call gb_UnpackedTarball_get_dir,skia) \
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 4711bd8a6a0f..ce0fa239b292 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -496,6 +496,7 @@ certain functionality.
@li @c vcl.scrollbar - Scroll Bars
@li @c vcl.se - VCL Session Manager
@li @c vcl.se.debug
+ at li @c vcl.skia - drawing using the Skia library
@li @c vcl.sm - Session Manager Client
@li @c vcl.sm.debug
@li @c vcl.uitest - The UI testing framework code
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 0c70ce0705ee..f45b29abb07e 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -215,6 +215,8 @@ protected:
void setProvider(SalGeometryProvider* provider) { mProvider = provider; }
bool isOffscreen() const { return mProvider == nullptr || mProvider->IsOffScreen(); }
+ // TODO mainly for debugging purposes
+ bool isGPU() const;
void invert(basegfx::B2DPolygon const& rPoly, SalInvert eFlags);
@@ -241,6 +243,14 @@ protected:
void prefillSurface();
#endif
+ template <typename charT, typename traits>
+ friend inline std::basic_ostream<charT, traits>&
+ operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalGraphicsImpl* graphics)
+ { // O - offscreen, G - GPU-based, R - raster
+ return stream << (void*)graphics << " " << Size(graphics->GetWidth(), graphics->GetHeight())
+ << (graphics->isOffscreen() ? "O" : "") << (graphics->isGPU() ? "G" : "R");
+ }
+
SalGraphics& mParent;
/// Pointer to the SalFrame or SalVirtualDevice
SalGeometryProvider* mProvider;
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index b7d0bd25a1b6..c5922685c5b7 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -78,6 +78,17 @@ private:
void verify() const {};
#endif
+ template <typename charT, typename traits>
+ friend inline std::basic_ostream<charT, traits>&
+ operator<<(std::basic_ostream<charT, traits>& stream, const SkiaSalBitmap* bitmap)
+ { // TODO GPU-based, once it's done
+ // B - has SkBitmap, A - has alpha SkBitmap, D - has data buffer
+ return stream << (void*)bitmap << " " << bitmap->GetSize() << "/" << bitmap->mBitCount
+ << (!bitmap->mBitmap.drawsNothing() ? "B" : "")
+ << (!bitmap->mAlphaBitmap.drawsNothing() ? "A" : "")
+ << (bitmap->mBuffer.get() ? "D" : "");
+ }
+
// TODO use something GPU-backed, or at least cache it for when drawing it to something GPU-backed?
SkBitmap mBitmap;
SkBitmap mAlphaBitmap; // TODO for use as an alpha channel or mask
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index d85ba18ffa76..8e12cc5a5300 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -28,6 +28,7 @@
#include <SkPath.h>
#include <SkRegion.h>
#include <SkDashPathEffect.h>
+#include <GrBackendSurface.h>
#include <basegfx/polygon/b2dpolygontools.hxx>
@@ -255,8 +256,22 @@ void SkiaSalGraphicsImpl::postDraw()
// to create it in Init() if it gets recreated later anyway).
void SkiaSalGraphicsImpl::checkSurface()
{
- if (!mSurface || GetWidth() != mSurface->width() || GetHeight() != mSurface->height())
+ if (!mSurface)
+ {
+ recreateSurface();
+ SAL_INFO("vcl.skia",
+ "create(" << this << "): " << Size(mSurface->width(), mSurface->height()));
+ }
+ else if (GetWidth() != mSurface->width() || GetHeight() != mSurface->height())
+ {
+#ifdef SAL_LOG_INFO
+ Size oldSize(mSurface->width(), mSurface->height());
+#endif
recreateSurface();
+ SAL_INFO("vcl.skia", "recreate(" << this << "): old " << oldSize << " new "
+ << Size(mSurface->width(), mSurface->height())
+ << " requested " << Size(GetWidth(), GetHeight()));
+ }
}
static SkIRect toSkIRect(const tools::Rectangle& rectangle)
@@ -297,6 +312,7 @@ bool SkiaSalGraphicsImpl::setClipRegion(const vcl::Region& region)
return true;
mClipRegion = region;
checkSurface();
+ SAL_INFO("vcl.skia", "setclipregion(" << this << "): " << region);
SkCanvas* canvas = mSurface->getCanvas();
// SkCanvas::clipRegion() can only further reduce the clip region,
// but we need to set the given region, which may extend it.
@@ -387,6 +403,7 @@ void SkiaSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor)
if (nColor == SALCOLOR_NONE)
return;
preDraw();
+ SAL_INFO("vcl.skia", "drawpixel(" << this << "): " << Point(nX, nY) << ":" << nColor);
SkCanvas* canvas = mSurface->getCanvas();
SkPaint paint;
paint.setColor(toSkColor(nColor));
@@ -401,6 +418,8 @@ void SkiaSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2)
if (mLineColor == SALCOLOR_NONE)
return;
preDraw();
+ SAL_INFO("vcl.skia", "drawline(" << this << "): " << Point(nX1, nY1) << "->" << Point(nX2, nY2)
+ << ":" << mLineColor);
SkCanvas* canvas = mSurface->getCanvas();
SkPaint paint;
paint.setColor(toSkColor(mLineColor));
@@ -413,6 +432,9 @@ void SkiaSalGraphicsImpl::privateDrawAlphaRect(long nX, long nY, long nWidth, lo
double fTransparency, bool blockAA)
{
preDraw();
+ SAL_INFO("vcl.skia", "privatedrawrect(" << this << "): " << Point(nX, nY) << "/"
+ << Size(nWidth, nHeight) << ":" << mLineColor << ":"
+ << mFillColor << ":" << fTransparency);
SkCanvas* canvas = mSurface->getCanvas();
SkPaint paint;
paint.setAntiAlias(!blockAA && mParent.getAntiAliasB2DDraw());
@@ -497,6 +519,8 @@ bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectTo
SkPath aPath;
basegfx::B2DPolyPolygon aPolyPolygon(rPolyPolygon);
aPolyPolygon.transform(rObjectToDevice);
+ SAL_INFO("vcl.skia", "drawpolypolygon(" << this << "): " << aPolyPolygon << ":" << mLineColor
+ << ":" << mFillColor);
lclPolyPolygonToPath(aPolyPolygon, aPath);
aPath.setFillType(SkPath::kEvenOdd_FillType);
@@ -533,6 +557,7 @@ bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDev
return true;
preDraw();
+ SAL_INFO("vcl.skia", "drawpolyline(" << this << "): " << rPolyLine << ":" << mLineColor);
basegfx::B2DVector aLineWidths(rLineWidths);
const bool bObjectToDeviceIsIdentity(rObjectToDevice.isIdentity());
@@ -649,6 +674,9 @@ void SkiaSalGraphicsImpl::copyArea(long nDestX, long nDestY, long nSrcX, long nS
if (nDestX == nSrcX && nDestY == nSrcY)
return;
preDraw();
+ SAL_INFO("vcl.skia", "copyarea(" << this << "): " << Point(nSrcX, nSrcY) << "->"
+ << Point(nDestX, nDestY) << "/"
+ << Size(nSrcWidth, nSrcHeight));
sk_sp<SkImage> image
= mSurface->makeImageSnapshot(SkIRect::MakeXYWH(nSrcX, nSrcY, nSrcWidth, nSrcHeight));
// TODO makeNonTextureImage() ?
@@ -668,6 +696,7 @@ void SkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcG
else
src = this;
src->checkSurface();
+ SAL_INFO("vcl.skia", "copybits(" << this << "): (" << src << "):" << rPosAry);
sk_sp<SkImage> image = src->mSurface->makeImageSnapshot(
SkIRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight));
// TODO makeNonTextureImage() ?
@@ -777,6 +806,8 @@ std::shared_ptr<SalBitmap> SkiaSalGraphicsImpl::getBitmap(long nX, long nY, long
long nHeight)
{
checkSurface();
+ SAL_INFO("vcl.skia",
+ "getbitmap(" << this << "): " << Point(nX, nY) << "/" << Size(nWidth, nHeight));
mSurface->getCanvas()->flush();
sk_sp<SkImage> image = mSurface->makeImageSnapshot(SkIRect::MakeXYWH(nX, nY, nWidth, nHeight));
return std::make_shared<SkiaSalBitmap>(*image);
@@ -785,6 +816,7 @@ std::shared_ptr<SalBitmap> SkiaSalGraphicsImpl::getBitmap(long nX, long nY, long
Color SkiaSalGraphicsImpl::getPixel(long nX, long nY)
{
checkSurface();
+ SAL_INFO("vcl.skia", "getpixel(" << this << "): " << Point(nX, nY));
mSurface->getCanvas()->flush();
// TODO this is presumably slow, and possibly won't work with GPU surfaces
SkBitmap bitmap;
@@ -798,6 +830,7 @@ Color SkiaSalGraphicsImpl::getPixel(long nX, long nY)
void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFlags)
{
preDraw();
+ SAL_INFO("vcl.skia", "invert(" << this << "): " << rPoly << ":" << int(eFlags));
// TrackFrame just inverts a dashed path around the polygon
if (eFlags == SalInvert::TrackFrame)
{
@@ -928,6 +961,7 @@ void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SkBitmap&
aPaint.setBlendMode(eBlendMode);
preDraw();
+ SAL_INFO("vcl.skia", "drawbitmap(" << this << "): " << rPosAry << ":" << int(eBlendMode));
mSurface->getCanvas()->drawBitmapRect(aBitmap, aSourceRect, aDestinationRect, &aPaint);
postDraw();
}
@@ -981,6 +1015,8 @@ bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
aMatrix.set(SkMatrix::kMTransY, rNull.getY());
preDraw();
+ SAL_INFO("vcl.skia",
+ "drawtransformedbitmap(" << this << "): " << rNull << ":" << rX << ":" << rY);
{
SkAutoCanvasRestore autoRestore(mSurface->getCanvas(), true);
mSurface->getCanvas()->concat(aMatrix);
@@ -1018,6 +1054,12 @@ bool SkiaSalGraphicsImpl::supportsOperation(OutDevSupportType eType) const
}
}
+bool SkiaSalGraphicsImpl::isGPU() const
+{
+ return mSurface.get()
+ && mSurface->getBackendRenderTarget(SkSurface::kFlushRead_BackendHandleAccess).isValid();
+}
+
#ifdef DBG_UTIL
void SkiaSalGraphicsImpl::dump(const char* file) const
{
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 9322e7ee8e55..c1ff1f13e9e3 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -55,7 +55,8 @@ SkiaSalBitmap::SkiaSalBitmap(const SkImage& image)
bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal)
{
- Destroy();
+ mBitmap.reset();
+ mBuffer.reset();
if (!isValidBitCount(nBitCount))
return false;
// Skia only supports 8bit gray, 16bit and 32bit formats (e.g. 24bpp is actually stored as 32bpp).
@@ -96,7 +97,7 @@ bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const Bitmap
int bitScanlineWidth;
if (o3tl::checked_multiply<int>(rSize.Width(), nBitCount, bitScanlineWidth))
{
- SAL_WARN("vcl.gdi", "checked multiply failed");
+ SAL_WARN("vcl.skia", "checked multiply failed");
return false;
}
mScanlineSize = AlignedWidth4Bytes(bitScanlineWidth);
@@ -120,6 +121,7 @@ bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const Bitmap
mPalette = rPal;
mBitCount = nBitCount;
mSize = rSize;
+ SAL_INFO("vcl.skia", "create(" << this << ")");
return true;
}
@@ -154,11 +156,13 @@ bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount)
mBuffer.reset(newBuffer);
mScanlineSize = src.mScanlineSize;
}
+ SAL_INFO("vcl.skia", "create(" << this << "): (" << &src << ")");
return true;
}
if (!Create(src.mSize, src.mBitCount, src.mPalette))
return false;
// TODO copy data
+ SAL_INFO("vcl.skia", "copy(" << this << "): (" << &src << ")");
abort();
return true;
}
@@ -174,6 +178,7 @@ bool SkiaSalBitmap::Create(const css::uno::Reference<css::rendering::XBitmapCanv
void SkiaSalBitmap::Destroy()
{
+ SAL_INFO("vcl.skia", "destroy(" << this << ")");
mBitmap.reset();
mBuffer.reset();
}
@@ -309,6 +314,7 @@ const SkBitmap& SkiaSalBitmap::GetSkBitmap() const
data.release(), mSize.Width() * 4,
[](void* addr, void*) { delete[] static_cast<sal_uInt8*>(addr); }, nullptr))
abort();
+ SAL_INFO("vcl.skia", "skbitmap(" << this << ")");
}
else
{
@@ -324,6 +330,7 @@ const SkBitmap& SkiaSalBitmap::GetSkBitmap() const
data.release(), mSize.Width() * 4,
[](void* addr, void*) { delete[] static_cast<sal_uInt8*>(addr); }, nullptr))
abort();
+ SAL_INFO("vcl.skia", "skbitmap(" << this << ")");
}
}
return mBitmap;
@@ -347,6 +354,7 @@ const SkBitmap& SkiaSalBitmap::GetAlphaSkBitmap() const
[](void* addr, void*) { delete[] static_cast<sal_uInt8*>(addr); },
nullptr))
abort();
+ SAL_INFO("vcl.skia", "skalphabitmap(" << this << ")");
}
else
{
@@ -378,6 +386,7 @@ const SkBitmap& SkiaSalBitmap::GetAlphaSkBitmap() const
.setPixelRef(sk_ref_sp(bitmap8->pixelRef()), bitmap8->pixelRefOrigin().x(),
bitmap8->pixelRefOrigin().y());
delete convertedBitmap;
+ SAL_INFO("vcl.skia", "skalphabitmap(" << this << ")");
return mAlphaBitmap;
}
}
commit 4986672b841fa758701a9749143880c75c61a22e
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Nov 5 12:58:18 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Nov 5 17:35:13 2019 +0100
handle properly Skia color endianess
Change-Id: I59af62fa92903823eb7105d82157017e485ba0df
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 18bd87efdc88..d85ba18ffa76 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -831,27 +831,29 @@ void SkiaSalGraphicsImpl::invert(basegfx::B2DPolygon const& rPoly, SalInvert eFl
// TODO Cache the bitmap
SkBitmap aBitmap;
aBitmap.allocN32Pixels(4, 4);
+ const SkPMColor white = SkPreMultiplyARGB(0xFF, 0xFF, 0xFF, 0xFF);
+ const SkPMColor black = SkPreMultiplyARGB(0xFF, 0x00, 0x00, 0x00);
SkPMColor* scanline;
scanline = aBitmap.getAddr32(0, 0);
- *scanline++ = 0xFFFFFFFF;
- *scanline++ = 0xFFFFFFFF;
- *scanline++ = 0xFF000000;
- *scanline++ = 0xFF000000;
+ *scanline++ = white;
+ *scanline++ = white;
+ *scanline++ = black;
+ *scanline++ = black;
scanline = aBitmap.getAddr32(0, 1);
- *scanline++ = 0xFFFFFFFF;
- *scanline++ = 0xFFFFFFFF;
- *scanline++ = 0xFF000000;
- *scanline++ = 0xFF000000;
+ *scanline++ = white;
+ *scanline++ = white;
+ *scanline++ = black;
+ *scanline++ = black;
scanline = aBitmap.getAddr32(0, 2);
- *scanline++ = 0xFF000000;
- *scanline++ = 0xFF000000;
- *scanline++ = 0xFFFFFFFF;
- *scanline++ = 0xFFFFFFFF;
+ *scanline++ = black;
+ *scanline++ = black;
+ *scanline++ = white;
+ *scanline++ = white;
scanline = aBitmap.getAddr32(0, 3);
- *scanline++ = 0xFF000000;
- *scanline++ = 0xFF000000;
- *scanline++ = 0xFFFFFFFF;
- *scanline++ = 0xFFFFFFFF;
+ *scanline++ = black;
+ *scanline++ = black;
+ *scanline++ = white;
+ *scanline++ = white;
// The bitmap is repeated in both directions the checker pattern is as big
// as the polygon (usually rectangle)
aPaint.setShader(aBitmap.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat));
commit 564326be6677a8e2a0c29034ca76be36a428a2cb
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Nov 5 12:51:31 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Nov 5 17:35:02 2019 +0100
pre-fill Skia bitmaps/surfaces with garbage in dbgutil mode
In order to be able to detect incorrect/missing drawing.
Change-Id: I18b3f05c1fdff69b461f22e984e0aef3c4ce3364
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 432f8f2512e5..0c70ce0705ee 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -237,6 +237,10 @@ protected:
};
static RenderMethod renderMethodToUse();
+#ifdef DBG_UTIL
+ void prefillSurface();
+#endif
+
SalGraphics& mParent;
/// Pointer to the SalFrame or SalVirtualDevice
SalGeometryProvider* mProvider;
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index c36184714adb..18bd87efdc88 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -209,6 +209,9 @@ void SkiaSalGraphicsImpl::createSurface()
// Create surface for offscreen graphics. Subclasses will create GPU-backed
// surfaces as appropriate.
mSurface = SkSurface::MakeRasterN32Premul(GetWidth(), GetHeight());
+#ifdef DBG_UTIL
+ prefillSurface();
+#endif
}
void SkiaSalGraphicsImpl::destroySurface()
@@ -1031,6 +1034,23 @@ void SkiaSalGraphicsImpl::dump(const SkBitmap& bitmap, const char* file)
std::ofstream ostream(file, std::ios::binary);
ostream.write(static_cast<const char*>(data->data()), data->size());
}
+
+void SkiaSalGraphicsImpl::prefillSurface()
+{
+ // Pre-fill the surface with deterministic garbage.
+ SkBitmap bitmap;
+ bitmap.allocN32Pixels(2, 2);
+ SkPMColor* scanline;
+ scanline = bitmap.getAddr32(0, 0);
+ *scanline++ = SkPreMultiplyARGB(0xFF, 0xBF, 0x80, 0x40);
+ *scanline++ = SkPreMultiplyARGB(0xFF, 0x40, 0x80, 0xBF);
+ scanline = bitmap.getAddr32(0, 1);
+ *scanline++ = SkPreMultiplyARGB(0xFF, 0xE3, 0x5C, 0x13);
+ *scanline++ = SkPreMultiplyARGB(0xFF, 0x13, 0x5C, 0xE3);
+ SkPaint paint;
+ paint.setShader(bitmap.makeShader(SkTileMode::kRepeat, SkTileMode::kRepeat));
+ mSurface->getCanvas()->drawPaint(paint);
+}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index b1b01f683fe4..9322e7ee8e55 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -82,6 +82,13 @@ bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const Bitmap
{
return false;
}
+#ifdef DBG_UTIL
+ // fill with random garbage
+ sal_uInt8* buffer = static_cast<sal_uInt8*>(mBitmap.getPixels());
+ size_t size = mBitmap.rowBytes() & mBitmap.height();
+ for (size_t i = 0; i < size; i++)
+ buffer[i] = (i & 0xFF);
+#endif
}
else
{
@@ -101,7 +108,10 @@ bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const Bitmap
allocate += sizeof(CANARY);
#endif
buffer = new sal_uInt8[allocate];
-#if OSL_DEBUG_LEVEL > 0
+#ifdef DBG_UTIL
+ // fill with random garbage
+ for (size_t i = 0; i < allocate; i++)
+ buffer[i] = (i & 0xFF);
memcpy(buffer + allocate - sizeof(CANARY), CANARY, sizeof(CANARY));
#endif
}
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index 4640e3b57897..d54120d5ffce 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -66,6 +66,9 @@ void WinSkiaSalGraphicsImpl::createSurface()
assert(SkToBool(mWindowContext)); // TODO
mSurface = mWindowContext->getBackbufferSurface();
assert(mSurface.get());
+#ifdef DBG_UTIL
+ prefillSurface();
+#endif
}
void WinSkiaSalGraphicsImpl::DeInit()
diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx
index f4575d8af867..fff94936a33d 100644
--- a/vcl/skia/x11/gdiimpl.cxx
+++ b/vcl/skia/x11/gdiimpl.cxx
@@ -74,6 +74,9 @@ void X11SkiaSalGraphicsImpl::createSurface()
assert(SkToBool(mWindowContext)); // TODO
mSurface = mWindowContext->getBackbufferSurface();
assert(mSurface.get());
+#ifdef DBG_UTIL
+ prefillSurface();
+#endif
}
void X11SkiaSalGraphicsImpl::DeInit()
commit bf8c0bc77b5d121d9fd18393913733c8a77bec02
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Nov 4 15:51:09 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Nov 5 17:34:46 2019 +0100
fix Skia text color on X11
Change-Id: I061acb80294c3bd6b45bd60dbb32c9a906619ed0
diff --git a/vcl/skia/x11/cairotextrender.cxx b/vcl/skia/x11/cairotextrender.cxx
index 82577d026ce9..73b7fc1052db 100644
--- a/vcl/skia/x11/cairotextrender.cxx
+++ b/vcl/skia/x11/cairotextrender.cxx
@@ -11,6 +11,7 @@
#include <salbmp.hxx>
#include <skia/gdiimpl.hxx>
+#include <osl/endian.h>
#include <cairo.h>
@@ -71,8 +72,14 @@ void SkiaX11CairoTextRender::releaseCairoContext(cairo_t* cr)
SalTwoRect aRect(0, 0, nWidth, nHeight, aClipRect.Left(), aClipRect.Top(), nWidth, nHeight);
+ SkImageInfo info;
+#ifdef OSL_LITENDIAN
+ info = SkImageInfo::Make(nWidth, nHeight, kBGRA_8888_SkColorType, kPremul_SkAlphaType);
+#else
+ info = SkImageInfo::Make(nWidth, nHeight, kARGB_8888_SkColorType, kPremul_SkAlphaType);
+#endif
SkBitmap bitmap;
- if (!bitmap.installPixels(SkImageInfo::MakeN32Premul(nWidth, nHeight), pSrc, nWidth * 4))
+ if (!bitmap.installPixels(info, pSrc, nWidth * 4))
abort();
pImpl->drawBitmap(aRect, bitmap);
commit 00a4fecfae2281cd6726b6393558b653296d44ac
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Nov 4 14:43:28 2019 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Nov 5 17:34:34 2019 +0100
some VCL OpenGL-specific env.vars. actually apply to Skia as well now
Change-Id: Ia8cfa8ef855f85cc324bc811e26dcab83b50b1be
diff --git a/vcl/README.vars b/vcl/README.vars
index 65a088fa3f27..f8026c35ccce 100644
--- a/vcl/README.vars
+++ b/vcl/README.vars
@@ -36,8 +36,6 @@ OpenGL
SAL_FORCEGL - force enable OpenGL
SAL_GL_NO_SWAP - disable buffer swapping if set (should show nothing)
SAL_GL_SLEEP_ON_SWAP - sleep for half a second on each swap-buffers.
-SAL_WITHOUT_WIDGET_CACHE - disable LRU caching of native widget textures
-SAL_DISABLE_GLYPH_CACHING - don't render glyphs through OpenGL textures
SAL_DISABLE_GL_WATCHDOG - don't start the thread that watches for broken GL drivers
Skia
@@ -46,3 +44,8 @@ SAL_DISABLESKIA=1 - force disabled Skia
SAL_ENABLESKIA=1 - enable Skia, unless blacklisted (and if the VCL backend supports Skia)
SAL_FORCESKIA=1 - force using Skia, even if blacklisted
SAL_SKIA=raster|vulkan - select Skia's drawing method, by default Vulkan is used
+
+OpenGL,Skia
+-----------
+SAL_WITHOUT_WIDGET_CACHE - disable LRU caching of native widget textures
+SAL_DISABLE_GLYPH_CACHING - don't render glyphs through OpenGL textures or Skia surfaces
More information about the Libreoffice-commits
mailing list