Index: ui/compositor/paint_recorder.cc |
diff --git a/ui/compositor/paint_recorder.cc b/ui/compositor/paint_recorder.cc |
index 8a8c4c28caf55c97e0c6cc0c0bc55e86f98430cc..c3c99d12e6812368504d0ee7e80975f8cb643072 100644 |
--- a/ui/compositor/paint_recorder.cc |
+++ b/ui/compositor/paint_recorder.cc |
@@ -9,6 +9,7 @@ |
#include "third_party/skia/include/core/SkRefCnt.h" |
#include "ui/compositor/paint_cache.h" |
#include "ui/compositor/paint_context.h" |
+#include "ui/compositor/paint_info.h" |
#include "ui/gfx/skia_util.h" |
namespace ui { |
@@ -19,29 +20,35 @@ namespace ui { |
// If a |cache| is provided, this records into the |cache|'s PaintOpBuffer |
// directly, then appends that to the |context|. If not, then this records |
// to the |context|'s PaintOpBuffer. |
-PaintRecorder::PaintRecorder(const PaintContext& context, |
- const gfx::Size& recording_size, |
- PaintCache* cache) |
- : context_(context), |
+PaintRecorder::PaintRecorder(const PaintInfo& info, PaintCache* cache) |
danakj
2017/07/21 17:29:39
Can you pass in the various things it needs here i
malaykeshav
2017/07/21 23:30:17
Done
|
+ : context_(info.context()), |
record_canvas_(cache ? cache->ResetCache() : context_.list_->StartPaint(), |
- gfx::RectToSkRect(gfx::Rect(recording_size))), |
- canvas_(&record_canvas_, context.device_scale_factor_), |
+ gfx::RectToSkRect(gfx::Rect(info.paint_recording_size()))), |
+ canvas_(&record_canvas_, context_.device_scale_factor_), |
cache_(cache), |
- recording_size_(recording_size) { |
+ recording_size_(info.paint_recording_size()), |
+ is_pixel_canvas_(info.IsPixelCanvas()) { |
#if DCHECK_IS_ON() |
- DCHECK(!context.inside_paint_recorder_); |
- context.inside_paint_recorder_ = true; |
+ DCHECK(!context_.inside_paint_recorder_); |
+ context_.inside_paint_recorder_ = true; |
#endif |
+ if (is_pixel_canvas_) { |
+ canvas()->Save(); |
+ canvas()->Scale(info.paint_recording_scale().x(), |
+ info.paint_recording_scale().y()); |
+ } |
} |
PaintRecorder::PaintRecorder(const PaintContext& context, |
const gfx::Size& recording_size) |
- : PaintRecorder(context, recording_size, nullptr) {} |
+ : PaintRecorder(PaintInfo(context, recording_size), nullptr) {} |
PaintRecorder::~PaintRecorder() { |
#if DCHECK_IS_ON() |
context_.inside_paint_recorder_ = false; |
#endif |
+ if (is_pixel_canvas_) |
+ 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. |