Lines Matching full:stack
40 // Build up a clip stack with a path, an empty clip, and a rect. in test_assign_and_comparison()
131 static void assert_count(skiatest::Reporter* reporter, const SkClipStack& stack, in assert_count() argument
133 SkClipStack::B2TIter iter(stack); in assert_count()
144 SkClipStack stack; in test_iterators() local
155 stack.clipRect(gRects[i], SkMatrix::I(), SkClipOp::kDifference, false); in test_iterators()
158 assert_count(reporter, stack, 4); in test_iterators()
164 SkClipStack::B2TIter iter(stack); in test_iterators()
180 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); in test_iterators()
196 SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); in test_iterators()
246 SkClipStack stack; in test_bounds() local
255 stack.save(); in test_bounds()
270 stack.clipRect(rectA, SkMatrix::I(), SkClipOp::kIntersect, false); in test_bounds()
271 stack.clipRect(rectB, SkMatrix::I(), gOps[op], false); in test_bounds()
274 stack.clipRRect(rrectA, SkMatrix::I(), SkClipOp::kIntersect, false); in test_bounds()
275 stack.clipRRect(rrectB, SkMatrix::I(), gOps[op], false); in test_bounds()
278 stack.clipPath(pathA, SkMatrix::I(), SkClipOp::kIntersect, false); in test_bounds()
279 stack.clipPath(pathB, SkMatrix::I(), gOps[op], false); in test_bounds()
283 REPORTER_ASSERT(reporter, !stack.isWideOpen()); in test_bounds()
284 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID != stack.getTopmostGenID()); in test_bounds()
286 stack.getConservativeBounds(0, 0, 100, 100, &devClipBound, in test_bounds()
300 stack.restore(); in test_bounds()
308 // Empty stack is wide open. Wide open stack means that gen id is wide open. in test_isWideOpen()
309 SkClipStack stack; in test_isWideOpen() local
310 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
311 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
319 // Stack should initially be wide open in test_isWideOpen()
321 SkClipStack stack; in test_isWideOpen() local
323 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
324 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
329 SkClipStack stack; in test_isWideOpen() local
334 stack.clipRect(emptyRect, SkMatrix::I(), SkClipOp::kDifference, false); in test_isWideOpen()
336 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
337 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
342 SkClipStack stack; in test_isWideOpen() local
344 stack.save(); in test_isWideOpen()
346 stack.clipRect(rectA, SkMatrix::I(), SkClipOp::kIntersect, false); in test_isWideOpen()
348 REPORTER_ASSERT(reporter, !stack.isWideOpen()); in test_isWideOpen()
349 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID != stack.getTopmostGenID()); in test_isWideOpen()
351 stack.restore(); in test_isWideOpen()
353 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
354 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
358 static int count(const SkClipStack& stack) { in count() argument
360 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); in count()
378 SkClipStack stack; in test_rect_inverse_fill() local
379 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_inverse_fill()
383 stack.getBounds(&bounds, &boundsType); in test_rect_inverse_fill()
397 // the stack depth. BW replacing BW. in test_rect_replace()
399 SkClipStack stack; in test_rect_replace() local
400 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
401 stack.replaceClip(rect, false); in test_rect_replace()
402 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
403 stack.replaceClip(rect, false); in test_rect_replace()
404 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
408 // the stack depth. AA replacing AA. in test_rect_replace()
410 SkClipStack stack; in test_rect_replace() local
411 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
412 stack.replaceClip(rect, true); in test_rect_replace()
413 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
414 stack.replaceClip(rect, true); in test_rect_replace()
415 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
419 // the stack depth. BW replacing AA replacing BW. in test_rect_replace()
421 SkClipStack stack; in test_rect_replace() local
422 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
423 stack.replaceClip(rect, false); in test_rect_replace()
424 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
425 stack.replaceClip(rect, true); in test_rect_replace()
426 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
427 stack.replaceClip(rect, false); in test_rect_replace()
428 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
433 SkClipStack stack; in test_rect_replace() local
434 stack.replaceClip(rect, false); in test_rect_replace()
435 stack.clipRect(rect2, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_replace()
436 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
438 stack.save(); in test_rect_replace()
439 stack.replaceClip(rect, false); in test_rect_replace()
440 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_replace()
441 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_replace()
443 stack.restore(); in test_rect_replace()
444 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
446 stack.save(); in test_rect_replace()
447 stack.replaceClip(rect, false); in test_rect_replace()
448 stack.replaceClip(rect, false); in test_rect_replace()
449 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_replace()
450 stack.restore(); in test_rect_replace()
451 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
453 stack.save(); in test_rect_replace()
454 stack.replaceClip(rect, false); in test_rect_replace()
455 stack.clipRect(rect2, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_replace()
456 stack.replaceClip(rect, false); in test_rect_replace()
457 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_replace()
458 stack.restore(); in test_rect_replace()
459 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
465 auto replacePath = [](SkClipStack* stack, const SkPath& path, bool doAA) { in test_path_replace() argument
467 stack->replaceClip(wideOpen, false); in test_path_replace()
468 stack->clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, doAA); in test_path_replace()
476 // combine with prior elements, but the subsequent intersect cannot be combined so the stack in test_path_replace()
479 SkClipStack stack; in test_path_replace() local
480 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_path_replace()
481 replacePath(&stack, path, false); in test_path_replace()
482 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_path_replace()
483 replacePath(&stack, path, false); in test_path_replace()
484 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_path_replace()
489 SkClipStack stack; in test_path_replace() local
490 stack.replaceClip(rect, true); in test_path_replace()
491 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_path_replace()
492 replacePath(&stack, path, true); in test_path_replace()
493 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_path_replace()
513 SkClipStack stack; in test_rect_merging() local
514 stack.clipRect(overlapLeft, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
515 stack.clipRect(overlapRight, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
517 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
519 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
526 SkClipStack stack; in test_rect_merging() local
527 stack.clipRect(overlapLeft, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
528 stack.clipRect(overlapRight, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
530 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
532 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
539 SkClipStack stack; in test_rect_merging() local
540 stack.clipRect(overlapLeft, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
541 stack.clipRect(overlapRight, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
543 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_merging()
545 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
552 SkClipStack stack; in test_rect_merging() local
553 stack.clipRect(nestedParent, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
554 stack.clipRect(nestedChild, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
556 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
558 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
565 SkClipStack stack; in test_rect_merging() local
566 stack.clipRect(nestedParent, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
567 stack.clipRect(nestedChild, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
569 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
571 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
578 SkClipStack stack; in test_rect_merging() local
579 stack.clipRect(nestedChild, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
580 stack.clipRect(nestedParent, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
582 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_merging()
584 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
607 SkClipStack stack; in test_quickContains() local
608 stack.clipRect(outsideRect, SkMatrix::I(), SkClipOp::kDifference, false); in test_quickContains()
610 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
615 SkClipStack stack; in test_quickContains() local
616 stack.replaceClip(outsideRect, false); in test_quickContains()
617 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
621 SkClipStack stack; in test_quickContains() local
622 stack.clipRect(insideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
623 stack.save(); // To prevent in-place substitution by replace OP in test_quickContains()
624 stack.replaceClip(outsideRect, false); in test_quickContains()
625 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
626 stack.restore(); in test_quickContains()
630 SkClipStack stack; in test_quickContains() local
631 stack.clipRect(outsideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
632 stack.save(); // To prevent in-place substitution by replace OP in test_quickContains()
633 stack.replaceClip(insideRect, false); in test_quickContains()
634 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
635 stack.restore(); in test_quickContains()
640 SkClipStack stack; in test_quickContains() local
641 stack.clipRect(insideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
643 stack.clipPath(outsideCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
644 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
649 SkClipStack stack; in test_quickContains() local
650 stack.clipRect(outsideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
651 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
655 SkClipStack stack; in test_quickContains() local
656 stack.clipRect(insideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
657 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
661 SkClipStack stack; in test_quickContains() local
662 stack.clipRect(intersectingRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
663 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
667 SkClipStack stack; in test_quickContains() local
668 stack.clipRect(nonIntersectingRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
669 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
674 SkClipStack stack; in test_quickContains() local
675 stack.clipPath(outsideCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
676 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
680 SkClipStack stack; in test_quickContains() local
681 stack.clipPath(insideCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
682 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
686 SkClipStack stack; in test_quickContains() local
687 stack.clipPath(intersectingCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
688 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
692 SkClipStack stack; in test_quickContains() local
693 stack.clipPath(nonIntersectingCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
694 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
699 SkClipStack stack; in test_quickContains() local
703 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
704 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
708 SkClipStack stack; in test_quickContains() local
712 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
713 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
717 SkClipStack stack; in test_quickContains() local
721 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
722 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
726 SkClipStack stack; in test_quickContains() local
730 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
731 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
736 SkClipStack stack; in test_quickContains() local
739 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
740 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
744 SkClipStack stack; in test_quickContains() local
747 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
748 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
752 SkClipStack stack; in test_quickContains() local
755 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
756 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
760 SkClipStack stack; in test_quickContains() local
763 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
764 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
768 static void set_region_to_stack(const SkClipStack& stack, const SkIRect& bounds, SkRegion* region) { in set_region_to_stack() argument
770 SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); in set_region_to_stack()
792 SkClipStack stack; in test_invfill_diff_bug() local
793 stack.clipRect({10, 10, 20, 20}, SkMatrix::I(), SkClipOp::kIntersect, false); in test_invfill_diff_bug()
798 stack.clipPath(path, SkMatrix::I(), SkClipOp::kDifference, false); in test_invfill_diff_bug()
800 REPORTER_ASSERT(reporter, SkClipStack::kEmptyGenID == stack.getTopmostGenID()); in test_invfill_diff_bug()
804 stack.getBounds(&stackBounds, &stackBoundsType); in test_invfill_diff_bug()
810 set_region_to_stack(stack, {0, 0, 50, 30}, ®ion); in test_invfill_diff_bug()
821 SkClipStack stack; in test_is_rrect_deep_rect_stack() local
823 stack.save(); in test_is_rrect_deep_rect_stack()
824 stack.clipRect(SkRect::MakeLTRB(i, 0.5, kTargetBounds.width(), kTargetBounds.height()), in test_is_rrect_deep_rect_stack()
831 if (stack.isRRect(kTargetBounds, &rrect, &isAA)) { in test_is_rrect_deep_rect_stack()
839 SkClipStack stack; in test_is_rrect_deep_rect_stack() local
843 stack.save(); in test_is_rrect_deep_rect_stack()
844 stack.clipRect(SkRect::MakeLTRB(i, j + 0.5, kTargetBounds.width(), kTargetBounds.height()), in test_is_rrect_deep_rect_stack()
849 REPORTER_ASSERT(reporter, !stack.isRRect(kTargetBounds, &rrect, &isAA)); in test_is_rrect_deep_rect_stack()
853 SkClipStack stack; in DEF_TEST() local
855 REPORTER_ASSERT(reporter, 0 == stack.getSaveCount()); in DEF_TEST()
856 assert_count(reporter, stack, 0); in DEF_TEST()
865 stack.clipDevRect(gRects[i], SkClipOp::kIntersect); in DEF_TEST()
869 SkClipStack::B2TIter iter(stack); in DEF_TEST()
882 stack.reset(); in DEF_TEST()
883 REPORTER_ASSERT(reporter, 0 == stack.getSaveCount()); in DEF_TEST()
884 assert_count(reporter, stack, 0); in DEF_TEST()