Lines Matching full:stack

24     // Build up a clip stack with a path, an empty clip, and a rect.  in test_assign_and_comparison()
116 static void assert_count(skiatest::Reporter* reporter, const SkClipStack& stack, in assert_count() argument
118 SkClipStack::B2TIter iter(stack); in assert_count()
129 SkClipStack stack; in test_iterators() local
140 stack.clipDevRect(gRects[i], SkRegion::kUnion_Op, false); in test_iterators()
143 assert_count(reporter, stack, 4); in test_iterators()
149 SkClipStack::B2TIter iter(stack); in test_iterators()
164 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); in test_iterators()
179 SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); in test_iterators()
242 SkClipStack stack; in test_bounds() local
251 stack.save(); in test_bounds()
265 stack.clipDevRect(rectA, SkRegion::kIntersect_Op, false); in test_bounds()
266 stack.clipDevRect(rectB, gOps[op], false); in test_bounds()
269 stack.clipDevRRect(rrectA, SkRegion::kIntersect_Op, false); in test_bounds()
270 stack.clipDevRRect(rrectB, gOps[op], false); in test_bounds()
273 stack.clipDevPath(pathA, SkRegion::kIntersect_Op, false); in test_bounds()
274 stack.clipDevPath(pathB, gOps[op], false); in test_bounds()
278 REPORTER_ASSERT(reporter, !stack.isWideOpen()); in test_bounds()
279 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID != stack.getTopmostGenID()); in test_bounds()
281 stack.getConservativeBounds(0, 0, 100, 100, &devClipBound, in test_bounds()
295 stack.restore(); in test_bounds()
303 // Empty stack is wide open. Wide open stack means that gen id is wide open. in test_isWideOpen()
304 SkClipStack stack; in test_isWideOpen() local
305 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
306 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
314 // Stack should initially be wide open in test_isWideOpen()
316 SkClipStack stack; in test_isWideOpen() local
318 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
319 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
324 SkClipStack stack; in test_isWideOpen() local
334 stack.clipDevPath(clipA, SkRegion::kReplace_Op, false); in test_isWideOpen()
335 stack.clipDevPath(clipB, SkRegion::kUnion_Op, false); in test_isWideOpen()
337 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
338 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
343 SkClipStack stack; in test_isWideOpen() local
345 stack.clipDevRect(rectA, SkRegion::kUnion_Op, false); in test_isWideOpen()
347 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
348 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
353 SkClipStack stack; in test_isWideOpen() local
358 stack.clipDevRect(emptyRect, SkRegion::kDifference_Op, false); in test_isWideOpen()
360 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
361 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
366 SkClipStack stack; in test_isWideOpen() local
368 stack.save(); in test_isWideOpen()
370 stack.clipDevRect(rectA, SkRegion::kReplace_Op, false); in test_isWideOpen()
372 REPORTER_ASSERT(reporter, !stack.isWideOpen()); in test_isWideOpen()
373 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID != stack.getTopmostGenID()); in test_isWideOpen()
375 stack.restore(); in test_isWideOpen()
377 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
378 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
382 static int count(const SkClipStack& stack) { in count() argument
384 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); in count()
403 SkClipStack stack; in test_rect_inverse_fill() local
404 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_rect_inverse_fill()
408 stack.getBounds(&bounds, &boundsType); in test_rect_inverse_fill()
422 // the stack depth. BW replacing BW. in test_rect_replace()
424 SkClipStack stack; in test_rect_replace() local
425 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
426 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
427 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
428 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
429 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
433 // the stack depth. AA replacing AA. in test_rect_replace()
435 SkClipStack stack; in test_rect_replace() local
436 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
437 stack.clipDevRect(rect, SkRegion::kReplace_Op, true); in test_rect_replace()
438 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
439 stack.clipDevRect(rect, SkRegion::kReplace_Op, true); in test_rect_replace()
440 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
444 // the stack depth. BW replacing AA replacing BW. in test_rect_replace()
446 SkClipStack stack; in test_rect_replace() local
447 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
448 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
449 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
450 stack.clipDevRect(rect, SkRegion::kReplace_Op, true); in test_rect_replace()
451 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
452 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
453 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
458 SkClipStack stack; in test_rect_replace() local
459 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
460 stack.clipDevRect(rect2, SkRegion::kIntersect_Op, false); in test_rect_replace()
461 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
463 stack.save(); in test_rect_replace()
464 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
465 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_replace()
466 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_replace()
468 stack.restore(); in test_rect_replace()
469 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
471 stack.save(); in test_rect_replace()
472 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
473 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
474 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_replace()
475 stack.restore(); in test_rect_replace()
476 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
478 stack.save(); in test_rect_replace()
479 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
480 stack.clipDevRect(rect2, SkRegion::kIntersect_Op, false); in test_rect_replace()
481 stack.clipDevRect(rect, SkRegion::kReplace_Op, false); in test_rect_replace()
482 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_replace()
483 stack.restore(); in test_rect_replace()
484 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
494 // Replace operation doesn't grow the stack. in test_path_replace()
496 SkClipStack stack; in test_path_replace() local
497 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_path_replace()
498 stack.clipDevPath(path, SkRegion::kReplace_Op, false); in test_path_replace()
499 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_path_replace()
500 stack.clipDevPath(path, SkRegion::kReplace_Op, false); in test_path_replace()
501 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_path_replace()
506 SkClipStack stack; in test_path_replace() local
507 stack.clipDevRect(rect, SkRegion::kReplace_Op, true); in test_path_replace()
508 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_path_replace()
509 stack.clipDevPath(path, SkRegion::kReplace_Op, true); in test_path_replace()
510 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_path_replace()
530 SkClipStack stack; in test_rect_merging() local
532 stack.clipDevRect(overlapLeft, SkRegion::kReplace_Op, false); in test_rect_merging()
534 stack.clipDevRect(overlapRight, SkRegion::kIntersect_Op, false); in test_rect_merging()
536 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
538 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
545 SkClipStack stack; in test_rect_merging() local
547 stack.clipDevRect(overlapLeft, SkRegion::kReplace_Op, true); in test_rect_merging()
549 stack.clipDevRect(overlapRight, SkRegion::kIntersect_Op, true); in test_rect_merging()
551 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
553 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
560 SkClipStack stack; in test_rect_merging() local
562 stack.clipDevRect(overlapLeft, SkRegion::kReplace_Op, true); in test_rect_merging()
564 stack.clipDevRect(overlapRight, SkRegion::kIntersect_Op, false); in test_rect_merging()
566 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_merging()
568 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
575 SkClipStack stack; in test_rect_merging() local
577 stack.clipDevRect(nestedParent, SkRegion::kReplace_Op, true); in test_rect_merging()
579 stack.clipDevRect(nestedChild, SkRegion::kIntersect_Op, false); in test_rect_merging()
581 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
583 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
590 SkClipStack stack; in test_rect_merging() local
592 stack.clipDevRect(nestedParent, SkRegion::kReplace_Op, false); in test_rect_merging()
594 stack.clipDevRect(nestedChild, SkRegion::kIntersect_Op, true); in test_rect_merging()
596 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
598 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
605 SkClipStack stack; in test_rect_merging() local
607 stack.clipDevRect(nestedChild, SkRegion::kReplace_Op, false); in test_rect_merging()
609 stack.clipDevRect(nestedParent, SkRegion::kIntersect_Op, true); in test_rect_merging()
611 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_merging()
613 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
636 SkClipStack stack; in test_quickContains() local
637 stack.clipDevRect(outsideRect, SkRegion::kDifference_Op, false); in test_quickContains()
639 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
644 SkClipStack stack; in test_quickContains() local
645 stack.clipDevRect(outsideRect, SkRegion::kReplace_Op, false); in test_quickContains()
646 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
650 SkClipStack stack; in test_quickContains() local
651 stack.clipDevRect(insideRect, SkRegion::kIntersect_Op, false); in test_quickContains()
652 stack.save(); // To prevent in-place substitution by replace OP in test_quickContains()
653 stack.clipDevRect(outsideRect, SkRegion::kReplace_Op, false); in test_quickContains()
654 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
655 stack.restore(); in test_quickContains()
659 SkClipStack stack; in test_quickContains() local
660 stack.clipDevRect(outsideRect, SkRegion::kIntersect_Op, false); in test_quickContains()
661 stack.save(); // To prevent in-place substitution by replace OP in test_quickContains()
662 stack.clipDevRect(insideRect, SkRegion::kReplace_Op, false); in test_quickContains()
663 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
664 stack.restore(); in test_quickContains()
669 SkClipStack stack; in test_quickContains() local
670 stack.clipDevRect(insideRect, SkRegion::kIntersect_Op, false); in test_quickContains()
672 stack.clipDevPath(outsideCircle, SkRegion::kIntersect_Op, false); in test_quickContains()
673 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
678 SkClipStack stack; in test_quickContains() local
679 stack.clipDevRect(outsideRect, SkRegion::kIntersect_Op, false); in test_quickContains()
680 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
684 SkClipStack stack; in test_quickContains() local
685 stack.clipDevRect(insideRect, SkRegion::kIntersect_Op, false); in test_quickContains()
686 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
690 SkClipStack stack; in test_quickContains() local
691 stack.clipDevRect(intersectingRect, SkRegion::kIntersect_Op, false); in test_quickContains()
692 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
696 SkClipStack stack; in test_quickContains() local
697 stack.clipDevRect(nonIntersectingRect, SkRegion::kIntersect_Op, false); in test_quickContains()
698 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
703 SkClipStack stack; in test_quickContains() local
704 stack.clipDevPath(outsideCircle, SkRegion::kIntersect_Op, false); in test_quickContains()
705 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
709 SkClipStack stack; in test_quickContains() local
710 stack.clipDevPath(insideCircle, SkRegion::kIntersect_Op, false); in test_quickContains()
711 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
715 SkClipStack stack; in test_quickContains() local
716 stack.clipDevPath(intersectingCircle, SkRegion::kIntersect_Op, false); in test_quickContains()
717 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
721 SkClipStack stack; in test_quickContains() local
722 stack.clipDevPath(nonIntersectingCircle, SkRegion::kIntersect_Op, false); in test_quickContains()
723 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
728 SkClipStack stack; in test_quickContains() local
732 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_quickContains()
733 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
737 SkClipStack stack; in test_quickContains() local
741 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_quickContains()
742 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
746 SkClipStack stack; in test_quickContains() local
750 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_quickContains()
751 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
755 SkClipStack stack; in test_quickContains() local
759 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_quickContains()
760 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
765 SkClipStack stack; in test_quickContains() local
768 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_quickContains()
769 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
773 SkClipStack stack; in test_quickContains() local
776 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_quickContains()
777 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
781 SkClipStack stack; in test_quickContains() local
784 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_quickContains()
785 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
789 SkClipStack stack; in test_quickContains() local
792 stack.clipDevPath(path, SkRegion::kIntersect_Op, false); in test_quickContains()
793 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
800 // Functions that add a shape to the clip stack. The shape is computed from a rectangle.
801 // AA is always disabled since the clip stack reducer can cause changes in aa rasterization of the
802 // stack. A fractional edge repeated in different elements may be rasterized fewer times using the
803 // reduced stack.
807 SkClipStack* stack);
809 static void add_round_rect(const SkRect& rect, bool invert, SkRegion::Op op, SkClipStack* stack) { in add_round_rect() argument
816 stack->clipDevPath(path, op, false); in add_round_rect()
820 stack->clipDevRRect(rrect, op, false); in add_round_rect()
824 static void add_rect(const SkRect& rect, bool invert, SkRegion::Op op, SkClipStack* stack) { in add_rect() argument
829 stack->clipDevPath(path, op, false); in add_rect()
831 stack->clipDevRect(rect, op, false); in add_rect()
835 static void add_oval(const SkRect& rect, bool invert, SkRegion::Op op, SkClipStack* stack) { in add_oval() argument
841 stack->clipDevPath(path, op, false); in add_oval()
844 static void add_elem_to_stack(const SkClipStack::Element& element, SkClipStack* stack) { in add_elem_to_stack() argument
847 stack->clipDevRect(element.getRect(), element.getOp(), element.isAA()); in add_elem_to_stack()
850 stack->clipDevRRect(element.getRRect(), element.getOp(), element.isAA()); in add_elem_to_stack()
853 stack->clipDevPath(element.getPath(), element.getOp(), element.isAA()); in add_elem_to_stack()
857 stack->clipEmpty(); in add_elem_to_stack()
924 // Randomly generate a clip stack. in test_reduced_clip_stack()
925 SkClipStack stack; in test_reduced_clip_stack() local
936 // saves can change the clip stack behavior when an element is added. in test_reduced_clip_stack()
950 kElementFuncs[r.nextULessThan(SK_ARRAY_COUNT(kElementFuncs))](rect, invert, op, &stack); in test_reduced_clip_stack()
952 stack.save(); in test_reduced_clip_stack()
962 // Get the reduced version of the stack. in test_reduced_clip_stack()
968 GrReducedClip::ReduceClipStack(stack, in test_reduced_clip_stack()
977 // Build a new clip stack based on the reduced clip elements in test_reduced_clip_stack()
992 // convert both the original stack and reduced stack to SkRegions and see if they're equal in test_reduced_clip_stack()
998 SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); in test_reduced_clip_stack()
1022 SkClipStack stack; in test_reduced_clip_stack_genid() local
1023 stack.clipDevRect(SkRect::MakeXYWH(0, 0, 100, 100), SkRegion::kReplace_Op, true); in test_reduced_clip_stack_genid()
1024stack.clipDevRect(SkRect::MakeXYWH(0, 0, SkScalar(50.3), SkScalar(50.3)), SkRegion::kReplace_Op, t… in test_reduced_clip_stack_genid()
1032 GrReducedClip::ReduceClipStack(stack, in test_reduced_clip_stack_genid()
1044 SkClipStack stack; in test_reduced_clip_stack_genid() local
1050stack.clipDevRect(SkRect::MakeXYWH(0, 0, SkScalar(25.3), SkScalar(25.3)), SkRegion::kReplace_Op, t… in test_reduced_clip_stack_genid()
1051 int32_t genIDA = stack.getTopmostGenID(); in test_reduced_clip_stack_genid()
1052stack.clipDevRect(SkRect::MakeXYWH(50, 0, SkScalar(25.3), SkScalar(25.3)), SkRegion::kUnion_Op, tr… in test_reduced_clip_stack_genid()
1053 int32_t genIDB = stack.getTopmostGenID(); in test_reduced_clip_stack_genid()
1054stack.clipDevRect(SkRect::MakeXYWH(0, 50, SkScalar(25.3), SkScalar(25.3)), SkRegion::kUnion_Op, tr… in test_reduced_clip_stack_genid()
1055 int32_t genIDC = stack.getTopmostGenID(); in test_reduced_clip_stack_genid()
1056stack.clipDevRect(SkRect::MakeXYWH(50, 50, SkScalar(25.3), SkScalar(25.3)), SkRegion::kUnion_Op, t… in test_reduced_clip_stack_genid()
1057 int32_t genIDD = stack.getTopmostGenID(); in test_reduced_clip_stack_genid()
1127 GrReducedClip::ReduceClipStack(stack, in test_reduced_clip_stack_genid()
1149 SkClipStack stack; in test_reduced_clip_stack_no_aa_crash() local
1150 stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 100, 100), SkRegion::kReplace_Op); in test_reduced_clip_stack_no_aa_crash()
1151 stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 50, 50), SkRegion::kReplace_Op); in test_reduced_clip_stack_no_aa_crash()
1160 GrReducedClip::ReduceClipStack(stack, in test_reduced_clip_stack_no_aa_crash()
1173 SkClipStack stack; in DEF_TEST() local
1175 REPORTER_ASSERT(reporter, 0 == stack.getSaveCount()); in DEF_TEST()
1176 assert_count(reporter, stack, 0); in DEF_TEST()
1185 stack.clipDevRect(gRects[i], SkRegion::kIntersect_Op); in DEF_TEST()
1189 SkClipStack::B2TIter iter(stack); in DEF_TEST()
1201 stack.reset(); in DEF_TEST()
1202 REPORTER_ASSERT(reporter, 0 == stack.getSaveCount()); in DEF_TEST()
1203 assert_count(reporter, stack, 0); in DEF_TEST()