diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2020-10-06 22:14:36 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-10-08 13:40:14 +0200 |
commit | d18731f71c60cbb6c02cabb042004b1aa9454de8 (patch) | |
tree | 36870456fc84f62b2ab85a3bad1971641856cbda /vcl/inc/skia | |
parent | 47fda617fc4dad8273919227ca45ea3b8b61aea1 (diff) |
track dirty areas for Skia drawing
Updates to the screen in raster mode aren't _that_ slow, in fact
it seems using SkRegion can make things slower because of manipulating
the region, but with SkIRect this could sometimes help a bit.
It also appears that StretchDIBits() that is used by the Windows
raster code doesn't work correctly if only a subset of the y-axis
range is specified, which reduces the usefulness.
Change-Id: Ia93d2b60f2c62461e4c2c81210ab1d5d652a2cfb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104047
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 | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx index 21aaf880ae8c..3cc577300128 100644 --- a/vcl/inc/skia/gdiimpl.hxx +++ b/vcl/inc/skia/gdiimpl.hxx @@ -264,12 +264,12 @@ protected: SkCanvas* getXorCanvas(); void applyXor(); // NOTE: This must be called before the operation does any drawing. - void addXorRegion(const SkRect& rect) + void addUpdateRegion(const SkRect& rect) { + // Make slightly larger, just in case (rounding, antialiasing,...). + SkIRect addedRect = rect.makeOutset(2, 2).round(); if (mXorMode) { - // Make slightly larger, just in case (rounding, antialiasing,...). - SkIRect addedRect = rect.makeOutset(2, 2).round(); // Two xor operations should cancel each other out. We batch xor operations, // but if they can overlap, apply xor now, since applyXor() does the operation // just once. @@ -277,6 +277,9 @@ protected: applyXor(); mXorRegion.op(addedRect, SkRegion::kUnion_Op); } + // Using SkIRect should be enough, SkRegion would be too slow with many operations + // and swapping to the screen is not _that_slow. + mDirtyRect.join(addedRect); } static void setCanvasClipRegion(SkCanvas* canvas, const vcl::Region& region); sk_sp<SkImage> mergeCacheBitmaps(const SkiaSalBitmap& bitmap, const SkiaSalBitmap* alphaBitmap, @@ -318,6 +321,7 @@ protected: // The Skia surface that is target of all the rendering. sk_sp<SkSurface> mSurface; bool mIsGPU; // whether the surface is GPU-backed + SkIRect mDirtyRect; // the area that has been changed since the last performFlush() vcl::Region mClipRegion; Color mLineColor; Color mFillColor; |