Chromium Code Reviews| Index: ui/compositor/paint_recorder.cc |
| diff --git a/ui/compositor/paint_recorder.cc b/ui/compositor/paint_recorder.cc |
| index 8a8c4c28caf55c97e0c6cc0c0bc55e86f98430cc..e3ac08d17b93f8dd6f9cc76c0053363eb23533c0 100644 |
| --- a/ui/compositor/paint_recorder.cc |
| +++ b/ui/compositor/paint_recorder.cc |
| @@ -21,27 +21,41 @@ namespace ui { |
| // to the |context|'s PaintOpBuffer. |
| PaintRecorder::PaintRecorder(const PaintContext& context, |
| const gfx::Size& recording_size, |
| + const gfx::PointF recording_scale, |
| PaintCache* cache) |
| : context_(context), |
| record_canvas_(cache ? cache->ResetCache() : context_.list_->StartPaint(), |
| gfx::RectToSkRect(gfx::Rect(recording_size))), |
| - canvas_(&record_canvas_, context.device_scale_factor_), |
| + canvas_(&record_canvas_, context_.device_scale_factor_), |
|
danakj
2017/07/25 17:58:56
why these changes?
malaykeshav
2017/07/25 22:57:58
Done
|
| cache_(cache), |
| recording_size_(recording_size) { |
| #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 (context_.is_pixel_canvas()) { |
| + canvas()->Save(); |
| + canvas()->Scale(recording_scale.x(), recording_scale.y()); |
| + } |
| } |
| PaintRecorder::PaintRecorder(const PaintContext& context, |
| const gfx::Size& recording_size) |
| - : PaintRecorder(context, recording_size, nullptr) {} |
| + : PaintRecorder( |
| + context, |
| + gfx::ScaleToRoundedSize( |
|
danakj
2017/07/25 17:58:56
Why is this constructor changing the recording_siz
malaykeshav
2017/07/25 22:57:58
There are 32 occurrences to this and they need to
danakj
2017/07/26 16:06:03
Can you add a TODO that explains this and points t
|
| + recording_size, |
| + context.is_pixel_canvas() ? context.device_scale_factor_ : 1.f), |
| + gfx::PointF(context.device_scale_factor_, |
| + context.device_scale_factor_), |
| + nullptr) {} |
| PaintRecorder::~PaintRecorder() { |
| #if DCHECK_IS_ON() |
| context_.inside_paint_recorder_ = false; |
| #endif |
| + if (context_.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. |