10#if !defined(SK_BUILD_FOR_GOOGLE3)
28 const SkRect& expected_bounds,
29 const SkRect& expected_inval_bounds,
30 const std::vector<SkRect>* expected_damage) {
35 SkDebugf(
"** bbox: [%f %f %f %f], ibbox: [%f %f %f %f]\n",
36 bbox.fLeft, bbox.fTop, bbox.fRight, bbox.fBottom,
43 if (expected_damage) {
44 const auto damage_count = SkTo<size_t>(ic.
end() - ic.
begin());
46 for (
size_t i = 0;
i <
std::min(expected_damage->size(), damage_count); ++
i) {
47 const auto r1 = (*expected_damage)[
i],
50 SkDebugf(
"*** expected inval: [%f %f %f %f], actual: [%f %f %f %f]\n",
51 r1.left(), r1.top(), r1.right(), r1.bottom(),
52 r2.left(), r2.top(), r2.right(), r2.bottom());
65 const std::vector<HitTest>&
tests) {
66 for (
const auto& tst :
tests) {
67 const auto* node =
root->nodeAt(tst.pt);
68 if (node != tst.node.get()) {
69 SkDebugf(
"*** nodeAt(%f, %f) - expected %p, got %p\n",
70 tst.pt.x(), tst.pt.y(), tst.node.get(), node);
97 {{ -1, 0 },
nullptr },
98 {{ 0, -1 },
nullptr },
99 {{ 100, 0 },
nullptr },
100 {{ 0, 100 },
nullptr },
108 r2->setL(200); r2->setT(100); r2->setR(300); r2->setB(200);
109 std::vector<SkRect> damage = { {0, 0, 100, 100}, { 200, 100, 300, 200} };
116 {{ -1, 0 },
nullptr },
117 {{ 0, -1 },
nullptr },
118 {{ 100, 0 },
nullptr },
119 {{ 0, 100 },
nullptr },
123 {{ 199, 100 },
nullptr },
124 {{ 200, 99 },
nullptr },
125 {{ 300, 100 },
nullptr },
126 {{ 200, 200 },
nullptr },
134 color->setColor(0xffff0000);
135 std::vector<SkRect> damage = { {0, 0, 100, 100}, { 200, 100, 300, 200} };
145 std::vector<SkRect> damage = { {0, 0, 100, 100}, { 0, 0, 50, 100} };
152 {{ -1, 0 },
nullptr },
153 {{ 0, -1 },
nullptr },
154 {{ 50, 0 },
nullptr },
155 {{ 0, 100 },
nullptr },
159 {{ 199, 100 },
nullptr },
160 {{ 200, 99 },
nullptr },
161 {{ 300, 100 },
nullptr },
162 {{ 200, 200 },
nullptr },
171 std::vector<SkRect> damage = { {0, 0, 300, 200}, { 0, 0, 600, 400} };
178 {{ -1, 0 },
nullptr },
179 {{ 0, -1 },
nullptr },
180 {{ 25, 0 },
nullptr },
181 {{ 0, 50 },
nullptr },
185 {{ 99, 50 },
nullptr },
186 {{ 100, 49 },
nullptr },
187 {{ 150, 50 },
nullptr },
188 {{ 100, 100 },
nullptr },
197 std::vector<SkRect> damage = { {400, 200, 600, 400}, { 400, 200, 500, 400} };
204 {{ -1, 0 },
nullptr },
205 {{ 0, -1 },
nullptr },
206 {{ 25, 0 },
nullptr },
207 {{ 0, 50 },
nullptr },
211 {{ 99, 50 },
nullptr },
212 {{ 100, 49 },
nullptr },
213 {{ 125, 50 },
nullptr },
214 {{ 100, 100 },
nullptr },
243 color->setColor(0xffff0000);
244 std::vector<SkRect> damage = { {0, 0, 100, 100}, { 0, 0, 100, 100} };
254 std::vector<SkRect> damage = { {0, 0, 100, 100}, { 0, 0, 200, 200} };
264 std::vector<SkRect> damage = { { 0, 0, 200, 200},
265 { 100, 100, 300, 300},
267 { 100, 100, 200, 200} };
277 std::vector<SkRect> damage = { { 100, 100, 300, 300},
278 { 100, 100, 200, 300},
279 { 100, 100, 200, 200},
280 { 100, 100, 150, 200} };
298 filter->setOffset({50, 75});
312 std::vector<SkRect> damage = { {0, 0, 350, 175}, { 50, 75, 350, 175} };
321 color1->setColor(0xffff0000);
322 std::vector<SkRect> damage = { { 50, 75, 350, 175} };
331 group->setVisible(
false);
332 std::vector<SkRect> damage = { { 50, 75, 350, 175} };
347 grp->removeChild(
draw);
static void inval_test3(skiatest::Reporter *reporter)
static void inval_group_remove(skiatest::Reporter *reporter)
static void check_inval(skiatest::Reporter *reporter, const sk_sp< sksg::Node > &root, const SkRect &expected_bounds, const SkRect &expected_inval_bounds, const std::vector< SkRect > *expected_damage)
static void inval_test1(skiatest::Reporter *reporter)
static void inval_test2(skiatest::Reporter *reporter)
DEF_TEST(SGInvalidation, reporter)
static void check_hittest(skiatest::Reporter *reporter, const sk_sp< sksg::RenderNode > &root, const std::vector< HitTest > &tests)
constexpr SkColor SK_ColorBLACK
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define REPORTER_ASSERT(r, cond,...)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
static const SkMatrix & I()
static SkRect MakeLargeS32()
static sk_sp< Color > Make(SkColor c)
static sk_sp< Draw > Make(sk_sp< GeometryNode > geo, sk_sp< PaintNode > paint)
static sk_sp< DropShadowImageFilter > Make()
static sk_sp< Group > Make()
static sk_sp< RenderNode > Make(sk_sp< RenderNode > child, sk_sp< ImageFilter > filter)
const SkRect & bounds() const
static sk_sp< Matrix > Make(const T &m)
static sk_sp< Rect > Make()
static float min(float r, float g, float b)
unsigned useCenter Optional< SkMatrix > matrix
sk_sp< SkBlender > blender SkRect rect
sk_sp< sksg::RenderNode > node
constexpr float left() const
constexpr float top() const
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
constexpr float right() const
static constexpr SkRect MakeWH(float w, float h)
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
constexpr float bottom() const