summaryrefslogtreecommitdiff
path: root/libs/hwui/RenderNode.h
diff options
context:
space:
mode:
author Nader Jawad <njawad@google.com> 2021-06-09 10:14:43 -0700
committer Nader Jawad <njawad@google.com> 2021-06-10 23:03:03 -0700
commit6aff4814a73c0b87cd1ab5e92ef9547e4d20042c (patch)
treeb3bd488c6ea0132402ffd7714fe5e733c478de1e /libs/hwui/RenderNode.h
parent466698f9afc2b4930544c07776493d4bce915f24 (diff)
Refactor SkImageFilter usage to cache results.
If an SkImageFilter is used, create an image snapshot with the filter applied to avoid re-computing it on each draw invocation Bug: 188450217 Test: Re-ran CTS tests Change-Id: Ib790669e14ada9d4ebbfac958d699e2b5242f2d7
Diffstat (limited to 'libs/hwui/RenderNode.h')
-rw-r--r--libs/hwui/RenderNode.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index 6a0b1aafd7c7..8595b6e5f78a 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -345,6 +345,16 @@ public:
return mSkiaLayer.get() ? mSkiaLayer->layerSurface.get() : nullptr;
}
+ struct SnapshotResult {
+ sk_sp<SkImage> snapshot;
+ SkIRect outSubset;
+ SkIPoint outOffset;
+ };
+
+ std::optional<SnapshotResult> updateSnapshotIfRequired(GrRecordingContext* context,
+ const SkImageFilter* imageFilter,
+ const SkIRect& clipBounds);
+
skiapipeline::SkiaLayer* getSkiaLayer() const { return mSkiaLayer.get(); }
/**
@@ -375,6 +385,22 @@ private:
*/
std::unique_ptr<skiapipeline::SkiaLayer> mSkiaLayer;
+ /**
+ * SkImageFilter used to create the mSnapshotResult
+ */
+ sk_sp<SkImageFilter> mTargetImageFilter;
+
+ /**
+ * Clip bounds used to create the mSnapshotResult
+ */
+ SkIRect mImageFilterClipBounds;
+
+ /**
+ * Result of the most recent snapshot with additional metadata used to
+ * determine how to draw the contents
+ */
+ SnapshotResult mSnapshotResult;
+
struct ClippedOutlineCache {
// keys
uint32_t outlineID = 0;