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

Side by Side Diff: ui/aura/demo/demo_main.cc

Issue 1057873004: Pass a ui::PaintContext from ui::Layer to layer delegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layer-paintcontext: mac Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « ui/aura/bench/bench_main.cc ('k') | ui/aura/test/test_window_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/i18n/icu_util.h" 7 #include "base/i18n/icu_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
11 #include "base/power_monitor/power_monitor_device_source.h" 11 #include "base/power_monitor/power_monitor_device_source.h"
12 #include "third_party/skia/include/core/SkXfermode.h" 12 #include "third_party/skia/include/core/SkXfermode.h"
13 #include "ui/aura/client/default_capture_client.h" 13 #include "ui/aura/client/default_capture_client.h"
14 #include "ui/aura/client/window_tree_client.h" 14 #include "ui/aura/client/window_tree_client.h"
15 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
16 #include "ui/aura/test/test_focus_client.h" 16 #include "ui/aura/test/test_focus_client.h"
17 #include "ui/aura/test/test_screen.h" 17 #include "ui/aura/test/test_screen.h"
18 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
19 #include "ui/aura/window_delegate.h" 19 #include "ui/aura/window_delegate.h"
20 #include "ui/aura/window_tree_host.h" 20 #include "ui/aura/window_tree_host.h"
21 #include "ui/base/hit_test.h" 21 #include "ui/base/hit_test.h"
22 #include "ui/compositor/paint_context.h"
22 #include "ui/compositor/test/in_process_context_factory.h" 23 #include "ui/compositor/test/in_process_context_factory.h"
23 #include "ui/events/event.h" 24 #include "ui/events/event.h"
24 #include "ui/gfx/canvas.h" 25 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/geometry/rect.h" 26 #include "ui/gfx/geometry/rect.h"
26 #include "ui/gfx/skia_util.h" 27 #include "ui/gfx/skia_util.h"
27 #include "ui/gl/gl_surface.h" 28 #include "ui/gl/gl_surface.h"
28 29
29 #if defined(USE_X11) 30 #if defined(USE_X11)
30 #include "ui/gfx/x/x11_connection.h" 31 #include "ui/gfx/x/x11_connection.h"
31 #endif 32 #endif
(...skipping 23 matching lines...) Expand all
55 int GetNonClientComponent(const gfx::Point& point) const override { 56 int GetNonClientComponent(const gfx::Point& point) const override {
56 return HTCAPTION; 57 return HTCAPTION;
57 } 58 }
58 bool ShouldDescendIntoChildForEventHandling( 59 bool ShouldDescendIntoChildForEventHandling(
59 aura::Window* child, 60 aura::Window* child,
60 const gfx::Point& location) override { 61 const gfx::Point& location) override {
61 return true; 62 return true;
62 } 63 }
63 bool CanFocus() override { return true; } 64 bool CanFocus() override { return true; }
64 void OnCaptureLost() override {} 65 void OnCaptureLost() override {}
65 void OnPaint(gfx::Canvas* canvas) override { 66 void OnPaint(const ui::PaintContext& context) override {
67 gfx::Canvas* canvas = context.canvas();
66 canvas->DrawColor(color_, SkXfermode::kSrc_Mode); 68 canvas->DrawColor(color_, SkXfermode::kSrc_Mode);
67 gfx::Rect r; 69 gfx::Rect r;
68 canvas->GetClipBounds(&r); 70 canvas->GetClipBounds(&r);
69 // Fill with a non-solid color so that the compositor will exercise its 71 // Fill with a non-solid color so that the compositor will exercise its
70 // texture upload path. 72 // texture upload path.
71 while (!r.IsEmpty()) { 73 while (!r.IsEmpty()) {
72 r.Inset(2, 2); 74 r.Inset(2, 2);
73 canvas->FillRect(r, color_, SkXfermode::kXor_Mode); 75 canvas->FillRect(r, color_, SkXfermode::kXor_Mode);
74 } 76 }
75 } 77 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 int main(int argc, char** argv) { 190 int main(int argc, char** argv) {
189 base::CommandLine::Init(argc, argv); 191 base::CommandLine::Init(argc, argv);
190 192
191 // The exit manager is in charge of calling the dtors of singleton objects. 193 // The exit manager is in charge of calling the dtors of singleton objects.
192 base::AtExitManager exit_manager; 194 base::AtExitManager exit_manager;
193 195
194 base::i18n::InitializeICU(); 196 base::i18n::InitializeICU();
195 197
196 return DemoMain(); 198 return DemoMain();
197 } 199 }
OLDNEW
« no previous file with comments | « ui/aura/bench/bench_main.cc ('k') | ui/aura/test/test_window_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698