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

Unified Diff: ui/aura/window.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/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 3fe502797e0ccf5d30fda8393f2b91c4d6605f63..71fe8aca1a49f934fc864c47e00dcc83a8f164c8 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -30,6 +30,7 @@
#include "ui/aura/window_tree_host.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer.h"
+#include "ui/compositor/paint_context.h"
#include "ui/events/event_target_iterator.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/path.h"
@@ -959,21 +960,22 @@ void Window::SchedulePaint() {
SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height()));
}
-void Window::Paint(gfx::Canvas* canvas) {
+void Window::Paint(const ui::PaintContext& context) {
if (delegate_)
- delegate_->OnPaint(canvas);
- PaintLayerlessChildren(canvas);
+ delegate_->OnPaint(context);
+ PaintLayerlessChildren(context);
}
-void Window::PaintLayerlessChildren(gfx::Canvas* canvas) {
+void Window::PaintLayerlessChildren(const ui::PaintContext& context) {
for (size_t i = 0, count = children_.size(); i < count; ++i) {
Window* child = children_[i];
if (!child->layer() && child->visible_) {
+ gfx::Canvas* canvas = context.canvas();
gfx::ScopedCanvas scoped_canvas(canvas);
canvas->ClipRect(child->bounds());
if (!canvas->IsClipEmpty()) {
canvas->Translate(child->bounds().OffsetFromOrigin());
- child->Paint(canvas);
+ child->Paint(context);
}
}
}
@@ -1377,8 +1379,8 @@ bool Window::CleanupGestureState() {
return state_modified;
}
-void Window::OnPaintLayer(gfx::Canvas* canvas) {
- Paint(canvas);
+void Window::OnPaintLayer(const ui::PaintContext& context) {
+ Paint(context);
}
void Window::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) {
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_delegate.h » ('j') | ui/compositor/paint_recorder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698