LibreOffice Module vcl (master) 1
win/gdiimpl.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX
11#define INCLUDED_VCL_INC_SKIA_WIN_GDIIMPL_HXX
12
13#include <memory>
14#include <systools/win32/comtools.hxx>
15
16#include <vcl/dllapi.h>
17#include <skia/gdiimpl.hxx>
18#include <skia/utils.hxx>
19#include <win/salgdi.h>
20#include <win/wingdiimpl.hxx>
21#include <o3tl/lru_map.hxx>
22#include <ControlCacheKey.hxx>
23#include <svdata.hxx>
24
25#include <SkFont.h>
26#include <SkFontMgr.h>
27
28#include <dwrite_3.h>
29
30class SkTypeface;
31class ControlCacheKey;
32
34{
35public:
36 SkiaCompatibleDC(SalGraphics& rGraphics, int x, int y, int width, int height);
37
38 sk_sp<SkImage> getAsImageDiff(const SkiaCompatibleDC& white) const;
39};
40
42{
43private:
45
46public:
48
49 virtual bool UseRenderNativeControl() const override { return true; }
50 virtual bool TryRenderCachedNativeControl(ControlCacheKey const& rControlCacheKey, int nX,
51 int nY) override;
52 virtual bool RenderAndCacheNativeControl(CompatibleDC& rWhite, CompatibleDC& rBlack, int nX,
53 int nY, ControlCacheKey& aControlCacheKey) override;
54
55 virtual bool DrawTextLayout(const GenericSalLayout& layout) override;
56 virtual void ClearDevFontCache() override;
57 virtual void ClearNativeControlCache() override;
58
59 virtual void freeResources() override;
60 virtual void Flush() override;
61
62 static void prepareSkia();
63
64protected:
65 virtual void createWindowSurfaceInternal(bool forceRaster = false) override;
66 static sk_sp<SkTypeface> createDirectWriteTypeface(const WinFontInstance* pWinFont);
67 static void initFontInfo();
68 inline static sal::systools::COMReference<IDWriteFontSetBuilder> dwriteFontSetBuilder;
69 inline static sal::systools::COMReference<IDWriteFontCollection1> dwritePrivateCollection;
70 inline static sk_sp<SkFontMgr> dwriteFontMgr;
71 inline static bool dwriteDone = false;
72 static SkFont::Edging fontEdging;
73};
74
75typedef std::pair<ControlCacheKey, sk_sp<SkImage>> SkiaControlCachePair;
78
80{
82
84
85public:
87};
88
89#endif
90
91/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Class that creates (and destroys) a compatible Device Context.
Definition: win/salgdi.h:94
Interface used to share logic on sizing between SalVirtualDevices and SalFrames.
Definition: salgeom.hxx:80
SkiaCompatibleDC(SalGraphics &rGraphics, int x, int y, int width, int height)
sk_sp< SkImage > getAsImageDiff(const SkiaCompatibleDC &white) const
static SkiaControlCacheType & get()
SkiaControlCacheType cache
Definition: win/gdiimpl.hxx:81
WinSalGraphics never owns the HDC it uses to draw, because the HDC can have various origins with diff...
Definition: win/salgdi.h:141
virtual void createWindowSurfaceInternal(bool forceRaster=false) override
virtual bool TryRenderCachedNativeControl(ControlCacheKey const &rControlCacheKey, int nX, int nY) override
static void initFontInfo()
static sal::systools::COMReference< IDWriteFontCollection1 > dwritePrivateCollection
Definition: win/gdiimpl.hxx:69
WinSalGraphics & mWinParent
Definition: win/gdiimpl.hxx:44
static sal::systools::COMReference< IDWriteFontSetBuilder > dwriteFontSetBuilder
Definition: win/gdiimpl.hxx:68
static sk_sp< SkTypeface > createDirectWriteTypeface(const WinFontInstance *pWinFont)
virtual bool UseRenderNativeControl() const override
Definition: win/gdiimpl.hxx:49
virtual void ClearNativeControlCache() override
virtual bool RenderAndCacheNativeControl(CompatibleDC &rWhite, CompatibleDC &rBlack, int nX, int nY, ControlCacheKey &aControlCacheKey) override
virtual bool DrawTextLayout(const GenericSalLayout &layout) override
virtual void freeResources() override
WinSkiaSalGraphicsImpl(WinSalGraphics &rGraphics, SalGeometryProvider *mpProvider)
virtual void Flush() override
virtual void ClearDevFontCache() override
static void prepareSkia()
static sk_sp< SkFontMgr > dwriteFontMgr
Definition: win/gdiimpl.hxx:70
static SkFont::Edging fontEdging
Definition: win/gdiimpl.hxx:72
std::pair< ControlCacheKey, sk_sp< SkImage > > SkiaControlCachePair
Definition: win/gdiimpl.hxx:75
o3tl::lru_map< ControlCacheKey, sk_sp< SkImage >, ControlCacheHashFunction > SkiaControlCacheType
Definition: win/gdiimpl.hxx:77