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

Unified Diff: ui/compositor/layer.cc

Issue 1053143002: Make View::Paint use ui::PaintRecorder to access PaintContext's canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: paintrecorder: . Created 5 years, 9 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/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 16505f304bb7a25caa92884d59864ed7822047df..73e26ae8052441df7ad45bb46f251828d77e2687 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -29,6 +29,7 @@
#include "ui/compositor/compositor_switches.h"
#include "ui/compositor/dip_util.h"
#include "ui/compositor/layer_animator.h"
+#include "ui/compositor/paint_context.h"
#include "ui/gfx/animation/animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/display.h"
@@ -78,8 +79,7 @@ Layer::Layer()
delegate_(NULL),
owner_(NULL),
cc_layer_(NULL),
- device_scale_factor_(1.0f),
- inside_paint_(false) {
+ device_scale_factor_(1.0f) {
CreateCcLayer();
}
@@ -103,8 +103,7 @@ Layer::Layer(LayerType type)
delegate_(NULL),
owner_(NULL),
cc_layer_(NULL),
- device_scale_factor_(1.0f),
- inside_paint_(false) {
+ device_scale_factor_(1.0f) {
CreateCcLayer();
}
@@ -748,11 +747,8 @@ void Layer::PaintContents(
TRACE_EVENT1("ui", "Layer::PaintContents", "name", name_);
scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling(
sk_canvas, device_scale_factor_));
- if (delegate_) {
- base::AutoReset<bool> inside_paint(&inside_paint_, true);
- paint_rect_ = clip;
- delegate_->OnPaintLayer(canvas.get());
- }
+ if (delegate_)
+ delegate_->OnPaintLayer(PaintContext(canvas.get(), clip));
}
scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
@@ -783,11 +779,6 @@ void Layer::SetForceRenderSurface(bool force) {
cc_layer_->SetForceRenderSurface(force_render_surface_);
}
-gfx::Rect Layer::PaintRect() const {
- DCHECK(inside_paint_);
- return paint_rect_;
-}
-
class LayerDebugInfo : public base::trace_event::ConvertableToTraceFormat {
public:
explicit LayerDebugInfo(std::string name) : name_(name) { }

Powered by Google App Engine
This is Rietveld 408576698