diff options
author | Derek Sollenberger <djsollen@google.com> | 2018-12-07 14:12:12 -0500 |
---|---|---|
committer | Derek Sollenberger <djsollen@google.com> | 2018-12-20 10:04:46 -0500 |
commit | 24fc901e5f54ee00f6df323178a05787ab705814 (patch) | |
tree | 73085619ebaac2d7632dca84cfbfac40222e4bed /libs/hwui/SkiaCanvas.cpp | |
parent | e8a25e3dbc1f6b1409ea511e2b5faa31cff3faea (diff) |
Improve performance of unclipped save layers.
Instead of allocating a separate renderTarget and switching
between them on each draw the new implementation follows the same
pattern that the old HWUI renderer used. The area of the layer is
now copied to a buffer on the GPU, the area is then cleared, rendered
as normal, and finally the texture is redrawn using dst_over blending.
This results in no render target switches and is considerably faster
on some hardware.
Test: CtsGraphicsTestCases, CtsUiRenderingTestCases
Bug: 119222339
Change-Id: I716aac1fc31e4c7a171373d37dee82034c01cf18
Diffstat (limited to 'libs/hwui/SkiaCanvas.cpp')
-rw-r--r-- | libs/hwui/SkiaCanvas.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp index 6be7ef72cf5d..83b9e7f6a3b8 100644 --- a/libs/hwui/SkiaCanvas.cpp +++ b/libs/hwui/SkiaCanvas.cpp @@ -24,6 +24,7 @@ #include "hwui/PaintFilter.h" #include "pipeline/skia/AnimatedDrawables.h" +#include <SkAndroidFrameworkUtils.h> #include <SkAnimatedImage.h> #include <SkCanvasStateUtils.h> #include <SkColorFilter.h> @@ -185,6 +186,11 @@ int SkiaCanvas::saveLayerAlpha(float left, float top, float right, float bottom, return this->saveLayer(left, top, right, bottom, nullptr, flags); } +int SkiaCanvas::saveUnclippedLayer(int left, int top, int right, int bottom) { + SkRect bounds = SkRect::MakeLTRB(left, top, right, bottom); + return SkAndroidFrameworkUtils::SaveBehind(mCanvas, &bounds); +} + class SkiaCanvas::Clip { public: Clip(const SkRect& rect, SkClipOp op, const SkMatrix& m) |