| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/base/nine_image_painter_factory.h" | 15 #include "ui/base/nine_image_painter_factory.h" |
| 16 #include "ui/views/views_export.h" | 16 #include "ui/views/views_export.h" |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 class Canvas; | 19 class Canvas; |
| 20 class ImageSkia; | 20 class ImageSkia; |
| 21 class Insets; | 21 class Insets; |
| 22 class InsetsF; |
| 22 class Rect; | 23 class Rect; |
| 23 class Size; | 24 class Size; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace views { | 27 namespace views { |
| 27 | 28 |
| 28 class View; | 29 class View; |
| 29 | 30 |
| 30 // Painter, as the name implies, is responsible for painting in a particular | 31 // Painter, as the name implies, is responsible for painting in a particular |
| 31 // region. Think of Painter as a Border or Background that can be painted | 32 // region. Think of Painter as a Border or Background that can be painted |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // share widths by column and heights by row. The corners are painted at full | 81 // share widths by column and heights by row. The corners are painted at full |
| 81 // size, while center and edge images are stretched to fill the painted area. | 82 // size, while center and edge images are stretched to fill the painted area. |
| 82 // The center image may be zero (to be skipped). This ordering must be used: | 83 // The center image may be zero (to be skipped). This ordering must be used: |
| 83 // Top-Left/Top/Top-Right/Left/[Center]/Right/Bottom-Left/Bottom/Bottom-Right. | 84 // Top-Left/Top/Top-Right/Left/[Center]/Right/Bottom-Left/Bottom/Bottom-Right. |
| 84 static Painter* CreateImageGridPainter(const int image_ids[]); | 85 static Painter* CreateImageGridPainter(const int image_ids[]); |
| 85 | 86 |
| 86 // Factory methods for creating painters intended for rendering focus. | 87 // Factory methods for creating painters intended for rendering focus. |
| 87 static std::unique_ptr<Painter> CreateDashedFocusPainter(); | 88 static std::unique_ptr<Painter> CreateDashedFocusPainter(); |
| 88 static std::unique_ptr<Painter> CreateDashedFocusPainterWithInsets( | 89 static std::unique_ptr<Painter> CreateDashedFocusPainterWithInsets( |
| 89 const gfx::Insets& insets); | 90 const gfx::Insets& insets); |
| 91 // Deprecated: used the InsetsF version below. |
| 90 static std::unique_ptr<Painter> CreateSolidFocusPainter( | 92 static std::unique_ptr<Painter> CreateSolidFocusPainter( |
| 91 SkColor color, | 93 SkColor color, |
| 92 const gfx::Insets& insets); | 94 const gfx::Insets& insets); |
| 95 static std::unique_ptr<Painter> CreateSolidFocusPainter( |
| 96 SkColor color, |
| 97 SkScalar thickness, |
| 98 const gfx::InsetsF& insets); |
| 93 | 99 |
| 94 // Returns the minimum size this painter can paint without obvious graphical | 100 // Returns the minimum size this painter can paint without obvious graphical |
| 95 // problems (e.g. overlapping images). | 101 // problems (e.g. overlapping images). |
| 96 virtual gfx::Size GetMinimumSize() const = 0; | 102 virtual gfx::Size GetMinimumSize() const = 0; |
| 97 | 103 |
| 98 // Paints the painter in the specified region. | 104 // Paints the painter in the specified region. |
| 99 virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) = 0; | 105 virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) = 0; |
| 100 | 106 |
| 101 private: | 107 private: |
| 102 DISALLOW_COPY_AND_ASSIGN(Painter); | 108 DISALLOW_COPY_AND_ASSIGN(Painter); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 127 | 133 |
| 128 // NOTE: the images are owned by ResourceBundle. Don't free them. | 134 // NOTE: the images are owned by ResourceBundle. Don't free them. |
| 129 const gfx::ImageSkia* images_[3]; | 135 const gfx::ImageSkia* images_[3]; |
| 130 | 136 |
| 131 DISALLOW_COPY_AND_ASSIGN(HorizontalPainter); | 137 DISALLOW_COPY_AND_ASSIGN(HorizontalPainter); |
| 132 }; | 138 }; |
| 133 | 139 |
| 134 } // namespace views | 140 } // namespace views |
| 135 | 141 |
| 136 #endif // UI_VIEWS_PAINTER_H_ | 142 #endif // UI_VIEWS_PAINTER_H_ |
| OLD | NEW |