Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: dm/DMSrcSink.cpp

Issue 1865143002: Fix lazy coding in ViaSingletonPictures. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cast Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/patch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 08629675540a84a75c37790014de39327b1cf703..815a728266bad8d41ce17fac57223abc5d18d431 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1450,6 +1450,7 @@ Error ViaTwice::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStri
struct DrawsAsSingletonPictures {
SkCanvas* fCanvas;
const SkDrawableList& fDrawables;
+ SkRect fBounds;
template <typename T>
void draw(const T& op, SkCanvas* canvas) {
@@ -1464,7 +1465,7 @@ struct DrawsAsSingletonPictures {
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 @@ Error ViaSingletonPictures::draw(
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);
« no previous file with comments | « no previous file | gm/patch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698