diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-12-03 11:39:01 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-12-06 14:25:30 +0100 |
commit | 5b667d771de65167e269bb145b888eabbc7fdedd (patch) | |
tree | e87eb59c423c19dbce1f3eddc6d0790b586811d0 /vcl/inc/skia | |
parent | 8b94f29ee623a28c5225b904829e04c6b83a89a5 (diff) |
make Skia Windows text rendering use SkImage instead of SkBitmap
This will allow making it GPU-backed, as SkImage can be GPU-backed,
SkBitmap cannot.
Change-Id: I047eefe83741a036d372d39e5fc6a4fa400e6504
Reviewed-on: https://gerrit.libreoffice.org/84559
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/inc/skia')
-rw-r--r-- | vcl/inc/skia/gdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/skia/win/gdiimpl.hxx | 19 | ||||
-rw-r--r-- | vcl/inc/skia/win/winlayout.hxx | 8 |
3 files changed, 14 insertions, 15 deletions
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 98edc9156384..e61ee6cfb787 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -237,7 +237,7 @@ protected: // get the height of the device int GetHeight() const { return mProvider ? mProvider->GetHeight() : 1; } - void drawMask(const SalTwoRect& rPosAry, const SkBitmap& rBitmap, Color nMaskColor); + void drawMask(const SalTwoRect& rPosAry, const SkImage& rImage, Color nMaskColor); // When drawing using GPU, rounding errors may result in off-by-one errors, // see https://bugs.chromium.org/p/skia/issues/detail?id=9611 . Compensate for diff --git a/vcl/inc/skia/win/gdiimpl.hxx b/vcl/inc/skia/win/gdiimpl.hxx index 37c8ad374aa8..003fac2cc65b 100644 --- a/vcl/inc/skia/win/gdiimpl.hxx +++ b/vcl/inc/skia/win/gdiimpl.hxx @@ -29,22 +29,20 @@ public: virtual std::unique_ptr<Texture> getAsMaskTexture() override; - virtual bool copyToTexture(Texture& aTexture) override; - virtual bool wantsTextColorWhite() const override { return true; } - SkBitmap getAsBitmap(); - SkBitmap getAsMaskBitmap(); + sk_sp<SkImage> getAsImage(); + sk_sp<SkImage> getAsMaskImage(); 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(); } + sk_sp<SkImage> image; + virtual bool isValid() const { return image.get(); } + virtual int GetWidth() const { return image->width(); } + virtual int GetHeight() const { return image->height(); } }; class WinSkiaSalGraphicsImpl : public SkiaSalGraphicsImpl, public WinSalGraphicsImplBase @@ -81,8 +79,9 @@ protected: virtual void performFlush() override; }; -typedef std::pair<ControlCacheKey, SkBitmap> SkiaControlCachePair; -typedef o3tl::lru_map<ControlCacheKey, SkBitmap, ControlCacheHashFunction> SkiaControlCacheType; +typedef std::pair<ControlCacheKey, sk_sp<SkImage>> SkiaControlCachePair; +typedef o3tl::lru_map<ControlCacheKey, sk_sp<SkImage>, ControlCacheHashFunction> + SkiaControlCacheType; class SkiaControlsCache { diff --git a/vcl/inc/skia/win/winlayout.hxx b/vcl/inc/skia/win/winlayout.hxx index a577c357b84f..32b2aea266a5 100644 --- a/vcl/inc/skia/win/winlayout.hxx +++ b/vcl/inc/skia/win/winlayout.hxx @@ -26,17 +26,17 @@ struct SkiaGlobalWinGlyphCache : public GlobalWinGlyphCache { - virtual bool AllocateTexture(WinGlyphDrawElement& rElement, int nWidth, int nHeight) override; + virtual bool AllocateTexture(WinGlyphDrawElement& rElement, CompatibleDC* dc) override; virtual void NotifyElementUsed(WinGlyphDrawElement& rElement) override; virtual void Prune() override; - // The least recently used SkBitmap order, identified by SkBitmap::getPixels(). - std::vector<void*> mLRUOrder; + // The least recently used SkImage order, identified by SkImage::uniqueID(). + std::vector<uint32_t> mLRUOrder; }; class SkiaWinGlyphCache : public WinGlyphCache { public: - void RemoveTextures(const std::vector<void*>& pixels); + void RemoveTextures(const std::vector<uint32_t>& ids); private: // This class just "adds" RemoveTexture() to the base class, it's never instantiatied. |