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 ASH_WM_IMAGE_GRID_H_ | 5 #ifndef UI_VIEWS_COREWM_IMAGE_GRID_H_ |
6 #define ASH_WM_IMAGE_GRID_H_ | 6 #define UI_VIEWS_COREWM_IMAGE_GRID_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | |
9 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
10 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
11 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
12 #include "ui/compositor/layer.h" | 11 #include "ui/compositor/layer.h" |
13 #include "ui/compositor/layer_delegate.h" | 12 #include "ui/compositor/layer_delegate.h" |
14 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
15 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 #include "ui/views/views_export.h" |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 class Image; | 18 class Image; |
19 } // namespace gfx | 19 } // namespace gfx |
20 | 20 |
21 namespace ash { | 21 namespace views { |
22 namespace internal { | 22 namespace corewm { |
23 | 23 |
24 // An ImageGrid is a 3x3 array of ui::Layers, each containing an image. | 24 // An ImageGrid is a 3x3 array of ui::Layers, each containing an image. |
25 // | 25 // |
26 // As the grid is resized, its images fill the requested space: | 26 // As the grid is resized, its images fill the requested space: |
27 // - corner images are not scaled | 27 // - corner images are not scaled |
28 // - top and bottom images are scaled horizontally | 28 // - top and bottom images are scaled horizontally |
29 // - left and right images are scaled vertically | 29 // - left and right images are scaled vertically |
30 // - the center image is scaled in both directions | 30 // - the center image is scaled in both directions |
31 // | 31 // |
32 // If one of the non-center images is smaller than the largest images in its | 32 // If one of the non-center images is smaller than the largest images in its |
(...skipping 17 matching lines...) Expand all Loading... |
50 // | ..xxx|XXXXXXXXXXXXXXXXXX | 50 // | ..xxx|XXXXXXXXXXXXXXXXXX |
51 // | .xXXXXX|XXXXXXXXXXXXXXXXXX_____ | 51 // | .xXXXXX|XXXXXXXXXXXXXXXXXX_____ |
52 // | .xXX | ^ window's top edge | 52 // | .xXX | ^ window's top edge |
53 // | .xXX | | 53 // | .xXX | |
54 // +---------+ | 54 // +---------+ |
55 // | xXX| | 55 // | xXX| |
56 // | xXX|< window's left edge | 56 // | xXX|< window's left edge |
57 // | xXX| | 57 // | xXX| |
58 // ... | 58 // ... |
59 // | 59 // |
60 class ASH_EXPORT ImageGrid { | 60 class VIEWS_EXPORT ImageGrid { |
61 public: | 61 public: |
62 // Helper class for use by tests. | 62 // Helper class for use by tests. |
63 class ASH_EXPORT TestAPI { | 63 class VIEWS_EXPORT TestAPI { |
64 public: | 64 public: |
65 TestAPI(ImageGrid* grid) : grid_(grid) {} | 65 TestAPI(ImageGrid* grid) : grid_(grid) {} |
66 | 66 |
67 gfx::Rect top_left_clip_rect() const { | 67 gfx::Rect top_left_clip_rect() const { |
68 return grid_->top_left_painter_->clip_rect_; | 68 return grid_->top_left_painter_->clip_rect_; |
69 } | 69 } |
70 gfx::Rect top_right_clip_rect() const { | 70 gfx::Rect top_right_clip_rect() const { |
71 return grid_->top_right_painter_->clip_rect_; | 71 return grid_->top_right_painter_->clip_rect_; |
72 } | 72 } |
73 gfx::Rect bottom_left_clip_rect() const { | 73 gfx::Rect bottom_left_clip_rect() const { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 scoped_ptr<ImagePainter> left_painter_; | 205 scoped_ptr<ImagePainter> left_painter_; |
206 scoped_ptr<ImagePainter> center_painter_; | 206 scoped_ptr<ImagePainter> center_painter_; |
207 scoped_ptr<ImagePainter> right_painter_; | 207 scoped_ptr<ImagePainter> right_painter_; |
208 scoped_ptr<ImagePainter> bottom_left_painter_; | 208 scoped_ptr<ImagePainter> bottom_left_painter_; |
209 scoped_ptr<ImagePainter> bottom_painter_; | 209 scoped_ptr<ImagePainter> bottom_painter_; |
210 scoped_ptr<ImagePainter> bottom_right_painter_; | 210 scoped_ptr<ImagePainter> bottom_right_painter_; |
211 | 211 |
212 DISALLOW_COPY_AND_ASSIGN(ImageGrid); | 212 DISALLOW_COPY_AND_ASSIGN(ImageGrid); |
213 }; | 213 }; |
214 | 214 |
215 } // namespace internal | 215 } // namespace corewm |
216 } // namespace ash | 216 } // namespace views |
217 | 217 |
218 #endif // ASH_WM_IMAGE_GRID_H_ | 218 #endif // UI_VIEWS_COREWM_IMAGE_GRID_H_ |
OLD | NEW |