summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2020-11-13 20:22:32 +0100
committerLuboš Luňák <l.lunak@collabora.com>2020-11-17 10:54:55 +0100
commit319a03fe3975f24f1bccc88019a92217bc1df53b (patch)
tree92cacf562614295cb56e333ceb1461ff8aa2358e /vcl
parent3c7d0c8a32f71d597f33c9219fe8099e5381ca35 (diff)
update Skia to chrome/m88
Change-Id: I74c19597b07e9d07ee90e4191b75787241fdd845 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105829 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/skia/win/gdiimpl.hxx6
-rw-r--r--vcl/skia/gdiimpl.cxx8
-rw-r--r--vcl/skia/win/gdiimpl.cxx31
3 files changed, 29 insertions, 16 deletions
diff --git a/vcl/inc/skia/win/gdiimpl.hxx b/vcl/inc/skia/win/gdiimpl.hxx
index bcdf6874f4d5..26ca29eaee7b 100644
--- a/vcl/inc/skia/win/gdiimpl.hxx
+++ b/vcl/inc/skia/win/gdiimpl.hxx
@@ -77,12 +77,14 @@ protected:
virtual void performFlush() override;
sk_sp<SkTypeface> createDirectWriteTypeface(const LOGFONTW& logFont);
SkFont::Edging getFontEdging();
+ void initFontInfo();
IDWriteFactory* dwriteFactory;
IDWriteGdiInterop* dwriteGdiInterop;
sk_sp<SkFontMgr> dwriteFontMgr;
bool dwriteDone = false;
- SkFont::Edging fontEdging;
- bool fontEdgingDone = false;
+ static SkFont::Edging fontEdging;
+ static SkPixelGeometry pixelGeometry;
+ static bool fontInfoDone;
};
typedef std::pair<ControlCacheKey, sk_sp<SkImage>> SkiaControlCachePair;
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index a489d0385cfa..c2e96cd44576 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -321,7 +321,7 @@ void SkiaSalGraphicsImpl::createWindowSurface(bool forceRaster)
abort(); // This should not really happen, do not even try to cope with it.
}
}
- mIsGPU = mSurface->getCanvas()->getGrContext() != nullptr;
+ mIsGPU = mSurface->getCanvas()->recordingContext() != nullptr;
#ifdef DBG_UTIL
SkiaHelper::prefillSurface(mSurface);
#endif
@@ -346,7 +346,7 @@ void SkiaSalGraphicsImpl::createOffscreenSurface()
mSurface = SkiaHelper::createSkSurface(width, height);
if (mSurface)
{
- mIsGPU = mSurface->getCanvas()->getGrContext() != nullptr;
+ mIsGPU = mSurface->getCanvas()->recordingContext() != nullptr;
return;
}
}
@@ -358,7 +358,7 @@ void SkiaSalGraphicsImpl::createOffscreenSurface()
// Create raster surface as a fallback.
mSurface = SkiaHelper::createSkSurface(width, height);
assert(mSurface);
- assert(!mSurface->getCanvas()->getGrContext()); // is not GPU-backed
+ assert(!mSurface->getCanvas()->recordingContext()); // is not GPU-backed
mIsGPU = false;
}
@@ -410,7 +410,7 @@ void SkiaSalGraphicsImpl::postDraw()
}
SkiaZone::leave(); // matched in preDraw()
// If there's a problem with the GPU context, abort.
- if (GrContext* context = mSurface->getCanvas()->getGrContext())
+ if (GrDirectContext* context = GrAsDirectContext(mSurface->getCanvas()->recordingContext()))
{
// Running out of memory on the GPU technically could be possibly recoverable,
// but we don't know the exact status of the surface (and what has or has not been drawn to it),
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index 6b68571d6ab1..759ff1d477ec 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -22,7 +22,6 @@
#include <SkTypeface_win.h>
#include <SkFont.h>
#include <SkFontMgr.h>
-#include <SkFontLCDConfig.h>
#include <tools/sk_app/win/WindowContextFactory_win.h>
#include <tools/sk_app/WindowContext.h>
@@ -39,6 +38,9 @@ void WinSkiaSalGraphicsImpl::createWindowContext(bool forceRaster)
{
SkiaZone zone;
sk_app::DisplayParams displayParams;
+ initFontInfo();
+ displayParams.fSurfaceProps
+ = SkSurfaceProps(displayParams.fSurfaceProps.flags(), pixelGeometry);
switch (forceRaster ? SkiaHelper::RenderRaster : SkiaHelper::renderMethodToUse())
{
case SkiaHelper::RenderRaster:
@@ -209,10 +211,20 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout)
return true;
}
+SkFont::Edging WinSkiaSalGraphicsImpl::fontEdging;
+SkPixelGeometry WinSkiaSalGraphicsImpl::pixelGeometry;
+bool WinSkiaSalGraphicsImpl::fontInfoDone = false;
+
SkFont::Edging WinSkiaSalGraphicsImpl::getFontEdging()
{
- if (fontEdgingDone)
- return fontEdging;
+ initFontInfo();
+ return fontEdging;
+}
+
+void WinSkiaSalGraphicsImpl::initFontInfo()
+{
+ if (fontInfoDone)
+ return;
// Skia needs to be explicitly told what kind of antialiasing should be used,
// get it from system settings. This does not actually matter for the text
// rendering itself, since Skia has been patched to simply use the setting
@@ -222,7 +234,7 @@ SkFont::Edging WinSkiaSalGraphicsImpl::getFontEdging()
// the glyphs will be rendered based on this setting (subpixel AA requires colors,
// others do not).
fontEdging = SkFont::Edging::kAlias;
- SkFontLCDConfig::LCDOrder lcdOrder = SkFontLCDConfig::kNONE_LCDOrder;
+ pixelGeometry = kUnknown_SkPixelGeometry;
BOOL set;
if (SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &set, 0) && set)
{
@@ -233,24 +245,23 @@ SkFont::Edging WinSkiaSalGraphicsImpl::getFontEdging()
fontEdging = SkFont::Edging::kSubpixelAntiAlias;
if (SystemParametersInfo(SPI_GETFONTSMOOTHINGORIENTATION, 0, &set2, 0)
&& set2 == FE_FONTSMOOTHINGORIENTATIONBGR)
- lcdOrder = SkFontLCDConfig::kBGR_LCDOrder;
+ // No idea how to tell if it's horizontal or vertical.
+ pixelGeometry = kBGR_H_SkPixelGeometry;
else
- lcdOrder = SkFontLCDConfig::kRGB_LCDOrder; // default
+ pixelGeometry = kRGB_H_SkPixelGeometry; // default
}
else
fontEdging = SkFont::Edging::kAntiAlias;
}
- SkFontLCDConfig::SetSubpixelOrder(lcdOrder);
// Cache this, it is actually visible a little bit when profiling.
- fontEdgingDone = true;
- return fontEdging;
+ fontInfoDone = true;
}
void WinSkiaSalGraphicsImpl::ClearDevFontCache()
{
dwriteFontMgr.reset();
dwriteDone = false;
- fontEdgingDone = false;
+ fontInfoDone = false;
}
SkiaCompatibleDC::SkiaCompatibleDC(SalGraphics& rGraphics, int x, int y, int width, int height)