| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/display/cursor_window_controller.h" | 5 #include "ash/display/cursor_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/display/mirror_window_controller.h" | 8 #include "ash/display/mirror_window_controller.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/window_delegate.h" | 13 #include "ui/aura/window_delegate.h" |
| 14 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
| 15 #include "ui/base/cursor/cursors_aura.h" | 15 #include "ui/base/cursor/cursors_aura.h" |
| 16 #include "ui/base/hit_test.h" | 16 #include "ui/base/hit_test.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 18 #include "ui/compositor/dip_util.h" | 18 #include "ui/compositor/dip_util.h" |
| 19 #include "ui/compositor/paint_context.h" | 19 #include "ui/compositor/paint_context.h" |
| 20 #include "ui/compositor/paint_recorder.h" |
| 20 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
| 21 #include "ui/gfx/display.h" | 22 #include "ui/gfx/display.h" |
| 22 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
| 23 #include "ui/gfx/image/image_skia_operations.h" | 24 #include "ui/gfx/image/image_skia_operations.h" |
| 24 | 25 |
| 25 namespace ash { | 26 namespace ash { |
| 26 | 27 |
| 27 class CursorWindowDelegate : public aura::WindowDelegate { | 28 class CursorWindowDelegate : public aura::WindowDelegate { |
| 28 public: | 29 public: |
| 29 CursorWindowDelegate() : is_cursor_compositing_enabled_(false) {} | 30 CursorWindowDelegate() : is_cursor_compositing_enabled_(false) {} |
| (...skipping 12 matching lines...) Expand all Loading... |
| 42 return HTNOWHERE; | 43 return HTNOWHERE; |
| 43 } | 44 } |
| 44 bool ShouldDescendIntoChildForEventHandling( | 45 bool ShouldDescendIntoChildForEventHandling( |
| 45 aura::Window* child, | 46 aura::Window* child, |
| 46 const gfx::Point& location) override { | 47 const gfx::Point& location) override { |
| 47 return false; | 48 return false; |
| 48 } | 49 } |
| 49 bool CanFocus() override { return false; } | 50 bool CanFocus() override { return false; } |
| 50 void OnCaptureLost() override {} | 51 void OnCaptureLost() override {} |
| 51 void OnPaint(const ui::PaintContext& context) override { | 52 void OnPaint(const ui::PaintContext& context) override { |
| 52 context.canvas()->DrawImageInt(cursor_image_, 0, 0); | 53 // No need to cache the output here, the CursorWindow is not invalidated. |
| 54 ui::PaintRecorder recorder(context); |
| 55 recorder.canvas()->DrawImageInt(cursor_image_, 0, 0); |
| 53 } | 56 } |
| 54 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} | 57 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
| 55 void OnWindowDestroying(aura::Window* window) override {} | 58 void OnWindowDestroying(aura::Window* window) override {} |
| 56 void OnWindowDestroyed(aura::Window* window) override {} | 59 void OnWindowDestroyed(aura::Window* window) override {} |
| 57 void OnWindowTargetVisibilityChanged(bool visible) override {} | 60 void OnWindowTargetVisibilityChanged(bool visible) override {} |
| 58 bool HasHitTestMask() const override { return false; } | 61 bool HasHitTestMask() const override { return false; } |
| 59 void GetHitTestMask(gfx::Path* mask) const override {} | 62 void GetHitTestMask(gfx::Path* mask) const override {} |
| 60 | 63 |
| 61 // Sets cursor compositing mode on/off. | 64 // Sets cursor compositing mode on/off. |
| 62 void SetCursorCompositingEnabled(bool enabled) { | 65 void SetCursorCompositingEnabled(bool enabled) { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (!cursor_window_) | 273 if (!cursor_window_) |
| 271 return; | 274 return; |
| 272 bool visible = (visible_ && cursor_type_ != ui::kCursorNone); | 275 bool visible = (visible_ && cursor_type_ != ui::kCursorNone); |
| 273 if (visible) | 276 if (visible) |
| 274 cursor_window_->Show(); | 277 cursor_window_->Show(); |
| 275 else | 278 else |
| 276 cursor_window_->Hide(); | 279 cursor_window_->Hide(); |
| 277 } | 280 } |
| 278 | 281 |
| 279 } // namespace ash | 282 } // namespace ash |
| OLD | NEW |