From 85d970e4cc6d5f71c30a94cd31d6f0fa07b38890 Mon Sep 17 00:00:00 2001 From: danakj Date: Fri, 3 Apr 2015 17:15:24 -0700 Subject: Pass a ui::PaintContext from ui::Layer to layer delegates. This is a plumbing CL to create a ui::PaintContext that wraps a gfx::Canvas up in ui::Layer. This is passed to every LayerDelegate, and also through to aura::WindowDelegates and views::NativeWidgetDelegates to eventually reach views::View as well. This way ui::PaintContext is created in one place (for compositor paints, there are other places painting to bitmaps we'll address later). And in the future the ui::PaintContext can be backed by a display list instead of a canvas. R=sky BUG=466426 Review URL: https://codereview.chromium.org/1057873004 Cr-Commit-Position: refs/heads/master@{#323855} --- ui/snapshot/snapshot_aura_unittest.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ui/snapshot') diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc index b15a580..c134ca0 100644 --- a/ui/snapshot/snapshot_aura_unittest.cc +++ b/ui/snapshot/snapshot_aura_unittest.cc @@ -15,6 +15,7 @@ #include "ui/aura/window_event_dispatcher.h" #include "ui/compositor/compositor.h" #include "ui/compositor/layer.h" +#include "ui/compositor/paint_context.h" #include "ui/compositor/test/context_factories_for_test.h" #include "ui/compositor/test/draw_waiter_for_test.h" #include "ui/gfx/canvas.h" @@ -42,10 +43,12 @@ class TestPaintingWindowDelegate : public aura::test::TestWindowDelegate { ~TestPaintingWindowDelegate() override {} - void OnPaint(gfx::Canvas* canvas) override { + void OnPaint(const ui::PaintContext& context) override { for (int y = 0; y < window_size_.height(); ++y) { - for (int x = 0; x < window_size_.width(); ++x) - canvas->FillRect(gfx::Rect(x, y, 1, 1), GetExpectedColorForPoint(x, y)); + for (int x = 0; x < window_size_.width(); ++x) { + context.canvas()->FillRect(gfx::Rect(x, y, 1, 1), + GetExpectedColorForPoint(x, y)); + } } } -- cgit v1.1