| Index: ui/gfx/paint_vector_icon.cc
|
| diff --git a/ui/gfx/paint_vector_icon.cc b/ui/gfx/paint_vector_icon.cc
|
| index eeca3f406925e366fdd0d661e6b154266e60bea8..3e98412973f5d18b8d38b7e44118424df991b9e0 100644
|
| --- a/ui/gfx/paint_vector_icon.cc
|
| +++ b/ui/gfx/paint_vector_icon.cc
|
| @@ -81,12 +81,12 @@ std::vector<PathElement> PathFromSource(const std::string& source) {
|
|
|
| void PaintPath(Canvas* canvas,
|
| const PathElement* path_elements,
|
| - size_t dip_size,
|
| + int dip_size,
|
| SkColor color) {
|
| SkPath path;
|
| path.setFillType(SkPath::kEvenOdd_FillType);
|
|
|
| - size_t canvas_size = kReferenceSizeDip;
|
| + int canvas_size = kReferenceSizeDip;
|
| std::vector<SkPath> paths;
|
| std::vector<SkPaint> paints;
|
| SkRect clip_rect = SkRect::MakeEmpty();
|
| @@ -293,8 +293,8 @@ void PaintPath(Canvas* canvas,
|
| }
|
| }
|
|
|
| - gfx::ScopedRTLFlipCanvas scoped_rtl_flip_canvas(
|
| - canvas, static_cast<int>(canvas_size), flips_in_rtl);
|
| + gfx::ScopedRTLFlipCanvas scoped_rtl_flip_canvas(canvas, canvas_size,
|
| + flips_in_rtl);
|
|
|
| if (dip_size != canvas_size) {
|
| SkScalar scale = SkIntToScalar(dip_size) / SkIntToScalar(canvas_size);
|
| @@ -312,22 +312,18 @@ void PaintPath(Canvas* canvas,
|
| class VectorIconSource : public CanvasImageSource {
|
| public:
|
| VectorIconSource(VectorIconId id,
|
| - size_t dip_size,
|
| + int dip_size,
|
| SkColor color,
|
| VectorIconId badge_id)
|
| - : CanvasImageSource(
|
| - gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size)),
|
| - false),
|
| + : CanvasImageSource(gfx::Size(dip_size, dip_size), false),
|
| id_(id),
|
| color_(color),
|
| badge_id_(badge_id) {}
|
|
|
| VectorIconSource(const std::string& definition,
|
| - size_t dip_size,
|
| + int dip_size,
|
| SkColor color)
|
| - : CanvasImageSource(
|
| - gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size)),
|
| - false),
|
| + : CanvasImageSource(gfx::Size(dip_size, dip_size), false),
|
| id_(VectorIconId::VECTOR_ICON_NONE),
|
| path_(PathFromSource(definition)),
|
| color_(color),
|
| @@ -368,7 +364,7 @@ class VectorIconCache {
|
| ~VectorIconCache() {}
|
|
|
| ImageSkia GetOrCreateIcon(VectorIconId id,
|
| - size_t dip_size,
|
| + int dip_size,
|
| SkColor color,
|
| VectorIconId badge_id) {
|
| IconDescription description(id, dip_size, color, badge_id);
|
| @@ -376,9 +372,8 @@ class VectorIconCache {
|
| if (iter != images_.end())
|
| return iter->second;
|
|
|
| - ImageSkia icon(
|
| - new VectorIconSource(id, dip_size, color, badge_id),
|
| - gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size)));
|
| + ImageSkia icon(new VectorIconSource(id, dip_size, color, badge_id),
|
| + gfx::Size(dip_size, dip_size));
|
| images_.insert(std::make_pair(description, icon));
|
| return icon;
|
| }
|
| @@ -386,7 +381,7 @@ class VectorIconCache {
|
| private:
|
| struct IconDescription {
|
| IconDescription(VectorIconId id,
|
| - size_t dip_size,
|
| + int dip_size,
|
| SkColor color,
|
| VectorIconId badge_id)
|
| : id(id), dip_size(dip_size), color(color), badge_id(badge_id) {}
|
| @@ -414,7 +409,7 @@ static base::LazyInstance<VectorIconCache> g_icon_cache =
|
|
|
| void PaintVectorIcon(Canvas* canvas,
|
| VectorIconId id,
|
| - size_t dip_size,
|
| + int dip_size,
|
| SkColor color) {
|
| DCHECK(VectorIconId::VECTOR_ICON_NONE != id);
|
| const PathElement* path = canvas->image_scale() == 1.f
|
| @@ -425,18 +420,19 @@ void PaintVectorIcon(Canvas* canvas,
|
|
|
| ImageSkia CreateVectorIcon(VectorIconId id, SkColor color) {
|
| const PathElement* one_x_path = GetPathForVectorIconAt1xScale(id);
|
| - size_t size = one_x_path[0].type == CANVAS_DIMENSIONS ? one_x_path[1].arg
|
| - : kReferenceSizeDip;
|
| + int size = (one_x_path[0].type == CANVAS_DIMENSIONS)
|
| + ? SkScalarTruncToInt(one_x_path[1].arg)
|
| + : kReferenceSizeDip;
|
| return CreateVectorIcon(id, size, color);
|
| }
|
|
|
| -ImageSkia CreateVectorIcon(VectorIconId id, size_t dip_size, SkColor color) {
|
| +ImageSkia CreateVectorIcon(VectorIconId id, int dip_size, SkColor color) {
|
| return CreateVectorIconWithBadge(id, dip_size, color,
|
| VectorIconId::VECTOR_ICON_NONE);
|
| }
|
|
|
| ImageSkia CreateVectorIconWithBadge(VectorIconId id,
|
| - size_t dip_size,
|
| + int dip_size,
|
| SkColor color,
|
| VectorIconId badge_id) {
|
| return (id == VectorIconId::VECTOR_ICON_NONE)
|
| @@ -446,11 +442,11 @@ ImageSkia CreateVectorIconWithBadge(VectorIconId id,
|
| }
|
|
|
| ImageSkia CreateVectorIconFromSource(const std::string& source,
|
| - size_t dip_size,
|
| + int dip_size,
|
| SkColor color) {
|
| return ImageSkia(
|
| new VectorIconSource(source, dip_size, color),
|
| - gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size)));
|
| + gfx::Size(dip_size, dip_size));
|
| }
|
|
|
| } // namespace gfx
|
|
|