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);