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_VIEWS_PAINTER_H_ | 5 #ifndef UI_VIEWS_PAINTER_H_ |
6 #define UI_VIEWS_PAINTER_H_ | 6 #define UI_VIEWS_PAINTER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
11 #include "third_party/skia/include/core/SkPaint.h" | |
11 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
12 | 13 |
13 namespace gfx { | 14 namespace gfx { |
14 class Canvas; | 15 class Canvas; |
15 class ImageSkia; | 16 class ImageSkia; |
16 class Insets; | 17 class Insets; |
17 class Rect; | 18 class Rect; |
18 class Size; | 19 class Size; |
19 } | 20 } |
20 | 21 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 // Top-Left/Top/Top-Right/Left/[Center]/Right/Bottom-Left/Bottom/Bottom-Right. | 66 // Top-Left/Top/Top-Right/Left/[Center]/Right/Bottom-Left/Bottom/Bottom-Right. |
66 static Painter* CreateImageGridPainter(const int image_ids[]); | 67 static Painter* CreateImageGridPainter(const int image_ids[]); |
67 | 68 |
68 // Returns the minimum size this painter can paint without obvious graphical | 69 // Returns the minimum size this painter can paint without obvious graphical |
69 // problems (e.g. overlapping images). | 70 // problems (e.g. overlapping images). |
70 virtual gfx::Size GetMinimumSize() const = 0; | 71 virtual gfx::Size GetMinimumSize() const = 0; |
71 | 72 |
72 // Paints the painter in the specified region. | 73 // Paints the painter in the specified region. |
73 virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) = 0; | 74 virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) = 0; |
74 | 75 |
76 // Paint with custom SkPaint options; supported by a limited set of painters. | |
77 virtual void PaintWithSkPaint(gfx::Canvas* canvas, | |
sky
2013/06/13 16:22:04
Do we really need this?
msw
2013/06/13 17:29:49
The only alternative I see is exposing ImagePainte
| |
78 const gfx::Size& size, | |
79 const SkPaint& paint); | |
80 | |
75 private: | 81 private: |
76 DISALLOW_COPY_AND_ASSIGN(Painter); | 82 DISALLOW_COPY_AND_ASSIGN(Painter); |
77 }; | 83 }; |
78 | 84 |
79 // HorizontalPainter paints 3 images into a box: left, center and right. The | 85 // HorizontalPainter paints 3 images into a box: left, center and right. The |
80 // left and right images are drawn to size at the left/right edges of the | 86 // left and right images are drawn to size at the left/right edges of the |
81 // region. The center is tiled in the remaining space. All images must have the | 87 // region. The center is tiled in the remaining space. All images must have the |
82 // same height. | 88 // same height. |
83 class VIEWS_EXPORT HorizontalPainter : public Painter { | 89 class VIEWS_EXPORT HorizontalPainter : public Painter { |
84 public: | 90 public: |
(...skipping 16 matching lines...) Expand all Loading... | |
101 | 107 |
102 // NOTE: the images are owned by ResourceBundle. Don't free them. | 108 // NOTE: the images are owned by ResourceBundle. Don't free them. |
103 const gfx::ImageSkia* images_[3]; | 109 const gfx::ImageSkia* images_[3]; |
104 | 110 |
105 DISALLOW_COPY_AND_ASSIGN(HorizontalPainter); | 111 DISALLOW_COPY_AND_ASSIGN(HorizontalPainter); |
106 }; | 112 }; |
107 | 113 |
108 } // namespace views | 114 } // namespace views |
109 | 115 |
110 #endif // UI_VIEWS_PAINTER_H_ | 116 #endif // UI_VIEWS_PAINTER_H_ |
OLD | NEW |