summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2016-10-14 15:08:21 -0700
committerChris Craik <ccraik@google.com>2016-10-17 10:51:11 -0700
commitd183e0b9886b46656a695a724cee6b9070e433ca (patch)
treeecc4fa1345bcf8244bbc669e617e3b4e43ed4bc0 /libs
parentc00a6cb9c34bfc5c71085d6cd961097edb1b73f5 (diff)
downloadandroid-frameworks-base-d183e0b9886b46656a695a724cee6b9070e433ca.tar.gz
android-frameworks-base-d183e0b9886b46656a695a724cee6b9070e433ca.tar.xz
Fix complex clipping on mergeable ops DO NOT MERGE
Fixes: 32106003 Change-Id: I519bc38a1fa8c25c9ae317ffdb7e59e5a0824f59
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/FrameBuilder.cpp2
-rw-r--r--libs/hwui/tests/unit/FrameBuilderTests.cpp29
2 files changed, 30 insertions, 1 deletions
diff --git a/libs/hwui/FrameBuilder.cpp b/libs/hwui/FrameBuilder.cpp
index 37d9d0e..7524ba0 100644
--- a/libs/hwui/FrameBuilder.cpp
+++ b/libs/hwui/FrameBuilder.cpp
@@ -591,7 +591,7 @@ void FrameBuilder::deferArcOp(const ArcOp& op) {
}
static bool hasMergeableClip(const BakedOpState& state) {
- return state.computedState.clipState
+ return !state.computedState.clipState
|| state.computedState.clipState->mode == ClipMode::Rectangle;
}
diff --git a/libs/hwui/tests/unit/FrameBuilderTests.cpp b/libs/hwui/tests/unit/FrameBuilderTests.cpp
index 53dbede..e2dc3a0 100644
--- a/libs/hwui/tests/unit/FrameBuilderTests.cpp
+++ b/libs/hwui/tests/unit/FrameBuilderTests.cpp
@@ -477,6 +477,35 @@ RENDERTHREAD_TEST(FrameBuilder, clippedMerging) {
EXPECT_EQ(4, renderer.getIndex());
}
+RENDERTHREAD_TEST(FrameBuilder, regionClipStopsMerge) {
+ class RegionClipStopsMergeTestRenderer : public TestRendererBase {
+ public:
+ void onTextOp(const TextOp& op, const BakedOpState& state) override { mIndex++; }
+ };
+ auto node = TestUtils::createNode(0, 0, 400, 400,
+ [](RenderProperties& props, TestCanvas& canvas) {
+ SkPath path;
+ path.addCircle(200, 200, 200, SkPath::kCW_Direction);
+ canvas.save(SaveFlags::MatrixClip);
+ canvas.clipPath(&path, SkRegion::kIntersect_Op);
+ SkPaint paint;
+ paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+ paint.setAntiAlias(true);
+ paint.setTextSize(50);
+ TestUtils::drawUtf8ToCanvas(&canvas, "Test string1", paint, 100, 100);
+ TestUtils::drawUtf8ToCanvas(&canvas, "Test string1", paint, 100, 200);
+ canvas.restore();
+ });
+
+ FrameBuilder frameBuilder(SkRect::MakeWH(400, 400), 400, 400,
+ sLightGeometry, Caches::getInstance());
+ frameBuilder.deferRenderNode(*TestUtils::getSyncedNode(node));
+
+ RegionClipStopsMergeTestRenderer renderer;
+ frameBuilder.replayBakedOps<TestDispatcher>(renderer);
+ EXPECT_EQ(2, renderer.getIndex());
+}
+
RENDERTHREAD_TEST(FrameBuilder, textMerging) {
class TextMergingTestRenderer : public TestRendererBase {
public: