Commit a002bde5 authored by danakj's avatar danakj Committed by Commit bot

ui: Remove the canvas() member from PaintContext.

The canvas() is now only accessed through the Recorder classes (ie.
PaintRecorder and friends).  Now we can put a DisplayItemList instead
of a Canvas inside PaintContext.

R=piman@chromium.org
BUG=466426

Review URL: https://codereview.chromium.org/1069183002

Cr-Commit-Position: refs/heads/master@{#324210}
parent 8ff5c840
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
namespace ui { namespace ui {
ClipTransformRecorder::ClipTransformRecorder(const PaintContext& context) ClipTransformRecorder::ClipTransformRecorder(const PaintContext& context)
: canvas_(context.canvas()) { : canvas_(context.canvas_) {
canvas_->Save(); canvas_->Save();
} }
......
...@@ -11,7 +11,7 @@ namespace ui { ...@@ -11,7 +11,7 @@ namespace ui {
CompositingRecorder::CompositingRecorder(const PaintContext& context, CompositingRecorder::CompositingRecorder(const PaintContext& context,
uint8_t alpha) uint8_t alpha)
: canvas_(context.canvas()), saved_(alpha < 255) { : canvas_(context.canvas_), saved_(alpha < 255) {
if (saved_) if (saved_)
canvas_->SaveLayerAlpha(alpha); canvas_->SaveLayerAlpha(alpha);
} }
......
...@@ -13,6 +13,8 @@ class Canvas; ...@@ -13,6 +13,8 @@ class Canvas;
} }
namespace ui { namespace ui {
class ClipTransformRecorder;
class CompositingRecorder;
class PaintRecorder; class PaintRecorder;
class PaintContext { class PaintContext {
...@@ -43,9 +45,6 @@ class PaintContext { ...@@ -43,9 +45,6 @@ class PaintContext {
return PaintContext(canvas_); return PaintContext(canvas_);
} }
// TODO(danakj): Remove this once everything is painting to display lists.
gfx::Canvas* canvas() const { return canvas_; }
// When true, IsRectInvalidated() can be called, otherwise its result would be // When true, IsRectInvalidated() can be called, otherwise its result would be
// invalid. // invalid.
bool CanCheckInvalidated() const { return !invalidation_.IsEmpty(); } bool CanCheckInvalidated() const { return !invalidation_.IsEmpty(); }
...@@ -70,9 +69,11 @@ class PaintContext { ...@@ -70,9 +69,11 @@ class PaintContext {
const gfx::Rect& InvalidationForTesting() const { return invalidation_; } const gfx::Rect& InvalidationForTesting() const { return invalidation_; }
private: private:
// The PaintRecorder needs access to the internal canvas and friends, but we // The Recorder classes need access to the internal canvas and friends, but we
// don't want to expose them on this class so that people must go through the // don't want to expose them on this class so that people must go through the
// recorder to access them. // recorders to access them.
friend class ClipTransformRecorder;
friend class CompositingRecorder;
friend class PaintRecorder; friend class PaintRecorder;
// Clone a PaintContext with an additional |offset|. // Clone a PaintContext with an additional |offset|.
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
namespace ui { namespace ui {
PaintRecorder::PaintRecorder(const PaintContext& context) PaintRecorder::PaintRecorder(const PaintContext& context)
: canvas_(context.canvas()) { : canvas_(context.canvas_) {
} }
PaintRecorder::~PaintRecorder() { PaintRecorder::~PaintRecorder() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment