Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_GFX_PAINT_VECTOR_ICON_H_ | 5 #ifndef UI_GFX_PAINT_VECTOR_ICON_H_ |
| 6 #define UI_GFX_PAINT_VECTOR_ICON_H_ | 6 #define UI_GFX_PAINT_VECTOR_ICON_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "ui/gfx/gfx_export.h" | 10 #include "ui/gfx/gfx_export.h" |
| 11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 | 14 |
| 15 class Canvas; | 15 class Canvas; |
| 16 enum class VectorIconId; | 16 enum class VectorIconId; |
| 17 | 17 |
| 18 // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size| | 18 // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size| |
| 19 // is the length of a single edge of the square icon, in device independent | 19 // is the length of a single edge of the square icon, in device independent |
| 20 // pixels. |color| is used as the fill. | 20 // pixels. |color| is used as the fill. |
| 21 GFX_EXPORT void PaintVectorIcon(Canvas* canvas, | 21 GFX_EXPORT void PaintVectorIcon(Canvas* canvas, |
| 22 VectorIconId id, | 22 VectorIconId id, |
| 23 size_t dip_size, | 23 size_t dip_size, |
| 24 SkColor color); | 24 SkColor color); |
| 25 | 25 |
| 26 // Creates an ImageSkia which will render the icon on demand. | 26 // Creates an ImageSkia which will render the icon on demand. |
| 27 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id, | 27 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id, |
| 28 size_t dip_size, | 28 size_t dip_size, |
| 29 SkColor color); | 29 SkColor color); |
| 30 GFX_EXPORT ImageSkia CreateVectorIconWithBadge(VectorIconId id, | |
|
sky
2015/08/26 23:26:59
Document what badge_id is.
| |
| 31 size_t dip_size, | |
| 32 SkColor color, | |
| 33 VectorIconId badge_id); | |
| 30 | 34 |
| 31 #if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION) | 35 #if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION) |
| 32 // Takes a string of the format expected of .icon files and renders onto | 36 // Takes a string of the format expected of .icon files and renders onto |
| 33 // a canvas. This should only be used as a debugging aid and should never be | 37 // a canvas. This should only be used as a debugging aid and should never be |
| 34 // used in production code. | 38 // used in production code. |
| 35 GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source, | 39 GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source, |
| 36 size_t dip_size, | 40 size_t dip_size, |
| 37 SkColor color); | 41 SkColor color); |
| 38 #endif | 42 #endif |
| 39 | 43 |
| 40 } // namespace gfx | 44 } // namespace gfx |
| 41 | 45 |
| 42 #endif // UI_GFX_PAINT_VECTOR_ICON_H_ | 46 #endif // UI_GFX_PAINT_VECTOR_ICON_H_ |
| OLD | NEW |