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

Unified Diff: ui/compositor/paint_recorder.cc

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Resolving comments Created 3 years, 5 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
Index: ui/compositor/paint_recorder.cc
diff --git a/ui/compositor/paint_recorder.cc b/ui/compositor/paint_recorder.cc
index 8a8c4c28caf55c97e0c6cc0c0bc55e86f98430cc..e1cb2807176bf93e943b48423633af44ec44e014 100644
--- a/ui/compositor/paint_recorder.cc
+++ b/ui/compositor/paint_recorder.cc
@@ -32,16 +32,27 @@ PaintRecorder::PaintRecorder(const PaintContext& context,
DCHECK(!context.inside_paint_recorder_);
context.inside_paint_recorder_ = true;
#endif
+ if (context_.IsPixelCanvas()) {
+ canvas()->Save();
+ canvas()->Scale(context.paint_recording_scale_x_,
+ context.paint_recording_scale_y_);
+ }
}
PaintRecorder::PaintRecorder(const PaintContext& context,
const gfx::Size& recording_size)
- : PaintRecorder(context, recording_size, nullptr) {}
+ : PaintRecorder(context,
+ gfx::ScaleToRoundedSize(recording_size,
+ context.paint_recording_scale_x_,
+ context.paint_recording_scale_y_),
+ nullptr) {}
PaintRecorder::~PaintRecorder() {
#if DCHECK_IS_ON()
context_.inside_paint_recorder_ = false;
#endif
+ if (context_.IsPixelCanvas())
+ canvas()->Restore();
// If using cache, append what we've saved there to the PaintContext.
// Otherwise, the content is already stored in the PaintContext, and we can
// just close it.

Powered by Google App Engine
This is Rietveld 408576698