Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: ui/gfx/paint_vector_icon.h

Issue 2251643011: Move Ash-specific vector icons to ash/common/resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/gfx/gfx_export.h" 11 #include "ui/gfx/gfx_export.h"
12 #include "ui/gfx/image/image_skia.h" 12 #include "ui/gfx/image/image_skia.h"
13 13
14 namespace gfx { 14 namespace gfx {
15 15
16 class Canvas; 16 class Canvas;
17 struct VectorIcon;
17 enum class VectorIconId; 18 enum class VectorIconId;
18 19
19 // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size| 20 // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size|
20 // is the length of a single edge of the square icon, in device independent 21 // is the length of a single edge of the square icon, in device independent
21 // pixels. |color| is used as the fill. 22 // pixels. |color| is used as the fill.
22 GFX_EXPORT void PaintVectorIcon(Canvas* canvas, 23 GFX_EXPORT void PaintVectorIcon(Canvas* canvas,
23 VectorIconId id, 24 VectorIconId id,
24 size_t dip_size, 25 size_t dip_size,
25 SkColor color); 26 SkColor color);
27 GFX_EXPORT void PaintVectorIcon(Canvas* canvas,
28 const VectorIcon* icon,
29 size_t dip_size,
30 SkColor color);
26 31
27 // Creates an ImageSkia which will render the icon on demand. The size will come 32 // 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). 33 // from the .icon file (the 1x version, if multiple versions exist).
29 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id, 34 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id,
30 SkColor color); 35 SkColor color);
36 GFX_EXPORT ImageSkia CreateVectorIcon(const VectorIcon* icon, SkColor color);
31 37
32 // As above, but creates the image at the given size. 38 // As above, but creates the image at the given size.
33 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id, 39 GFX_EXPORT ImageSkia CreateVectorIcon(VectorIconId id,
34 size_t dip_size, 40 size_t dip_size,
35 SkColor color); 41 SkColor color);
42 GFX_EXPORT ImageSkia CreateVectorIcon(const VectorIcon* icon,
43 size_t dip_size,
44 SkColor color);
36 45
37 // As above, but also paints a badge defined by |badge_id| on top of the icon. 46 // As above, but also paints a badge defined by |badge_id| on top of the icon.
38 // The badge uses the same canvas size and default color as the icon. 47 // The badge uses the same canvas size and default color as the icon.
39 GFX_EXPORT ImageSkia CreateVectorIconWithBadge(VectorIconId id, 48 GFX_EXPORT ImageSkia CreateVectorIconWithBadge(VectorIconId id,
40 size_t dip_size, 49 size_t dip_size,
41 SkColor color, 50 SkColor color,
42 VectorIconId badge_id); 51 VectorIconId badge_id);
52 GFX_EXPORT ImageSkia CreateVectorIconWithBadge(const VectorIcon* icon,
53 size_t dip_size,
54 SkColor color,
55 const VectorIcon* badge_icon);
43 56
44 #if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION) 57 #if defined(GFX_VECTOR_ICONS_UNSAFE) || defined(GFX_IMPLEMENTATION)
45 // Takes a string of the format expected of .icon files and renders onto 58 // Takes a string of the format expected of .icon files and renders onto
46 // a canvas. This should only be used as a debugging aid and should never be 59 // a canvas. This should only be used as a debugging aid and should never be
47 // used in production code. 60 // used in production code.
48 GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source, 61 GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source,
49 size_t dip_size, 62 size_t dip_size,
50 SkColor color); 63 SkColor color);
51 #endif 64 #endif
52 65
53 } // namespace gfx 66 } // namespace gfx
54 67
55 #endif // UI_GFX_PAINT_VECTOR_ICON_H_ 68 #endif // UI_GFX_PAINT_VECTOR_ICON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698