Fix lazy coding in ViaSingletonPictures.
I was using SkRect::MakeLargest() as bounds, which is sort of nutso,
as that clearly is way out of bounds for how big a picture can feasibly
be, i.e. something closer to SkIRect::MakeLargest().
This was causing spurious quick rejects in drawPatch(). I didn't really
look much deeper to figure out why. It's easy enough to just feed it the
proper bounds of the entire content.
This means patch_primitive draws correctly in sp-8888 mode.
I also noticed the GM was too small... it clipped off most of its content.
So I've made it larger.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1865143002
Review URL: https://codereview.chromium.org/1865143002
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 0862967..815a728 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1450,6 +1450,7 @@
struct DrawsAsSingletonPictures {
SkCanvas* fCanvas;
const SkDrawableList& fDrawables;
+ SkRect fBounds;
template <typename T>
void draw(const T& op, SkCanvas* canvas) {
@@ -1464,7 +1465,7 @@
template <typename T>
SK_WHEN(T::kTags & SkRecords::kDraw_Tag, void) operator()(const T& op) {
SkPictureRecorder rec;
- this->draw(op, rec.beginRecording(SkRect::MakeLargest()));
+ this->draw(op, rec.beginRecording(fBounds));
sk_sp<SkPicture> pic(rec.finishRecordingAsPicture());
fCanvas->drawPicture(pic);
}
@@ -1501,6 +1502,7 @@
DrawsAsSingletonPictures drawsAsSingletonPictures = {
macroCanvas,
drawables ? *drawables : empty,
+ SkRect::MakeWH((SkScalar)size.width(), (SkScalar)size.height()),
};
for (int i = 0; i < skr.count(); i++) {
skr.visit(i, drawsAsSingletonPictures);
diff --git a/gm/patch.cpp b/gm/patch.cpp
index 40eb46f..6b2d298 100644
--- a/gm/patch.cpp
+++ b/gm/patch.cpp
@@ -63,7 +63,7 @@
canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, right + 1, paint);
}
-DEF_SIMPLE_GM(patch_primitive, canvas, 800, 800) {
+DEF_SIMPLE_GM(patch_primitive, canvas, 1500, 1100) {
SkPaint paint;
// The order of the colors and points is clockwise starting at upper-left corner.
diff --git a/tools/dm_flags.json b/tools/dm_flags.json
index d986f1d..7a45492 100644
--- a/tools/dm_flags.json
+++ b/tools/dm_flags.json
@@ -157,10 +157,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -321,10 +317,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -582,10 +574,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -841,10 +829,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -1103,10 +1087,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -1358,10 +1338,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -1615,10 +1591,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -1868,10 +1840,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -2068,10 +2036,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -2361,10 +2325,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -2530,10 +2490,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -2702,10 +2658,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -2891,10 +2843,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -3079,10 +3027,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
@@ -3393,10 +3337,6 @@
"sp-8888",
"gm",
"_",
- "patch_primitive",
- "sp-8888",
- "gm",
- "_",
"image-cacherator-from-picture",
"pic-8888",
"gm",
diff --git a/tools/dm_flags.py b/tools/dm_flags.py
index b7a24bb..688d1ac 100755
--- a/tools/dm_flags.py
+++ b/tools/dm_flags.py
@@ -176,8 +176,6 @@
blacklist.extend([ 'sp-8888', 'gm', '_', test])
blacklist.extend([ 'pic-8888', 'gm', '_', test])
blacklist.extend(['2ndpic-8888', 'gm', '_', test])
- for test in ['patch_primitive']:
- blacklist.extend(['sp-8888', 'gm', '_', test])
# skia:4703
for test in ['image-cacherator-from-picture',
'image-cacherator-from-raster',