| 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> |
| 11 |
| 10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/base/nine_image_painter_factory.h" | 15 #include "ui/base/nine_image_painter_factory.h" |
| 15 #include "ui/views/views_export.h" | 16 #include "ui/views/views_export.h" |
| 16 | 17 |
| 17 namespace gfx { | 18 namespace gfx { |
| 18 class Canvas; | 19 class Canvas; |
| 19 class ImageSkia; | 20 class ImageSkia; |
| 20 class Insets; | 21 class Insets; |
| 21 class Rect; | 22 class Rect; |
| 22 class Size; | 23 class Size; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 const gfx::Insets& insets); | 71 const gfx::Insets& insets); |
| 71 | 72 |
| 72 // Creates a painter that paints images in a scalable grid. The images must | 73 // Creates a painter that paints images in a scalable grid. The images must |
| 73 // share widths by column and heights by row. The corners are painted at full | 74 // share widths by column and heights by row. The corners are painted at full |
| 74 // size, while center and edge images are stretched to fill the painted area. | 75 // size, while center and edge images are stretched to fill the painted area. |
| 75 // The center image may be zero (to be skipped). This ordering must be used: | 76 // The center image may be zero (to be skipped). This ordering must be used: |
| 76 // Top-Left/Top/Top-Right/Left/[Center]/Right/Bottom-Left/Bottom/Bottom-Right. | 77 // Top-Left/Top/Top-Right/Left/[Center]/Right/Bottom-Left/Bottom/Bottom-Right. |
| 77 static Painter* CreateImageGridPainter(const int image_ids[]); | 78 static Painter* CreateImageGridPainter(const int image_ids[]); |
| 78 | 79 |
| 79 // Factory methods for creating painters intended for rendering focus. | 80 // Factory methods for creating painters intended for rendering focus. |
| 80 static scoped_ptr<Painter> CreateDashedFocusPainter(); | 81 static std::unique_ptr<Painter> CreateDashedFocusPainter(); |
| 81 static scoped_ptr<Painter> CreateDashedFocusPainterWithInsets( | 82 static std::unique_ptr<Painter> CreateDashedFocusPainterWithInsets( |
| 82 const gfx::Insets& insets); | 83 const gfx::Insets& insets); |
| 83 static scoped_ptr<Painter> CreateSolidFocusPainter(SkColor color, | 84 static std::unique_ptr<Painter> CreateSolidFocusPainter( |
| 84 const gfx::Insets& insets); | 85 SkColor color, |
| 86 const gfx::Insets& insets); |
| 85 | 87 |
| 86 // Returns the minimum size this painter can paint without obvious graphical | 88 // Returns the minimum size this painter can paint without obvious graphical |
| 87 // problems (e.g. overlapping images). | 89 // problems (e.g. overlapping images). |
| 88 virtual gfx::Size GetMinimumSize() const = 0; | 90 virtual gfx::Size GetMinimumSize() const = 0; |
| 89 | 91 |
| 90 // Paints the painter in the specified region. | 92 // Paints the painter in the specified region. |
| 91 virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) = 0; | 93 virtual void Paint(gfx::Canvas* canvas, const gfx::Size& size) = 0; |
| 92 | 94 |
| 93 private: | 95 private: |
| 94 DISALLOW_COPY_AND_ASSIGN(Painter); | 96 DISALLOW_COPY_AND_ASSIGN(Painter); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 119 | 121 |
| 120 // NOTE: the images are owned by ResourceBundle. Don't free them. | 122 // NOTE: the images are owned by ResourceBundle. Don't free them. |
| 121 const gfx::ImageSkia* images_[3]; | 123 const gfx::ImageSkia* images_[3]; |
| 122 | 124 |
| 123 DISALLOW_COPY_AND_ASSIGN(HorizontalPainter); | 125 DISALLOW_COPY_AND_ASSIGN(HorizontalPainter); |
| 124 }; | 126 }; |
| 125 | 127 |
| 126 } // namespace views | 128 } // namespace views |
| 127 | 129 |
| 128 #endif // UI_VIEWS_PAINTER_H_ | 130 #endif // UI_VIEWS_PAINTER_H_ |
| OLD | NEW |