summaryrefslogtreecommitdiff
path: root/libs/hwui/RenderNode.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2017-08-29 16:33:49 -0400
committerDerek Sollenberger <djsollen@google.com>2017-08-30 12:47:08 -0400
commit579317d4eb9648845f6f45bfbea2a98fa7813de4 (patch)
tree337ee0b9714502fef23f6d1451acd0ff5f5775a7 /libs/hwui/RenderNode.cpp
parentfbedb22745b1a6ca74990fa8e10dbbd62318c0a5 (diff)
Avoid performing the pathOp for clipped shadows if possible.
Bug: 64487466 Test: SystemUiJankTests#testRecentAppsFling Change-Id: I2ca96bd6adba299cd31e12f005b2529c559740d2
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
-rw-r--r--libs/hwui/RenderNode.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 61b3876cd095..36a747519c37 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -32,6 +32,7 @@
#include "protos/hwui.pb.h"
#include "protos/ProtoHelpers.h"
+#include <SkPathOps.h>
#include <algorithm>
#include <sstream>
#include <string>
@@ -555,5 +556,23 @@ void RenderNode::computeOrderingImpl(
}
}
+const SkPath* RenderNode::getClippedOutline(const SkRect& clipRect) const {
+ const SkPath* outlinePath = properties().getOutline().getPath();
+ const uint32_t outlineID = outlinePath->getGenerationID();
+
+ if (outlineID != mClippedOutlineCache.outlineID || clipRect != mClippedOutlineCache.clipRect) {
+ // update the cache keys
+ mClippedOutlineCache.outlineID = outlineID;
+ mClippedOutlineCache.clipRect = clipRect;
+
+ // update the cache value by recomputing a new path
+ SkPath clipPath;
+ clipPath.addRect(clipRect);
+ Op(*outlinePath, clipPath, kIntersect_SkPathOp, &mClippedOutlineCache.clippedOutline);
+
+ }
+ return &mClippedOutlineCache.clippedOutline;
+}
+
} /* namespace uirenderer */
} /* namespace android */