OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/aura_extra/image_window_delegate.h" | 5 #include "ui/aura_extra/image_window_delegate.h" |
6 | 6 |
7 #include "ui/base/cursor/cursor.h" | 7 #include "ui/base/cursor/cursor.h" |
8 #include "ui/base/hit_test.h" | 8 #include "ui/base/hit_test.h" |
9 #include "ui/compositor/compositor.h" | 9 #include "ui/compositor/compositor.h" |
| 10 #include "ui/compositor/paint_context.h" |
10 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
11 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
12 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
13 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
14 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
15 | 16 |
16 namespace aura_extra { | 17 namespace aura_extra { |
17 | 18 |
18 ImageWindowDelegate::ImageWindowDelegate() | 19 ImageWindowDelegate::ImageWindowDelegate() |
19 : background_color_(SK_ColorWHITE), | 20 : background_color_(SK_ColorWHITE), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return false; | 63 return false; |
63 } | 64 } |
64 | 65 |
65 bool ImageWindowDelegate::CanFocus() { | 66 bool ImageWindowDelegate::CanFocus() { |
66 return false; | 67 return false; |
67 } | 68 } |
68 | 69 |
69 void ImageWindowDelegate::OnCaptureLost() { | 70 void ImageWindowDelegate::OnCaptureLost() { |
70 } | 71 } |
71 | 72 |
72 void ImageWindowDelegate::OnPaint(gfx::Canvas* canvas) { | 73 void ImageWindowDelegate::OnPaint(const ui::PaintContext& context) { |
| 74 gfx::Canvas* canvas = context.canvas(); |
73 if (background_color_ != SK_ColorTRANSPARENT && | 75 if (background_color_ != SK_ColorTRANSPARENT && |
74 (image_.IsEmpty() || size_mismatch_ || !offset_.IsZero())) { | 76 (image_.IsEmpty() || size_mismatch_ || !offset_.IsZero())) { |
75 canvas->DrawColor(background_color_); | 77 canvas->DrawColor(background_color_); |
76 } | 78 } |
77 if (!image_.IsEmpty()) | 79 if (!image_.IsEmpty()) |
78 canvas->DrawImageInt(image_.AsImageSkia(), offset_.x(), offset_.y()); | 80 canvas->DrawImageInt(image_.AsImageSkia(), offset_.x(), offset_.y()); |
79 } | 81 } |
80 | 82 |
81 void ImageWindowDelegate::OnDeviceScaleFactorChanged(float scale_factor) { | 83 void ImageWindowDelegate::OnDeviceScaleFactorChanged(float scale_factor) { |
82 } | 84 } |
83 | 85 |
84 void ImageWindowDelegate::OnWindowDestroying(aura::Window* window) { | 86 void ImageWindowDelegate::OnWindowDestroying(aura::Window* window) { |
85 } | 87 } |
86 | 88 |
87 void ImageWindowDelegate::OnWindowDestroyed(aura::Window* window) { | 89 void ImageWindowDelegate::OnWindowDestroyed(aura::Window* window) { |
88 delete this; | 90 delete this; |
89 } | 91 } |
90 | 92 |
91 void ImageWindowDelegate::OnWindowTargetVisibilityChanged(bool visible) { | 93 void ImageWindowDelegate::OnWindowTargetVisibilityChanged(bool visible) { |
92 } | 94 } |
93 | 95 |
94 bool ImageWindowDelegate::HasHitTestMask() const { | 96 bool ImageWindowDelegate::HasHitTestMask() const { |
95 return false; | 97 return false; |
96 } | 98 } |
97 | 99 |
98 void ImageWindowDelegate::GetHitTestMask(gfx::Path* mask) const { | 100 void ImageWindowDelegate::GetHitTestMask(gfx::Path* mask) const { |
99 } | 101 } |
100 | 102 |
101 } // namespace aura_extra | 103 } // namespace aura_extra |
OLD | NEW |