Index: tests/ClipStackTest.cpp |
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp |
index 394835b369a53c36e4a886d1eed4b94eb8657cf3..5d6cf328f85d4f90d2983491647e4e56867d365b 100644 |
--- a/tests/ClipStackTest.cpp |
+++ b/tests/ClipStackTest.cpp |
@@ -33,21 +33,21 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { |
p.lineTo(7, 8); |
p.lineTo(5, 9); |
p.close(); |
- s.clipDevPath(p, SkRegion::kIntersect_Op, doAA); |
+ s.clipDevPath(p, SkCanvas::kIntersect_Op, doAA); |
s.save(); |
REPORTER_ASSERT(reporter, 2 == s.getSaveCount()); |
SkRect r = SkRect::MakeLTRB(1, 2, 3, 4); |
- s.clipDevRect(r, SkRegion::kIntersect_Op, doAA); |
+ s.clipDevRect(r, SkCanvas::kIntersect_Op, doAA); |
r = SkRect::MakeLTRB(10, 11, 12, 13); |
- s.clipDevRect(r, SkRegion::kIntersect_Op, doAA); |
+ s.clipDevRect(r, SkCanvas::kIntersect_Op, doAA); |
s.save(); |
REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); |
r = SkRect::MakeLTRB(14, 15, 16, 17); |
- s.clipDevRect(r, SkRegion::kUnion_Op, doAA); |
+ s.clipDevRect(r, SkCanvas::kUnion_Op, doAA); |
// Test that assignment works. |
SkClipStack copy = s; |
@@ -62,7 +62,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { |
s.save(); |
REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); |
r = SkRect::MakeLTRB(14, 15, 16, 17); |
- s.clipDevRect(r, SkRegion::kUnion_Op, doAA); |
+ s.clipDevRect(r, SkCanvas::kUnion_Op, doAA); |
REPORTER_ASSERT(reporter, s == copy); |
// Test that a different op on one level triggers not equal. |
@@ -71,7 +71,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { |
s.save(); |
REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); |
r = SkRect::MakeLTRB(14, 15, 16, 17); |
- s.clipDevRect(r, SkRegion::kIntersect_Op, doAA); |
+ s.clipDevRect(r, SkCanvas::kIntersect_Op, doAA); |
REPORTER_ASSERT(reporter, s != copy); |
// Test that version constructed with rect-path rather than a rect is still considered equal. |
@@ -79,7 +79,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { |
s.save(); |
SkPath rp; |
rp.addRect(r); |
- s.clipDevPath(rp, SkRegion::kUnion_Op, doAA); |
+ s.clipDevPath(rp, SkCanvas::kUnion_Op, doAA); |
REPORTER_ASSERT(reporter, s == copy); |
// Test that different rects triggers not equal. |
@@ -89,7 +89,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { |
REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); |
r = SkRect::MakeLTRB(24, 25, 26, 27); |
- s.clipDevRect(r, SkRegion::kUnion_Op, doAA); |
+ s.clipDevRect(r, SkCanvas::kUnion_Op, doAA); |
REPORTER_ASSERT(reporter, s != copy); |
// Sanity check |
@@ -112,7 +112,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) { |
REPORTER_ASSERT(reporter, 1 == s.getSaveCount()); |
p.addRect(r); |
- s.clipDevPath(p, SkRegion::kIntersect_Op, doAA); |
+ s.clipDevPath(p, SkCanvas::kIntersect_Op, doAA); |
REPORTER_ASSERT(reporter, s != copy); |
} |
@@ -140,7 +140,7 @@ static void test_iterators(skiatest::Reporter* reporter) { |
for (size_t i = 0; i < SK_ARRAY_COUNT(gRects); i++) { |
// the union op will prevent these from being fused together |
- stack.clipDevRect(gRects[i], SkRegion::kUnion_Op, false); |
+ stack.clipDevRect(gRects[i], SkCanvas::kUnion_Op, false); |
} |
assert_count(reporter, stack, 4); |
@@ -181,7 +181,7 @@ static void test_iterators(skiatest::Reporter* reporter) { |
SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); |
- element = iter.skipToTopmost(SkRegion::kUnion_Op); |
+ element = iter.skipToTopmost(SkCanvas::kUnion_Op); |
REPORTER_ASSERT(reporter, SkClipStack::Element::kRect_Type == element->getType()); |
REPORTER_ASSERT(reporter, element->getRect() == gRects[3]); |
} |
@@ -220,12 +220,12 @@ static void test_bounds(skiatest::Reporter* reporter, SkClipStack::Element::Type |
{ 10, 10, 50, 50 }, |
}; |
- static const SkRegion::Op gOps[] = { |
- SkRegion::kIntersect_Op, |
- SkRegion::kDifference_Op, |
- SkRegion::kUnion_Op, |
- SkRegion::kXOR_Op, |
- SkRegion::kReverseDifference_Op |
+ static const SkCanvas::ClipOp gOps[] = { |
+ SkCanvas::kIntersect_Op, |
+ SkCanvas::kDifference_Op, |
+ SkCanvas::kUnion_Op, |
+ SkCanvas::kXOR_Op, |
+ SkCanvas::kReverseDifference_Op |
}; |
SkRect rectA, rectB; |
@@ -265,15 +265,15 @@ static void test_bounds(skiatest::Reporter* reporter, SkClipStack::Element::Type |
SkDEBUGFAIL("Don't call this with kEmpty."); |
break; |
case SkClipStack::Element::kRect_Type: |
- stack.clipDevRect(rectA, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(rectA, SkCanvas::kIntersect_Op, false); |
stack.clipDevRect(rectB, gOps[op], false); |
break; |
case SkClipStack::Element::kRRect_Type: |
- stack.clipDevRRect(rrectA, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRRect(rrectA, SkCanvas::kIntersect_Op, false); |
stack.clipDevRRect(rrectB, gOps[op], false); |
break; |
case SkClipStack::Element::kPath_Type: |
- stack.clipDevPath(pathA, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(pathA, SkCanvas::kIntersect_Op, false); |
stack.clipDevPath(pathB, gOps[op], false); |
break; |
} |
@@ -286,7 +286,7 @@ static void test_bounds(skiatest::Reporter* reporter, SkClipStack::Element::Type |
if (SkClipStack::Element::kRect_Type == primType) { |
REPORTER_ASSERT(reporter, isIntersectionOfRects == |
- (gOps[op] == SkRegion::kIntersect_Op)); |
+ (gOps[op] == SkCanvas::kIntersect_Op)); |
} else { |
REPORTER_ASSERT(reporter, !isIntersectionOfRects); |
} |
@@ -334,8 +334,8 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { |
clipB.addRoundRect(rectB, SkIntToScalar(5), SkIntToScalar(5)); |
clipB.setFillType(SkPath::kInverseEvenOdd_FillType); |
- stack.clipDevPath(clipA, SkRegion::kReplace_Op, false); |
- stack.clipDevPath(clipB, SkRegion::kUnion_Op, false); |
+ stack.clipDevPath(clipA, SkCanvas::kReplace_Op, false); |
+ stack.clipDevPath(clipB, SkCanvas::kUnion_Op, false); |
REPORTER_ASSERT(reporter, stack.isWideOpen()); |
REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); |
@@ -345,7 +345,7 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(rectA, SkRegion::kUnion_Op, false); |
+ stack.clipDevRect(rectA, SkCanvas::kUnion_Op, false); |
REPORTER_ASSERT(reporter, stack.isWideOpen()); |
REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); |
@@ -358,7 +358,7 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { |
SkRect emptyRect; |
emptyRect.setEmpty(); |
- stack.clipDevRect(emptyRect, SkRegion::kDifference_Op, false); |
+ stack.clipDevRect(emptyRect, SkCanvas::kDifference_Op, false); |
REPORTER_ASSERT(reporter, stack.isWideOpen()); |
REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); |
@@ -370,7 +370,7 @@ static void test_isWideOpen(skiatest::Reporter* reporter) { |
stack.save(); |
- stack.clipDevRect(rectA, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(rectA, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, !stack.isWideOpen()); |
REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID != stack.getTopmostGenID()); |
@@ -404,7 +404,7 @@ static void test_rect_inverse_fill(skiatest::Reporter* reporter) { |
path.addRect(rect); |
path.toggleInverseFillType(); |
SkClipStack stack; |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
SkRect bounds; |
SkClipStack::BoundsType boundsType; |
@@ -426,9 +426,9 @@ static void test_rect_replace(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
REPORTER_ASSERT(reporter, 0 == count(stack)); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
} |
@@ -437,9 +437,9 @@ static void test_rect_replace(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
REPORTER_ASSERT(reporter, 0 == count(stack)); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, true); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, true); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
} |
@@ -448,23 +448,23 @@ static void test_rect_replace(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
REPORTER_ASSERT(reporter, 0 == count(stack)); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, true); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
} |
// Make sure replace clip rects don't collapse too much. |
{ |
SkClipStack stack; |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
- stack.clipDevRect(rect2, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
+ stack.clipDevRect(rect2, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
stack.save(); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 2 == count(stack)); |
stack.getBounds(&bound, &type, &isIntersectionOfRects); |
REPORTER_ASSERT(reporter, bound == rect); |
@@ -472,16 +472,16 @@ static void test_rect_replace(skiatest::Reporter* reporter) { |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
stack.save(); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 2 == count(stack)); |
stack.restore(); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
stack.save(); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
- stack.clipDevRect(rect2, SkRegion::kIntersect_Op, false); |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
+ stack.clipDevRect(rect2, SkCanvas::kIntersect_Op, false); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 2 == count(stack)); |
stack.restore(); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
@@ -498,18 +498,18 @@ static void test_path_replace(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
REPORTER_ASSERT(reporter, 0 == count(stack)); |
- stack.clipDevPath(path, SkRegion::kReplace_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
- stack.clipDevPath(path, SkRegion::kReplace_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
} |
// Replacing rect with path. |
{ |
SkClipStack stack; |
- stack.clipDevRect(rect, SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(rect, SkCanvas::kReplace_Op, true); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
- stack.clipDevPath(path, SkRegion::kReplace_Op, true); |
+ stack.clipDevPath(path, SkCanvas::kReplace_Op, true); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
} |
} |
@@ -532,9 +532,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(overlapLeft, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(overlapLeft, SkCanvas::kReplace_Op, false); |
- stack.clipDevRect(overlapRight, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(overlapRight, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
@@ -547,9 +547,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(overlapLeft, SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(overlapLeft, SkCanvas::kReplace_Op, true); |
- stack.clipDevRect(overlapRight, SkRegion::kIntersect_Op, true); |
+ stack.clipDevRect(overlapRight, SkCanvas::kIntersect_Op, true); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
@@ -562,9 +562,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(overlapLeft, SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(overlapLeft, SkCanvas::kReplace_Op, true); |
- stack.clipDevRect(overlapRight, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(overlapRight, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, 2 == count(stack)); |
@@ -577,9 +577,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(nestedParent, SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(nestedParent, SkCanvas::kReplace_Op, true); |
- stack.clipDevRect(nestedChild, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(nestedChild, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
@@ -592,9 +592,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(nestedParent, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(nestedParent, SkCanvas::kReplace_Op, false); |
- stack.clipDevRect(nestedChild, SkRegion::kIntersect_Op, true); |
+ stack.clipDevRect(nestedChild, SkCanvas::kIntersect_Op, true); |
REPORTER_ASSERT(reporter, 1 == count(stack)); |
@@ -607,9 +607,9 @@ static void test_rect_merging(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(nestedChild, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(nestedChild, SkCanvas::kReplace_Op, false); |
- stack.clipDevRect(nestedParent, SkRegion::kIntersect_Op, true); |
+ stack.clipDevRect(nestedParent, SkCanvas::kIntersect_Op, true); |
REPORTER_ASSERT(reporter, 2 == count(stack)); |
@@ -637,7 +637,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(outsideRect, SkRegion::kDifference_Op, false); |
+ stack.clipDevRect(outsideRect, SkCanvas::kDifference_Op, false); |
// return false because quickContains currently does not care for kDifference_Op |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
@@ -645,24 +645,24 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
// Replace Op tests |
{ |
SkClipStack stack; |
- stack.clipDevRect(outsideRect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(outsideRect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); |
} |
{ |
SkClipStack stack; |
- stack.clipDevRect(insideRect, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(insideRect, SkCanvas::kIntersect_Op, false); |
stack.save(); // To prevent in-place substitution by replace OP |
- stack.clipDevRect(outsideRect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(outsideRect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); |
stack.restore(); |
} |
{ |
SkClipStack stack; |
- stack.clipDevRect(outsideRect, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(outsideRect, SkCanvas::kIntersect_Op, false); |
stack.save(); // To prevent in-place substitution by replace OP |
- stack.clipDevRect(insideRect, SkRegion::kReplace_Op, false); |
+ stack.clipDevRect(insideRect, SkCanvas::kReplace_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
stack.restore(); |
} |
@@ -670,59 +670,59 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
// Verify proper traversal of multi-element clip |
{ |
SkClipStack stack; |
- stack.clipDevRect(insideRect, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(insideRect, SkCanvas::kIntersect_Op, false); |
// Use a path for second clip to prevent in-place intersection |
- stack.clipDevPath(outsideCircle, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(outsideCircle, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
// Intersect Op tests with rectangles |
{ |
SkClipStack stack; |
- stack.clipDevRect(outsideRect, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(outsideRect, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); |
} |
{ |
SkClipStack stack; |
- stack.clipDevRect(insideRect, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(insideRect, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
{ |
SkClipStack stack; |
- stack.clipDevRect(intersectingRect, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(intersectingRect, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
{ |
SkClipStack stack; |
- stack.clipDevRect(nonIntersectingRect, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect(nonIntersectingRect, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
// Intersect Op tests with circle paths |
{ |
SkClipStack stack; |
- stack.clipDevPath(outsideCircle, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(outsideCircle, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); |
} |
{ |
SkClipStack stack; |
- stack.clipDevPath(insideCircle, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(insideCircle, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
{ |
SkClipStack stack; |
- stack.clipDevPath(intersectingCircle, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(intersectingCircle, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
{ |
SkClipStack stack; |
- stack.clipDevPath(nonIntersectingCircle, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(nonIntersectingCircle, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
@@ -732,7 +732,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
SkPath path; |
path.addRect(outsideRect); |
path.toggleInverseFillType(); |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
@@ -741,7 +741,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
SkPath path; |
path.addRect(insideRect); |
path.toggleInverseFillType(); |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
@@ -750,7 +750,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
SkPath path; |
path.addRect(intersectingRect); |
path.toggleInverseFillType(); |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
@@ -759,7 +759,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
SkPath path; |
path.addRect(nonIntersectingRect); |
path.toggleInverseFillType(); |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); |
} |
@@ -768,7 +768,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
SkClipStack stack; |
SkPath path = outsideCircle; |
path.toggleInverseFillType(); |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
@@ -776,7 +776,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
SkClipStack stack; |
SkPath path = insideCircle; |
path.toggleInverseFillType(); |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
@@ -784,7 +784,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
SkClipStack stack; |
SkPath path = intersectingCircle; |
path.toggleInverseFillType(); |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); |
} |
@@ -792,7 +792,7 @@ static void test_quickContains(skiatest::Reporter* reporter) { |
SkClipStack stack; |
SkPath path = nonIntersectingCircle; |
path.toggleInverseFillType(); |
- stack.clipDevPath(path, SkRegion::kIntersect_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kIntersect_Op, false); |
REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); |
} |
} |
@@ -814,18 +814,18 @@ static void set_region_to_stack(const SkClipStack& stack, const SkIRect& bounds, |
elemRegion.setPath(path, boundsRgn); |
break; |
} |
- region->op(elemRegion, element->getOp()); |
+ region->op(elemRegion, (SkRegion::Op)element->getOp()); |
} |
} |
static void test_invfill_diff_bug(skiatest::Reporter* reporter) { |
SkClipStack stack; |
- stack.clipDevRect({10, 10, 20, 20}, SkRegion::kIntersect_Op, false); |
+ stack.clipDevRect({10, 10, 20, 20}, SkCanvas::kIntersect_Op, false); |
SkPath path; |
path.addRect({30, 10, 40, 20}); |
path.setFillType(SkPath::kInverseWinding_FillType); |
- stack.clipDevPath(path, SkRegion::kDifference_Op, false); |
+ stack.clipDevPath(path, SkCanvas::kDifference_Op, false); |
REPORTER_ASSERT(reporter, SkClipStack::kEmptyGenID == stack.getTopmostGenID()); |
@@ -851,11 +851,11 @@ static void test_invfill_diff_bug(skiatest::Reporter* reporter) { |
// reduced stack. |
typedef void (*AddElementFunc) (const SkRect& rect, |
bool invert, |
- SkRegion::Op op, |
+ SkCanvas::ClipOp op, |
SkClipStack* stack, |
bool doAA); |
-static void add_round_rect(const SkRect& rect, bool invert, SkRegion::Op op, SkClipStack* stack, |
+static void add_round_rect(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkClipStack* stack, |
bool doAA) { |
SkScalar rx = rect.width() / 10; |
SkScalar ry = rect.height() / 20; |
@@ -871,7 +871,7 @@ static void add_round_rect(const SkRect& rect, bool invert, SkRegion::Op op, SkC |
} |
}; |
-static void add_rect(const SkRect& rect, bool invert, SkRegion::Op op, SkClipStack* stack, |
+static void add_rect(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkClipStack* stack, |
bool doAA) { |
if (invert) { |
SkPath path; |
@@ -883,7 +883,7 @@ static void add_rect(const SkRect& rect, bool invert, SkRegion::Op op, SkClipSta |
} |
}; |
-static void add_oval(const SkRect& rect, bool invert, SkRegion::Op op, SkClipStack* stack, |
+static void add_oval(const SkRect& rect, bool invert, SkCanvas::ClipOp op, SkClipStack* stack, |
bool doAA) { |
SkPath path; |
path.addOval(rect); |
@@ -929,13 +929,13 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { |
static const SkScalar kMinElemSizeFrac = SK_Scalar1 / 5; |
static const SkScalar kMaxElemSizeFrac = SK_Scalar1; |
- static const SkRegion::Op kOps[] = { |
- SkRegion::kDifference_Op, |
- SkRegion::kIntersect_Op, |
- SkRegion::kUnion_Op, |
- SkRegion::kXOR_Op, |
- SkRegion::kReverseDifference_Op, |
- SkRegion::kReplace_Op, |
+ static const SkCanvas::ClipOp kOps[] = { |
+ SkCanvas::kDifference_Op, |
+ SkCanvas::kIntersect_Op, |
+ SkCanvas::kUnion_Op, |
+ SkCanvas::kXOR_Op, |
+ SkCanvas::kReverseDifference_Op, |
+ SkCanvas::kReplace_Op, |
}; |
// Replace operations short-circuit the optimizer. We want to make sure that we test this code |
@@ -965,8 +965,8 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { |
int numElems = r.nextRangeU(kMinElemsPerTest, kMaxElemsPerTest); |
bool doAA = r.nextBiasedBool(kFractionAntialiased); |
for (int e = 0; e < numElems; ++e) { |
- SkRegion::Op op = kOps[r.nextULessThan(SK_ARRAY_COUNT(kOps))]; |
- if (op == SkRegion::kReplace_Op) { |
+ SkCanvas::ClipOp op = kOps[r.nextULessThan(SK_ARRAY_COUNT(kOps))]; |
+ if (op == SkCanvas::kReplace_Op) { |
if (r.nextU() % kReplaceDiv) { |
--e; |
continue; |
@@ -1051,8 +1051,8 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { |
SkIRect ibounds = reduced->hasIBounds() ? reduced->ibounds() : kIBounds; |
// GrReducedClipStack assumes that the final result is clipped to the returned bounds |
- reducedStack.clipDevRect(ibounds, SkRegion::kIntersect_Op); |
- stack.clipDevRect(ibounds, SkRegion::kIntersect_Op); |
+ reducedStack.clipDevRect(ibounds, SkCanvas::kIntersect_Op); |
+ stack.clipDevRect(ibounds, SkCanvas::kIntersect_Op); |
// convert both the original stack and reduced stack to SkRegions and see if they're equal |
SkRegion region; |
@@ -1076,8 +1076,8 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { |
static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { |
{ |
SkClipStack stack; |
- stack.clipDevRect(SkRect::MakeXYWH(0, 0, 100, 100), SkRegion::kReplace_Op, true); |
- stack.clipDevRect(SkRect::MakeXYWH(0, 0, SkScalar(50.3), SkScalar(50.3)), SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(SkRect::MakeXYWH(0, 0, 100, 100), SkCanvas::kReplace_Op, true); |
+ stack.clipDevRect(SkRect::MakeXYWH(0, 0, SkScalar(50.3), SkScalar(50.3)), SkCanvas::kReplace_Op, true); |
SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); |
SkAlignedSTStorage<1, GrReducedClip> storage; |
@@ -1098,13 +1098,13 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { |
// A B |
// C D |
- stack.clipDevRect(SkRect::MakeXYWH(0, 0, SkScalar(25.3), SkScalar(25.3)), SkRegion::kReplace_Op, true); |
+ stack.clipDevRect(SkRect::MakeXYWH(0, 0, SkScalar(25.3), SkScalar(25.3)), SkCanvas::kReplace_Op, true); |
int32_t genIDA = stack.getTopmostGenID(); |
- stack.clipDevRect(SkRect::MakeXYWH(50, 0, SkScalar(25.3), SkScalar(25.3)), SkRegion::kUnion_Op, true); |
+ stack.clipDevRect(SkRect::MakeXYWH(50, 0, SkScalar(25.3), SkScalar(25.3)), SkCanvas::kUnion_Op, true); |
int32_t genIDB = stack.getTopmostGenID(); |
- stack.clipDevRect(SkRect::MakeXYWH(0, 50, SkScalar(25.3), SkScalar(25.3)), SkRegion::kUnion_Op, true); |
+ stack.clipDevRect(SkRect::MakeXYWH(0, 50, SkScalar(25.3), SkScalar(25.3)), SkCanvas::kUnion_Op, true); |
int32_t genIDC = stack.getTopmostGenID(); |
- stack.clipDevRect(SkRect::MakeXYWH(50, 50, SkScalar(25.3), SkScalar(25.3)), SkRegion::kUnion_Op, true); |
+ stack.clipDevRect(SkRect::MakeXYWH(50, 50, SkScalar(25.3), SkScalar(25.3)), SkCanvas::kUnion_Op, true); |
int32_t genIDD = stack.getTopmostGenID(); |
@@ -1183,8 +1183,8 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { |
static void test_reduced_clip_stack_no_aa_crash(skiatest::Reporter* reporter) { |
SkClipStack stack; |
- stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 100, 100), SkRegion::kReplace_Op); |
- stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 50, 50), SkRegion::kReplace_Op); |
+ stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 100, 100), SkCanvas::kReplace_Op); |
+ stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 50, 50), SkCanvas::kReplace_Op); |
SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); |
// At the time, this would crash. |
@@ -1284,7 +1284,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { |
// Pixel-aligned rect (iior=true). |
name.printf("Pixel-aligned rect test, iter %i", i); |
SkClipStack stack; |
- stack.clipDevRect(alignedRect, SkRegion::kIntersect_Op, true); |
+ stack.clipDevRect(alignedRect, SkCanvas::kIntersect_Op, true); |
test_aa_query(reporter, name, stack, m, {IL, IT, IR, IB}, ClipMethod::kIgnoreClip); |
test_aa_query(reporter, name, stack, m, {IL, IT-1, IR, IT}, ClipMethod::kSkipDraw); |
test_aa_query(reporter, name, stack, m, {IL, IT-2, IR, IB}, ClipMethod::kScissor); |
@@ -1292,7 +1292,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { |
// Rect (iior=true). |
name.printf("Rect test, iter %i", i); |
stack.reset(); |
- stack.clipDevRect(rect, SkRegion::kIntersect_Op, true); |
+ stack.clipDevRect(rect, SkCanvas::kIntersect_Op, true); |
test_aa_query(reporter, name, stack, m, {L, T, R, B}, ClipMethod::kIgnoreClip); |
test_aa_query(reporter, name, stack, m, {L-.1f, T, L, B}, ClipMethod::kSkipDraw); |
test_aa_query(reporter, name, stack, m, {L-.1f, T, L+.1f, B}, ClipMethod::kAAElements, 1); |
@@ -1300,7 +1300,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { |
// Difference rect (iior=false, inside-out bounds). |
name.printf("Difference rect test, iter %i", i); |
stack.reset(); |
- stack.clipDevRect(rect, SkRegion::kDifference_Op, true); |
+ stack.clipDevRect(rect, SkCanvas::kDifference_Op, true); |
test_aa_query(reporter, name, stack, m, {L, T, R, B}, ClipMethod::kSkipDraw); |
test_aa_query(reporter, name, stack, m, {L, T-.1f, R, T}, ClipMethod::kIgnoreClip); |
test_aa_query(reporter, name, stack, m, {L, T-.1f, R, T+.1f}, ClipMethod::kAAElements, 1); |
@@ -1308,8 +1308,8 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { |
// Complex clip (iior=false, normal bounds). |
name.printf("Complex clip test, iter %i", i); |
stack.reset(); |
- stack.clipDevRect(rect, SkRegion::kIntersect_Op, true); |
- stack.clipDevRect(innerRect, SkRegion::kXOR_Op, true); |
+ stack.clipDevRect(rect, SkCanvas::kIntersect_Op, true); |
+ stack.clipDevRect(innerRect, SkCanvas::kXOR_Op, true); |
test_aa_query(reporter, name, stack, m, {l, t, r, b}, ClipMethod::kSkipDraw); |
test_aa_query(reporter, name, stack, m, {r-.1f, t, R, b}, ClipMethod::kAAElements, 1); |
test_aa_query(reporter, name, stack, m, {r-.1f, t, R+.1f, b}, ClipMethod::kAAElements, 2); |
@@ -1320,8 +1320,8 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) { |
// Complex clip where outer rect is pixel aligned (iior=false, normal bounds). |
name.printf("Aligned Complex clip test, iter %i", i); |
stack.reset(); |
- stack.clipDevRect(alignedRect, SkRegion::kIntersect_Op, true); |
- stack.clipDevRect(innerRect, SkRegion::kXOR_Op, true); |
+ stack.clipDevRect(alignedRect, SkCanvas::kIntersect_Op, true); |
+ stack.clipDevRect(innerRect, SkCanvas::kXOR_Op, true); |
test_aa_query(reporter, name, stack, m, {l, t, r, b}, ClipMethod::kSkipDraw); |
test_aa_query(reporter, name, stack, m, {l, b-.1f, r, IB}, ClipMethod::kAAElements, 1); |
test_aa_query(reporter, name, stack, m, {l, b-.1f, r, IB+.1f}, ClipMethod::kAAElements, 1); |
@@ -1362,7 +1362,7 @@ DEF_TEST(ClipStack, reporter) { |
{ 0, 0, 75, 75 } |
}; |
for (size_t i = 0; i < SK_ARRAY_COUNT(gRects); i++) { |
- stack.clipDevRect(gRects[i], SkRegion::kIntersect_Op); |
+ stack.clipDevRect(gRects[i], SkCanvas::kIntersect_Op); |
} |
// all of the above rects should have been intersected, leaving only 1 rect |
@@ -1373,7 +1373,7 @@ DEF_TEST(ClipStack, reporter) { |
REPORTER_ASSERT(reporter, element); |
REPORTER_ASSERT(reporter, SkClipStack::Element::kRect_Type == element->getType()); |
- REPORTER_ASSERT(reporter, SkRegion::kIntersect_Op == element->getOp()); |
+ REPORTER_ASSERT(reporter, SkCanvas::kIntersect_Op == element->getOp()); |
REPORTER_ASSERT(reporter, element->getRect() == answer); |
// now check that we only had one in our iterator |
REPORTER_ASSERT(reporter, !iter.next()); |