Lines Matching full:stack
31 // Build up a clip stack with a path, an empty clip, and a rect. in test_assign_and_comparison()
122 static void assert_count(skiatest::Reporter* reporter, const SkClipStack& stack, in assert_count() argument
124 SkClipStack::B2TIter iter(stack); in assert_count()
135 SkClipStack stack; in test_iterators() local
146 stack.clipRect(gRects[i], SkMatrix::I(), SkClipOp::kDifference, false); in test_iterators()
149 assert_count(reporter, stack, 4); in test_iterators()
155 SkClipStack::B2TIter iter(stack); in test_iterators()
171 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); in test_iterators()
187 SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); in test_iterators()
237 SkClipStack stack; in test_bounds() local
246 stack.save(); in test_bounds()
261 stack.clipRect(rectA, SkMatrix::I(), SkClipOp::kIntersect, false); in test_bounds()
262 stack.clipRect(rectB, SkMatrix::I(), gOps[op], false); in test_bounds()
265 stack.clipRRect(rrectA, SkMatrix::I(), SkClipOp::kIntersect, false); in test_bounds()
266 stack.clipRRect(rrectB, SkMatrix::I(), gOps[op], false); in test_bounds()
269 stack.clipPath(pathA, SkMatrix::I(), SkClipOp::kIntersect, false); in test_bounds()
270 stack.clipPath(pathB, SkMatrix::I(), gOps[op], false); in test_bounds()
274 REPORTER_ASSERT(reporter, !stack.isWideOpen()); in test_bounds()
275 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID != stack.getTopmostGenID()); in test_bounds()
277 stack.getConservativeBounds(0, 0, 100, 100, &devClipBound, in test_bounds()
291 stack.restore(); in test_bounds()
299 // Empty stack is wide open. Wide open stack means that gen id is wide open. in test_isWideOpen()
300 SkClipStack stack; in test_isWideOpen() local
301 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
302 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
310 // Stack should initially be wide open in test_isWideOpen()
312 SkClipStack stack; in test_isWideOpen() local
314 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
315 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
320 SkClipStack stack; in test_isWideOpen() local
325 stack.clipRect(emptyRect, SkMatrix::I(), SkClipOp::kDifference, false); in test_isWideOpen()
327 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
328 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
333 SkClipStack stack; in test_isWideOpen() local
335 stack.save(); in test_isWideOpen()
337 stack.clipRect(rectA, SkMatrix::I(), SkClipOp::kIntersect, false); in test_isWideOpen()
339 REPORTER_ASSERT(reporter, !stack.isWideOpen()); in test_isWideOpen()
340 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID != stack.getTopmostGenID()); in test_isWideOpen()
342 stack.restore(); in test_isWideOpen()
344 REPORTER_ASSERT(reporter, stack.isWideOpen()); in test_isWideOpen()
345 REPORTER_ASSERT(reporter, SkClipStack::kWideOpenGenID == stack.getTopmostGenID()); in test_isWideOpen()
349 static int count(const SkClipStack& stack) { in count() argument
351 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); in count()
369 SkClipStack stack; in test_rect_inverse_fill() local
370 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_inverse_fill()
374 stack.getBounds(&bounds, &boundsType); in test_rect_inverse_fill()
388 // the stack depth. BW replacing BW. in test_rect_replace()
390 SkClipStack stack; in test_rect_replace() local
391 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
392 stack.replaceClip(rect, false); in test_rect_replace()
393 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
394 stack.replaceClip(rect, false); in test_rect_replace()
395 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
399 // the stack depth. AA replacing AA. in test_rect_replace()
401 SkClipStack stack; in test_rect_replace() local
402 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
403 stack.replaceClip(rect, true); in test_rect_replace()
404 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
405 stack.replaceClip(rect, true); in test_rect_replace()
406 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
410 // the stack depth. BW replacing AA replacing BW. in test_rect_replace()
412 SkClipStack stack; in test_rect_replace() local
413 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_rect_replace()
414 stack.replaceClip(rect, false); in test_rect_replace()
415 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
416 stack.replaceClip(rect, true); in test_rect_replace()
417 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
418 stack.replaceClip(rect, false); in test_rect_replace()
419 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
424 SkClipStack stack; in test_rect_replace() local
425 stack.replaceClip(rect, false); in test_rect_replace()
426 stack.clipRect(rect2, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_replace()
427 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
429 stack.save(); in test_rect_replace()
430 stack.replaceClip(rect, false); in test_rect_replace()
431 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_replace()
432 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_replace()
434 stack.restore(); in test_rect_replace()
435 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
437 stack.save(); in test_rect_replace()
438 stack.replaceClip(rect, false); 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.restore(); in test_rect_replace()
442 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
444 stack.save(); in test_rect_replace()
445 stack.replaceClip(rect, false); in test_rect_replace()
446 stack.clipRect(rect2, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_replace()
447 stack.replaceClip(rect, false); in test_rect_replace()
448 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_replace()
449 stack.restore(); in test_rect_replace()
450 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_replace()
456 auto replacePath = [](SkClipStack* stack, const SkPath& path, bool doAA) { in test_path_replace() argument
458 stack->replaceClip(wideOpen, false); in test_path_replace()
459 stack->clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, doAA); in test_path_replace()
467 // combine with prior elements, but the subsequent intersect cannot be combined so the stack in test_path_replace()
470 SkClipStack stack; in test_path_replace() local
471 REPORTER_ASSERT(reporter, 0 == count(stack)); in test_path_replace()
472 replacePath(&stack, path, false); in test_path_replace()
473 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_path_replace()
474 replacePath(&stack, path, false); in test_path_replace()
475 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_path_replace()
480 SkClipStack stack; in test_path_replace() local
481 stack.replaceClip(rect, true); in test_path_replace()
482 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_path_replace()
483 replacePath(&stack, path, true); in test_path_replace()
484 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_path_replace()
504 SkClipStack stack; in test_rect_merging() local
505 stack.clipRect(overlapLeft, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
506 stack.clipRect(overlapRight, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
508 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
510 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
517 SkClipStack stack; in test_rect_merging() local
518 stack.clipRect(overlapLeft, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
519 stack.clipRect(overlapRight, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
521 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
523 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
530 SkClipStack stack; in test_rect_merging() local
531 stack.clipRect(overlapLeft, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
532 stack.clipRect(overlapRight, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
534 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_merging()
536 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
543 SkClipStack stack; in test_rect_merging() local
544 stack.clipRect(nestedParent, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
545 stack.clipRect(nestedChild, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
547 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
549 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
556 SkClipStack stack; in test_rect_merging() local
557 stack.clipRect(nestedParent, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
558 stack.clipRect(nestedChild, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
560 REPORTER_ASSERT(reporter, 1 == count(stack)); in test_rect_merging()
562 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
569 SkClipStack stack; in test_rect_merging() local
570 stack.clipRect(nestedChild, SkMatrix::I(), SkClipOp::kIntersect, false); in test_rect_merging()
571 stack.clipRect(nestedParent, SkMatrix::I(), SkClipOp::kIntersect, true); in test_rect_merging()
573 REPORTER_ASSERT(reporter, 2 == count(stack)); in test_rect_merging()
575 stack.getBounds(&bound, &type, &isIntersectionOfRects); in test_rect_merging()
598 SkClipStack stack; in test_quickContains() local
599 stack.clipRect(outsideRect, SkMatrix::I(), SkClipOp::kDifference, false); in test_quickContains()
601 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
606 SkClipStack stack; in test_quickContains() local
607 stack.replaceClip(outsideRect, false); in test_quickContains()
608 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
612 SkClipStack stack; in test_quickContains() local
613 stack.clipRect(insideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
614 stack.save(); // To prevent in-place substitution by replace OP in test_quickContains()
615 stack.replaceClip(outsideRect, false); in test_quickContains()
616 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
617 stack.restore(); in test_quickContains()
621 SkClipStack stack; in test_quickContains() local
622 stack.clipRect(outsideRect, 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(insideRect, false); in test_quickContains()
625 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
626 stack.restore(); in test_quickContains()
631 SkClipStack stack; in test_quickContains() local
632 stack.clipRect(insideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
634 stack.clipPath(outsideCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
635 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
640 SkClipStack stack; in test_quickContains() local
641 stack.clipRect(outsideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
642 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
646 SkClipStack stack; in test_quickContains() local
647 stack.clipRect(insideRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
648 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
652 SkClipStack stack; in test_quickContains() local
653 stack.clipRect(intersectingRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
654 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
658 SkClipStack stack; in test_quickContains() local
659 stack.clipRect(nonIntersectingRect, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
660 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
665 SkClipStack stack; in test_quickContains() local
666 stack.clipPath(outsideCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
667 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
671 SkClipStack stack; in test_quickContains() local
672 stack.clipPath(insideCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
673 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
677 SkClipStack stack; in test_quickContains() local
678 stack.clipPath(intersectingCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
679 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
683 SkClipStack stack; in test_quickContains() local
684 stack.clipPath(nonIntersectingCircle, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
685 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
690 SkClipStack stack; in test_quickContains() local
694 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
695 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, true == stack.quickContains(testRect)); in test_quickContains()
727 SkClipStack stack; in test_quickContains() local
730 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
731 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
735 SkClipStack stack; in test_quickContains() local
738 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
739 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
743 SkClipStack stack; in test_quickContains() local
746 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
747 REPORTER_ASSERT(reporter, false == stack.quickContains(testRect)); in test_quickContains()
751 SkClipStack stack; in test_quickContains() local
754 stack.clipPath(path, SkMatrix::I(), SkClipOp::kIntersect, false); in test_quickContains()
755 REPORTER_ASSERT(reporter, true == stack.quickContains(testRect)); in test_quickContains()
759 static void set_region_to_stack(const SkClipStack& stack, const SkIRect& bounds, SkRegion* region) { in set_region_to_stack() argument
761 SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); in set_region_to_stack()
783 SkClipStack stack; in test_invfill_diff_bug() local
784 stack.clipRect({10, 10, 20, 20}, SkMatrix::I(), SkClipOp::kIntersect, false); in test_invfill_diff_bug()
789 stack.clipPath(path, SkMatrix::I(), SkClipOp::kDifference, false); in test_invfill_diff_bug()
791 REPORTER_ASSERT(reporter, SkClipStack::kEmptyGenID == stack.getTopmostGenID()); in test_invfill_diff_bug()
795 stack.getBounds(&stackBounds, &stackBoundsType); in test_invfill_diff_bug()
801 set_region_to_stack(stack, {0, 0, 50, 30}, ®ion); in test_invfill_diff_bug()
812 SkClipStack stack; in test_is_rrect_deep_rect_stack() local
814 stack.save(); in test_is_rrect_deep_rect_stack()
815 stack.clipRect(SkRect::MakeLTRB(i, 0.5, kTargetBounds.width(), kTargetBounds.height()), in test_is_rrect_deep_rect_stack()
822 if (stack.isRRect(kTargetBounds, &rrect, &isAA)) { in test_is_rrect_deep_rect_stack()
830 SkClipStack stack; in test_is_rrect_deep_rect_stack() local
834 stack.save(); in test_is_rrect_deep_rect_stack()
835 stack.clipRect(SkRect::MakeLTRB(i, j + 0.5, kTargetBounds.width(), kTargetBounds.height()), in test_is_rrect_deep_rect_stack()
840 REPORTER_ASSERT(reporter, !stack.isRRect(kTargetBounds, &rrect, &isAA)); in test_is_rrect_deep_rect_stack()
844 SkClipStack stack; in DEF_TEST() local
846 REPORTER_ASSERT(reporter, 0 == stack.getSaveCount()); in DEF_TEST()
847 assert_count(reporter, stack, 0); in DEF_TEST()
856 stack.clipDevRect(gRects[i], SkClipOp::kIntersect); in DEF_TEST()
860 SkClipStack::B2TIter iter(stack); in DEF_TEST()
873 stack.reset(); in DEF_TEST()
874 REPORTER_ASSERT(reporter, 0 == stack.getSaveCount()); in DEF_TEST()
875 assert_count(reporter, stack, 0); in DEF_TEST()