| Index: ui/compositor/paint_recorder.cc
|
| diff --git a/ui/compositor/paint_recorder.cc b/ui/compositor/paint_recorder.cc
|
| index f93d700b37e487a8f3491f3dcd570e3c09b97648..30270cd744da82f6380417632fa235f797bc18fb 100644
|
| --- a/ui/compositor/paint_recorder.cc
|
| +++ b/ui/compositor/paint_recorder.cc
|
| @@ -13,28 +13,54 @@
|
| #include "ui/gfx/skia_util.h"
|
|
|
| namespace ui {
|
| +namespace {
|
| +/*
|
| +gfx::Size ScaleIfNeeded(const gfx::Size& size,
|
| + const PaintContext& context,
|
| + bool is_already_scaled) {
|
| + if (is_already_scaled)
|
| + return size;
|
| + return gfx::ScaleToCeiledSize(size, context.device_scale_factor(),
|
| + context.device_scale_factor());
|
| +}
|
| +*/
|
| +}
|
|
|
| // This class records a reference to the context, the canvas returned
|
| // by its recorder_, and the cache. Thus all 3 of these must remain
|
| // valid for the lifetime of this object.
|
| PaintRecorder::PaintRecorder(const PaintContext& context,
|
| const gfx::Size& recording_size,
|
| - PaintCache* cache)
|
| + PaintCache* cache,
|
| + bool is_scaled)
|
| : context_(context),
|
| - canvas_(context.recorder_->beginRecording(
|
| - gfx::RectToSkRect(gfx::Rect(recording_size))),
|
| - context.device_scale_factor_),
|
| + canvas_(
|
| + context.recorder_->beginRecording(gfx::RectToSkRect(
|
| + gfx::Rect(context.pixel_size()))),
|
| + context.device_scale_factor()),
|
| cache_(cache),
|
| - bounds_in_layer_(context.ToLayerSpaceBounds(recording_size)) {
|
| + bounds_in_layer_(context.ToLayerSpaceBounds(
|
| + context.pixel_size())) {
|
| #if DCHECK_IS_ON()
|
| DCHECK(!context.inside_paint_recorder_);
|
| context.inside_paint_recorder_ = true;
|
| #endif
|
| + if (is_scaled) {
|
| + if (context.pixel_size() != recording_size) {
|
| + LOG(ERROR) << "Pixel size mismatch in paint recorder:" << context.pixel_size().ToString() << " vs " << recording_size.ToString();
|
| + }
|
| + } else {
|
| + if (context.size() != recording_size) {
|
| + LOG(ERROR) << "size mismatch in paint recorder:" << context.size().ToString() << " vs " << recording_size.ToString();
|
| + }
|
| + }
|
| + gfx::Vector2dF scale = context.CanvasScale();
|
| + canvas()->Scale(scale.x(), scale.y());
|
| }
|
|
|
| PaintRecorder::PaintRecorder(const PaintContext& context,
|
| const gfx::Size& recording_size)
|
| - : PaintRecorder(context, recording_size, nullptr) {
|
| + : PaintRecorder(context, recording_size, nullptr, false) {
|
| }
|
|
|
| PaintRecorder::~PaintRecorder() {
|
|
|