summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-10-16 16:08:51 +0200
committerLuboš Luňák <l.lunak@collabora.com>2019-11-27 09:55:08 +0100
commit6f5c85daa0e5073d87d1d7699bfa59af159686ca (patch)
treeb26f513768e8ad6c825c9fa686a4d4b94f39a98e /vcl
parentef943999fbac70a28066093028e2192f8aba4c72 (diff)
basic implementation of Skia text drawing on Windows
Change-Id: If66e92aef04cd5bbeb22b8c5da65b7b9c77fed23
Diffstat (limited to 'vcl')
-rw-r--r--vcl/Library_vclplug_win.mk3
-rw-r--r--vcl/inc/opengl/win/gdiimpl.hxx2
-rw-r--r--vcl/inc/skia/gdiimpl.hxx1
-rw-r--r--vcl/inc/skia/win/gdiimpl.hxx30
-rw-r--r--vcl/inc/skia/win/winlayout.hxx32
-rw-r--r--vcl/inc/win/wingdiimpl.hxx30
-rw-r--r--vcl/inc/win/winlayout.hxx8
-rw-r--r--vcl/skia/gdiimpl.cxx15
-rw-r--r--vcl/skia/win/gdiimpl.cxx59
-rw-r--r--vcl/skia/win/winlayout.cxx26
-rw-r--r--vcl/win/gdi/gdiimpl.cxx11
-rw-r--r--vcl/win/gdi/gdiimpl.hxx6
-rw-r--r--vcl/win/gdi/salfont.cxx7
-rw-r--r--vcl/win/gdi/salgdi.cxx4
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx5
-rw-r--r--vcl/win/gdi/winlayout.cxx24
16 files changed, 220 insertions, 43 deletions
diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk
index f0dc4ac17fc6..f422d072a0e6 100644
--- a/vcl/Library_vclplug_win.mk
+++ b/vcl/Library_vclplug_win.mk
@@ -84,7 +84,8 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_win,\
vcl/win/window/salmenu \
vcl/win/window/salobj \
$(if $(filter SKIA,$(BUILD_TYPE)), \
- vcl/skia/win/gdiimpl) \
+ vcl/skia/win/gdiimpl \
+ vcl/skia/win/winlayout) \
))
$(eval $(call gb_Library_use_system_win32_libs,vclplug_win,\
diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx
index f7d3865ceec7..02b8b3850cab 100644
--- a/vcl/inc/opengl/win/gdiimpl.hxx
+++ b/vcl/inc/opengl/win/gdiimpl.hxx
@@ -72,8 +72,8 @@ public:
using OpenGLSalGraphicsImpl::DrawMask;
virtual void DeferredTextDraw(const CompatibleDC::Texture* pTexture, Color nMaskColor, const SalTwoRect& rPosAry) override;
+ virtual bool UseRenderNativeControl() const { return true; }
virtual bool TryRenderCachedNativeControl(ControlCacheKey const & rControlCacheKey, int nX, int nY) override;
-
virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack,
int nX, int nY , ControlCacheKey& aControlCacheKey) override;
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index 96bc628e1dd6..68646a78d4bc 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -218,6 +218,7 @@ protected:
return Color(255 - SkColorGetA(color), SkColorGetR(color), SkColorGetG(color),
SkColorGetB(color));
}
+ void drawMask(const SalTwoRect& rPosAry, const SkBitmap& rBitmap, Color nMaskColor);
SalGraphics& mParent;
/// Pointer to the SalFrame or SalVirtualDevice
diff --git a/vcl/inc/skia/win/gdiimpl.hxx b/vcl/inc/skia/win/gdiimpl.hxx
index 4c47f02baa95..05cacb69d230 100644
--- a/vcl/inc/skia/win/gdiimpl.hxx
+++ b/vcl/inc/skia/win/gdiimpl.hxx
@@ -23,6 +23,26 @@ namespace sk_app
class WindowContext;
}
+class SkiaCompatibleDC : public CompatibleDC
+{
+public:
+ SkiaCompatibleDC(SalGraphics& rGraphics, int x, int y, int width, int height);
+
+ virtual std::unique_ptr<Texture> getTexture() override;
+
+ virtual bool copyToTexture(Texture& aTexture) override;
+
+ struct Texture;
+};
+
+struct SkiaCompatibleDC::Texture : public CompatibleDC::Texture
+{
+ SkBitmap bitmap; // TODO SkBitmap, SkSurface, SkImage?
+ virtual bool isValid() const { return !bitmap.drawsNothing(); }
+ virtual int GetWidth() const { return bitmap.width(); }
+ virtual int GetHeight() const { return bitmap.height(); }
+};
+
class WinSkiaSalGraphicsImpl : public SkiaSalGraphicsImpl, public WinSalGraphicsImplBase
{
private:
@@ -37,12 +57,20 @@ public:
virtual void freeResources() override;
+ virtual bool UseRenderNativeControl() const override { return true; }
virtual bool TryRenderCachedNativeControl(ControlCacheKey const& rControlCacheKey, int nX,
int nY) override;
-
virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack, int nX,
int nY, ControlCacheKey& aControlCacheKey) override;
+ virtual bool UseTextDraw() const override { return true; }
+ virtual void PreDrawText() override;
+ virtual void PostDrawText() override;
+ virtual void DrawMask(CompatibleDC::Texture* rTexture, Color nMaskColor,
+ const SalTwoRect& rPosAry) override;
+ virtual void DeferredTextDraw(const CompatibleDC::Texture* pTexture, Color nMaskColor,
+ const SalTwoRect& rPosAry) override;
+
protected:
virtual void createSurface() override;
virtual void performFlush() override;
diff --git a/vcl/inc/skia/win/winlayout.hxx b/vcl/inc/skia/win/winlayout.hxx
new file mode 100644
index 000000000000..2455c39d06e8
--- /dev/null
+++ b/vcl/inc/skia/win/winlayout.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INC_SKIA_WIN_WINLAYOUT_HXX
+#define INCLUDED_VCL_INC_SKIA_WIN_WINLAYOUT_HXX
+
+#include <win/winlayout.hxx>
+
+struct SkiaGlobalWinGlyphCache : public GlobalWinGlyphCache
+{
+ virtual bool AllocateTexture(WinGlyphDrawElement& rElement, int nWidth, int nHeight) override;
+};
+
+#endif // INCLUDED_VCL_INC_SKIA_WIN_WINLAYOUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/wingdiimpl.hxx b/vcl/inc/win/wingdiimpl.hxx
index d283f4c2bb5c..2264eecf353d 100644
--- a/vcl/inc/win/wingdiimpl.hxx
+++ b/vcl/inc/win/wingdiimpl.hxx
@@ -21,22 +21,34 @@ class WinSalGraphicsImplBase
public:
virtual ~WinSalGraphicsImplBase(){};
- virtual bool TryRenderCachedNativeControl(ControlCacheKey const& rControlCacheKey, int nX,
- int nY)
- = 0;
-
- virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack, int nX,
- int nY, ControlCacheKey& aControlCacheKey)
- = 0;
+ // If true is returned, the following functions are used for drawing controls.
+ virtual bool UseRenderNativeControl() const { return false; }
+ virtual bool TryRenderCachedNativeControl(const ControlCacheKey& /*rControlCacheKey*/,
+ int /*nX*/, int /*nY*/)
+ {
+ abort();
+ };
+ virtual bool RenderAndCacheNativeControl(CompatibleDC& /*rWhite*/, CompatibleDC& /*rBlack*/,
+ int /*nX*/, int /*nY*/,
+ ControlCacheKey& /*aControlCacheKey*/)
+ {
+ abort();
+ };
// If true is returned, the following functions are used for text rendering.
virtual bool UseTextDraw() const { return false; }
virtual void PreDrawText() {}
virtual void PostDrawText() {}
virtual void DrawMask(CompatibleDC::Texture* /*rTexture*/, Color /*nMaskColor*/,
- const SalTwoRect& /*rPosAry*/){};
+ const SalTwoRect& /*rPosAry*/)
+ {
+ abort();
+ };
virtual void DeferredTextDraw(const CompatibleDC::Texture* /*pTexture*/, Color /*nMaskColor*/,
- const SalTwoRect& /*rPosAry*/){};
+ const SalTwoRect& /*rPosAry*/)
+ {
+ abort();
+ };
};
#endif // INCLUDED_VCL_INC_WIN_WINGDIIMPL_HXX
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index aef394fa83e3..0e819d7de369 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -75,22 +75,26 @@ protected:
public:
WinGlyphCache()
{
- GlobalWinGlyphCache::get()->maWinGlyphCaches.insert(this);
+ if(GlobalWinGlyphCache* c = GlobalWinGlyphCache::get())
+ c->maWinGlyphCaches.insert(this);
}
virtual ~WinGlyphCache()
{
- GlobalWinGlyphCache::get()->maWinGlyphCaches.erase(this);
+ if(GlobalWinGlyphCache* c = GlobalWinGlyphCache::get())
+ c->maWinGlyphCaches.erase(this);
}
void PutDrawElementInCache(WinGlyphDrawElement&& rElement, int nGlyphIndex)
{
+ assert(GlobalWinGlyphCache::get());
assert(!IsGlyphCached(nGlyphIndex));
maWinTextureCache[nGlyphIndex] = std::move( rElement );
}
WinGlyphDrawElement& GetDrawElement(int nGlyphIndex)
{
+ assert(GlobalWinGlyphCache::get());
assert(IsGlyphCached(nGlyphIndex));
return maWinTextureCache[nGlyphIndex];
}
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 246826b5f124..23248fc7ce79 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -412,14 +412,23 @@ void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SalBitmap& r
Color nMaskColor)
{
assert(dynamic_cast<const SkiaSalBitmap*>(&rSalBitmap));
+ drawMask(rPosAry, static_cast<const SkiaSalBitmap&>(rSalBitmap).GetSkBitmap(), nMaskColor);
+}
+
+void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SkBitmap& rBitmap,
+ Color nMaskColor)
+{
SkBitmap tmpBitmap;
- if (!tmpBitmap.tryAllocN32Pixels(rSalBitmap.GetSize().Width(), rSalBitmap.GetSize().Height()))
+ if (!tmpBitmap.tryAllocN32Pixels(rBitmap.width(), rBitmap.height()))
abort();
SkCanvas canvas(tmpBitmap);
SkPaint paint;
paint.setBlendMode(SkBlendMode::kSrc);
- canvas.drawBitmap(static_cast<const SkiaSalBitmap&>(rSalBitmap).GetSkBitmap(), 0, 0, &paint);
- tmpBitmap.eraseColor(toSkColor(nMaskColor));
+ canvas.drawBitmap(rBitmap, 0, 0, &paint);
+ // TODO what is this function supposed to do exactly?
+ // Text drawing on Windows doesn't work if this is uncommented.
+ // tmpBitmap.eraseColor(toSkColor(nMaskColor));
+ (void)nMaskColor;
mSurface->getCanvas()->drawBitmapRect(
tmpBitmap,
SkRect::MakeXYWH(rPosAry.mnSrcX, rPosAry.mnSrcY, rPosAry.mnSrcWidth, rPosAry.mnSrcHeight),
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index ccfd59572424..b8894ad98216 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -99,4 +99,63 @@ bool WinSkiaSalGraphicsImpl::RenderAndCacheNativeControl(CompatibleDC& rWhite, C
return false; // TODO
}
+void WinSkiaSalGraphicsImpl::PreDrawText() {}
+
+void WinSkiaSalGraphicsImpl::PostDrawText() { scheduleFlush(); }
+
+void WinSkiaSalGraphicsImpl::DeferredTextDraw(const CompatibleDC::Texture* pTexture,
+ Color aMaskColor, const SalTwoRect& rPosAry)
+{
+ assert(dynamic_cast<const SkiaCompatibleDC::Texture*>(pTexture));
+ drawMask(rPosAry, static_cast<const SkiaCompatibleDC::Texture*>(pTexture)->bitmap, aMaskColor);
+}
+
+void WinSkiaSalGraphicsImpl::DrawMask(CompatibleDC::Texture* pTexture, Color nMaskColor,
+ const SalTwoRect& rPosAry)
+{
+ assert(dynamic_cast<SkiaCompatibleDC::Texture*>(pTexture));
+ drawMask(rPosAry, static_cast<const SkiaCompatibleDC::Texture*>(pTexture)->bitmap, nMaskColor);
+}
+
+SkiaCompatibleDC::SkiaCompatibleDC(SalGraphics& rGraphics, int x, int y, int width, int height)
+ : CompatibleDC(rGraphics, x, y, width, height, false)
+{
+}
+
+std::unique_ptr<CompatibleDC::Texture> SkiaCompatibleDC::getTexture()
+{
+ auto ret = std::make_unique<SkiaCompatibleDC::Texture>();
+ // TODO is this correct?
+ // TODO make copy of data?
+ if (!ret->bitmap.installPixels(SkImageInfo::Make(maRects.mnSrcWidth, maRects.mnSrcHeight,
+ kBGRA_8888_SkColorType, kUnpremul_SkAlphaType),
+ mpData, maRects.mnSrcWidth * 4))
+ abort();
+ return ret;
+}
+
+bool SkiaCompatibleDC::copyToTexture(CompatibleDC::Texture& aTexture)
+{
+ assert(mpImpl);
+ assert(dynamic_cast<SkiaCompatibleDC::Texture*>(&aTexture));
+ SkBitmap tmpBitmap;
+ if (!tmpBitmap.installPixels(SkImageInfo::Make(maRects.mnSrcWidth, maRects.mnSrcHeight,
+ kBGRA_8888_SkColorType, kUnpremul_SkAlphaType),
+ mpData, maRects.mnSrcWidth * 4))
+ abort();
+ SkBitmap& bitmap = static_cast<SkiaCompatibleDC::Texture&>(aTexture).bitmap;
+ SkPaint paint;
+ paint.setBlendMode(SkBlendMode::kSrc); // set as is, including alpha
+ SkCanvas canvas(bitmap);
+ // The data we got is upside-down.
+ SkMatrix matrix;
+ matrix.preTranslate(0, maRects.mnSrcHeight);
+ matrix.setConcat(matrix, SkMatrix::MakeScale(1, -1));
+ canvas.concat(matrix);
+ canvas.drawBitmapRect(tmpBitmap,
+ SkRect::MakeXYWH(0, 0, maRects.mnSrcWidth, maRects.mnSrcHeight),
+ SkRect::MakeXYWH(0, 0, maRects.mnSrcWidth, maRects.mnSrcHeight), &paint);
+ return true;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/win/winlayout.cxx b/vcl/skia/win/winlayout.cxx
new file mode 100644
index 000000000000..bd232c1d2bbf
--- /dev/null
+++ b/vcl/skia/win/winlayout.cxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <skia/win/winlayout.hxx>
+
+#include <skia/win/gdiimpl.hxx>
+
+bool SkiaGlobalWinGlyphCache::AllocateTexture(WinGlyphDrawElement& rElement, int nWidth,
+ int nHeight)
+{
+ assert(rElement.maTexture.get() == nullptr);
+ SkiaCompatibleDC::Texture* texture = new SkiaCompatibleDC::Texture;
+ rElement.maTexture.reset(texture);
+ if (!texture->bitmap.tryAllocN32Pixels(nWidth, nHeight))
+ return false;
+ // TODO prune cache
+ return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index f63258b83dd2..6b3cd9024f59 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2576,15 +2576,4 @@ bool WinSalGraphicsImpl::drawGradient(const tools::PolyPolygon& /*rPolygon*/,
return false;
}
-bool WinSalGraphicsImpl::TryRenderCachedNativeControl(const ControlCacheKey& /*rControlCacheKey*/, int /*nX*/, int /*nY*/)
-{
- return false;
-}
-
-bool WinSalGraphicsImpl::RenderAndCacheNativeControl(CompatibleDC& /*rWhite*/, CompatibleDC& /*rBlack*/,
- int /*nX*/, int /*nY*/ , ControlCacheKey& /*aControlCacheKey*/)
-{
- return false;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index d7d37557565c..63eecf521750 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -238,12 +238,6 @@ public:
virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
const Gradient& rGradient) override;
-
- virtual bool TryRenderCachedNativeControl(const ControlCacheKey& rControlCacheKey,
- int nX, int nY) override;
-
- virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack,
- int nX, int nY , ControlCacheKey& aControlCacheKey) override;
};
#endif // INCLUDED_VCL_WIN_GDI_GDIIMPL_HXX
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 5716b69a676b..ec122f48e41a 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -61,6 +61,8 @@
#include <impfontmetricdata.hxx>
#include <impglyphitem.hxx>
+#include <vcl/skia/SkiaHelper.hxx>
+
using namespace vcl;
static const int MAXFONTHEIGHT = 2048;
@@ -781,8 +783,9 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
static BYTE nDefaultQuality = NONANTIALIASED_QUALITY;
if (nDefaultQuality == NONANTIALIASED_QUALITY)
{
- // TODO SKIA
- if (OpenGLWrapper::isVCLOpenGLEnabled())
+ if (SkiaHelper::isVCLSkiaEnabled())
+ nDefaultQuality = ANTIALIASED_QUALITY;
+ else if (OpenGLWrapper::isVCLOpenGLEnabled())
nDefaultQuality = ANTIALIASED_QUALITY;
else
nDefaultQuality = DEFAULT_QUALITY;
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 29c6f83e11f6..4b47b10b8f22 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -549,6 +549,10 @@ void ImplClearHDCCache( SalData* pData )
std::unique_ptr< CompatibleDC > CompatibleDC::create(SalGraphics &rGraphics, int x, int y, int width, int height)
{
+#if HAVE_FEATURE_SKIA
+ if (SkiaHelper::isVCLSkiaEnabled())
+ return std::make_unique< SkiaCompatibleDC >( rGraphics, x, y, width, height );
+#endif
if (OpenGLHelper::isVCLOpenGLEnabled())
return std::make_unique< OpenGLCompatibleDC >( rGraphics, x, y, width, height );
return std::unique_ptr< CompatibleDC >( new CompatibleDC( rGraphics, x, y, width, height ));
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 12338c69f34f..d23601238892 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -1159,8 +1159,9 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
tools::Rectangle cacheRect = rControlRegion;
Size keySize = cacheRect.GetSize();
- // TODO SKIA
- WinOpenGLSalGraphicsImpl* pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get());
+ WinSalGraphicsImplBase* pImpl = dynamic_cast<WinSalGraphicsImplBase*>(mpImpl.get());
+ if( !pImpl->UseRenderNativeControl())
+ pImpl = nullptr;
// tdf#95618 - A few controls render outside the region they're given.
if (pImpl && nType == ControlType::TabItem)
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 9305f38e9dd9..a3bc032c4844 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -18,6 +18,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
+
#include <memory>
#include <osl/module.h>
#include <osl/file.h>
@@ -34,6 +36,11 @@
#include <win/saldata.hxx>
#include <win/wingdiimpl.hxx>
#include <outdev.h>
+#include <vcl/opengl/OpenGLHelper.hxx>
+#include <vcl/skia/SkiaHelper.hxx>
+#if HAVE_FEATURE_SKIA
+#include <skia/win/winlayout.hxx>
+#endif
#include <win/DWriteTextRenderer.hxx>
#include <win/scoped_gdi.hxx>
@@ -55,8 +62,16 @@
GlobalWinGlyphCache * GlobalWinGlyphCache::get()
{
SalData *data = GetSalData();
- if (!data->m_pGlobalWinGlyphCache) // TODO SKIA
- data->m_pGlobalWinGlyphCache.reset(new OpenGLGlobalWinGlyphCache);
+ if (!data->m_pGlobalWinGlyphCache)
+ {
+#if HAVE_FEATURE_SKIA
+ if (SkiaHelper::isVCLSkiaEnabled())
+ data->m_pGlobalWinGlyphCache.reset(new SkiaGlobalWinGlyphCache);
+ else
+#endif
+ if (OpenGLHelper::isVCLOpenGLEnabled())
+ data->m_pGlobalWinGlyphCache.reset(new OpenGLGlobalWinGlyphCache);
+ }
return data->m_pGlobalWinGlyphCache.get();
}
@@ -478,9 +493,8 @@ bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout)
COLORREF color = GetTextColor(hDC);
Color salColor(GetRValue(color), GetGValue(color), GetBValue(color));
- // TODO SKIA
- WinOpenGLSalGraphicsImpl *pImpl = dynamic_cast<WinOpenGLSalGraphicsImpl*>(mpImpl.get());
- if (!pImpl)
+ WinSalGraphicsImplBase *pImpl = dynamic_cast<WinSalGraphicsImplBase*>(mpImpl.get());
+ if (!pImpl->UseTextDraw())
return false;
WinFontInstance& rFont = *static_cast<WinFontInstance*>(&rLayout.GetFont());