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

Unified Diff: ui/compositor/paint_recorder.cc

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: nits Created 3 years, 6 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..fb9d018012c3b3927635fa87ddb7854a4d0a9429 100644
--- a/ui/compositor/paint_recorder.cc
+++ b/ui/compositor/paint_recorder.cc
@@ -32,16 +32,25 @@ PaintRecorder::PaintRecorder(const PaintContext& context,
DCHECK(!context.inside_paint_recorder_);
context.inside_paint_recorder_ = true;
#endif
+ if (context_.IsPixelCanvas()) {
+ canvas()->Save();
+ canvas()->Scale(context.effective_scale_factor_x(),
+ context.effective_scale_factor_y());
+ }
}
PaintRecorder::PaintRecorder(const PaintContext& context,
const gfx::Size& recording_size)
- : PaintRecorder(context, recording_size, nullptr) {}
+ : PaintRecorder(context,
+ context.ScaleToCorneredPixelSize(recording_size),
+ 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