OLD | NEW |
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/paint_recorder.h" |
23 #include "ui/compositor/test/in_process_context_factory.h" | 23 #include "ui/compositor/test/in_process_context_factory.h" |
24 #include "ui/events/event.h" | 24 #include "ui/events/event.h" |
25 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
26 #include "ui/gfx/geometry/rect.h" | 26 #include "ui/gfx/geometry/rect.h" |
27 #include "ui/gfx/skia_util.h" | 27 #include "ui/gfx/skia_util.h" |
28 #include "ui/gl/gl_surface.h" | 28 #include "ui/gl/gl_surface.h" |
29 | 29 |
30 #if defined(USE_X11) | 30 #if defined(USE_X11) |
31 #include "ui/gfx/x/x11_connection.h" | 31 #include "ui/gfx/x/x11_connection.h" |
32 #endif | 32 #endif |
(...skipping 24 matching lines...) Expand all Loading... |
57 return HTCAPTION; | 57 return HTCAPTION; |
58 } | 58 } |
59 bool ShouldDescendIntoChildForEventHandling( | 59 bool ShouldDescendIntoChildForEventHandling( |
60 aura::Window* child, | 60 aura::Window* child, |
61 const gfx::Point& location) override { | 61 const gfx::Point& location) override { |
62 return true; | 62 return true; |
63 } | 63 } |
64 bool CanFocus() override { return true; } | 64 bool CanFocus() override { return true; } |
65 void OnCaptureLost() override {} | 65 void OnCaptureLost() override {} |
66 void OnPaint(const ui::PaintContext& context) override { | 66 void OnPaint(const ui::PaintContext& context) override { |
67 gfx::Canvas* canvas = context.canvas(); | 67 ui::PaintRecorder recorder(context); |
68 canvas->DrawColor(color_, SkXfermode::kSrc_Mode); | 68 recorder.canvas()->DrawColor(color_, SkXfermode::kSrc_Mode); |
69 gfx::Rect r; | 69 gfx::Rect r; |
70 canvas->GetClipBounds(&r); | 70 recorder.canvas()->GetClipBounds(&r); |
71 // 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 |
72 // texture upload path. | 72 // texture upload path. |
73 while (!r.IsEmpty()) { | 73 while (!r.IsEmpty()) { |
74 r.Inset(2, 2); | 74 r.Inset(2, 2); |
75 canvas->FillRect(r, color_, SkXfermode::kXor_Mode); | 75 recorder.canvas()->FillRect(r, color_, SkXfermode::kXor_Mode); |
76 } | 76 } |
77 } | 77 } |
78 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} | 78 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
79 void OnWindowDestroying(aura::Window* window) override {} | 79 void OnWindowDestroying(aura::Window* window) override {} |
80 void OnWindowDestroyed(aura::Window* window) override {} | 80 void OnWindowDestroyed(aura::Window* window) override {} |
81 void OnWindowTargetVisibilityChanged(bool visible) override {} | 81 void OnWindowTargetVisibilityChanged(bool visible) override {} |
82 bool HasHitTestMask() const override { return false; } | 82 bool HasHitTestMask() const override { return false; } |
83 void GetHitTestMask(gfx::Path* mask) const override {} | 83 void GetHitTestMask(gfx::Path* mask) const override {} |
84 | 84 |
85 private: | 85 private: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 int main(int argc, char** argv) { | 190 int main(int argc, char** argv) { |
191 base::CommandLine::Init(argc, argv); | 191 base::CommandLine::Init(argc, argv); |
192 | 192 |
193 // 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. |
194 base::AtExitManager exit_manager; | 194 base::AtExitManager exit_manager; |
195 | 195 |
196 base::i18n::InitializeICU(); | 196 base::i18n::InitializeICU(); |
197 | 197 |
198 return DemoMain(); | 198 return DemoMain(); |
199 } | 199 } |
OLD | NEW |