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 #ifndef UI_WM_CORE_IMAGE_GRID_H_ | 5 #ifndef UI_WM_CORE_IMAGE_GRID_H_ |
6 #define UI_WM_CORE_IMAGE_GRID_H_ | 6 #define UI_WM_CORE_IMAGE_GRID_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void SetSize(const gfx::Size& size); | 121 void SetSize(const gfx::Size& size); |
122 | 122 |
123 // Sets the grid to a position and size such that the inner edges of the top, | 123 // Sets the grid to a position and size such that the inner edges of the top, |
124 // bottom, left and right images will be flush with |content_bounds_in_dip|. | 124 // bottom, left and right images will be flush with |content_bounds_in_dip|. |
125 void SetContentBounds(const gfx::Rect& content_bounds_in_dip); | 125 void SetContentBounds(const gfx::Rect& content_bounds_in_dip); |
126 | 126 |
127 private: | 127 private: |
128 // Delegate responsible for painting a specific image on a layer. | 128 // Delegate responsible for painting a specific image on a layer. |
129 class ImagePainter : public ui::LayerDelegate { | 129 class ImagePainter : public ui::LayerDelegate { |
130 public: | 130 public: |
131 explicit ImagePainter(const gfx::ImageSkia& image) : image_(image) {} | 131 explicit ImagePainter(const gfx::ImageSkia& image); |
132 ~ImagePainter() override {} | 132 ~ImagePainter() override {} |
133 | 133 |
134 // Clips |layer| to |clip_rect|. Triggers a repaint if the clipping | 134 // Clips |layer| to |clip_rect|. Triggers a repaint if the clipping |
135 // rectangle has changed. An empty rectangle disables clipping. | 135 // rectangle has changed. An empty rectangle disables clipping. |
136 void SetClipRect(const gfx::Rect& clip_rect, ui::Layer* layer); | 136 void SetClipRect(const gfx::Rect& clip_rect, ui::Layer* layer); |
137 | 137 |
138 // ui::LayerDelegate implementation: | 138 // ui::LayerDelegate implementation: |
139 void OnPaintLayer(const ui::PaintContext& context) override; | 139 void OnPaintLayer(const ui::PaintContext& context) override; |
140 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; | 140 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |
141 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 141 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 scoped_ptr<ImagePainter> bottom_left_painter_; | 212 scoped_ptr<ImagePainter> bottom_left_painter_; |
213 scoped_ptr<ImagePainter> bottom_painter_; | 213 scoped_ptr<ImagePainter> bottom_painter_; |
214 scoped_ptr<ImagePainter> bottom_right_painter_; | 214 scoped_ptr<ImagePainter> bottom_right_painter_; |
215 | 215 |
216 DISALLOW_COPY_AND_ASSIGN(ImageGrid); | 216 DISALLOW_COPY_AND_ASSIGN(ImageGrid); |
217 }; | 217 }; |
218 | 218 |
219 } // namespace wm | 219 } // namespace wm |
220 | 220 |
221 #endif // UI_WM_CORE_IMAGE_GRID_H_ | 221 #endif // UI_WM_CORE_IMAGE_GRID_H_ |
OLD | NEW |