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 "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
| 9 #include "ui/gfx/gfx_export.h" | 9 #include "ui/gfx/gfx_export.h" |
| 10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 | 13 |
| 14 class Canvas; | 14 class Canvas; |
| 15 struct VectorIcon; | 15 struct VectorIcon; |
| 16 | 16 |
| 17 GFX_EXPORT extern const VectorIcon kNoneIcon; | 17 GFX_EXPORT extern const VectorIcon kNoneIcon; |
| 18 | 18 |
| 19 // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size| | 19 // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |color| is |
| 20 // is the length of a single edge of the square icon, in device independent | 20 // used as the fill. The size will come from the .icon file (the 1x version, if |
| 21 // pixels. |color| is used as the fill. | 21 // multiple versions exist). |
| 22 GFX_EXPORT void PaintVectorIcon(Canvas* canvas, | |
| 23 const VectorIcon& icon, | |
| 24 SkColor color); | |
| 25 | |
| 26 // As above, with a specificed size. |dip_size| is the length of a single edge | |
| 27 // of the square icon, in device independent pixels. | |
| 22 GFX_EXPORT void PaintVectorIcon(Canvas* canvas, | 28 GFX_EXPORT void PaintVectorIcon(Canvas* canvas, |
| 23 const VectorIcon& icon, | 29 const VectorIcon& icon, |
| 24 int dip_size, | 30 int dip_size, |
| 25 SkColor color); | 31 SkColor color); |
| 26 | 32 |
| 27 // Creates an ImageSkia which will render the icon on demand. The size will come | 33 // Creates an ImageSkia which will render the icon on demand. The size will come |
| 28 // from the .icon file (the 1x version, if multiple versions exist). | 34 // from the .icon file (the 1x version, if multiple versions exist). |
| 29 GFX_EXPORT ImageSkia CreateVectorIcon(const VectorIcon& icon, SkColor color); | 35 GFX_EXPORT ImageSkia CreateVectorIcon(const VectorIcon& icon, SkColor color); |
| 30 | 36 |
| 31 // As above, but creates the image at the given size. | 37 // As above, but creates the image at the given size. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 42 | 48 |
| 43 #if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION) | 49 #if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION) |
| 44 // Takes a string of the format expected of .icon files and renders onto | 50 // Takes a string of the format expected of .icon files and renders onto |
| 45 // a canvas. This should only be used as a debugging aid and should never be | 51 // a canvas. This should only be used as a debugging aid and should never be |
| 46 // used in production code. | 52 // used in production code. |
| 47 GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source, | 53 GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source, |
| 48 int dip_size, | 54 int dip_size, |
| 49 SkColor color); | 55 SkColor color); |
| 50 #endif | 56 #endif |
| 51 | 57 |
| 58 // FIXME | |
|
tdanderson
2017/03/30 20:48:51
Anything left to fix? Also, consider adding a brie
Evan Stade
2017/03/30 23:56:47
oops. FIXME is my note to myself to add docs. Done
| |
| 59 GFX_EXPORT int GetDefaultSizeOfVectorIcon(const gfx::VectorIcon& icon); | |
| 60 | |
| 52 } // namespace gfx | 61 } // namespace gfx |
| 53 | 62 |
| 54 #endif // UI_GFX_PAINT_VECTOR_ICON_H_ | 63 #endif // UI_GFX_PAINT_VECTOR_ICON_H_ |
| OLD | NEW |