summaryrefslogtreecommitdiff
path: root/libs/hwui/RecordingCanvas.h
diff options
context:
space:
mode:
authorStan Iliev <stani@google.com>2018-11-06 17:35:50 -0500
committerStan Iliev <stani@google.com>2019-01-30 13:43:12 -0500
commitf09ee58eb7edf7efb0cf8e24ad763a582dac0228 (patch)
tree45ee79658df15f788f9647135a9761e5ac9fc28e /libs/hwui/RecordingCanvas.h
parent2444f5a5104e8bad7712db0a1087ee0aab93b957 (diff)
Put Vulkan WebViews on a HW layer if stencil clip
Put WebViews in a HW layer, if the clip is a non-rect. This CL reuses logic implemented by ag/705975. This used to be the way GL WebViews were drawn in Android M. Implement complex clip detection at recording time, which was not previously supported by the canvas. Vulkan WebViews using GL interop are already drawn in a layer, but this CL will be useful when WebView supports new Vulkan interop. Test: WebView CTS pass for Vulkan and GL Bug: 115613038 Change-Id: I9b02c6f4de8efd504a7507633f3d849004215a16
Diffstat (limited to 'libs/hwui/RecordingCanvas.h')
-rw-r--r--libs/hwui/RecordingCanvas.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/libs/hwui/RecordingCanvas.h b/libs/hwui/RecordingCanvas.h
index caaef67f724f..3a76ca1137a5 100644
--- a/libs/hwui/RecordingCanvas.h
+++ b/libs/hwui/RecordingCanvas.h
@@ -203,10 +203,41 @@ public:
void drawVectorDrawable(VectorDrawableRoot* tree);
+ /**
+ * If "isClipMayBeComplex" returns false, it is guaranteed the current clip is a rectangle.
+ * If the return value is true, then clip may or may not be complex (there is no guarantee).
+ */
+ inline bool isClipMayBeComplex() { return mClipMayBeComplex; }
+
private:
typedef SkCanvasVirtualEnforcer<SkNoDrawCanvas> INHERITED;
+ inline void setClipMayBeComplex() {
+ if (!mClipMayBeComplex) {
+ mComplexSaveCount = mSaveCount;
+ mClipMayBeComplex = true;
+ }
+ }
+
DisplayListData* fDL;
+
+ /**
+ * mClipMayBeComplex tracks if the current clip is a rectangle. This flag is used to promote
+ * FunctorDrawable to a layer, if it is clipped by a non-rect.
+ */
+ bool mClipMayBeComplex = false;
+
+ /**
+ * mSaveCount is the current level of our save tree.
+ */
+ int mSaveCount = 0;
+
+ /**
+ * mComplexSaveCount is the first save level, which has a complex clip. Every level below
+ * mComplexSaveCount is assumed to have a complex clip and every level above mComplexSaveCount
+ * is guaranteed to not be complex.
+ */
+ int mComplexSaveCount = 0;
};
} // namespace uirenderer