| Index: ui/gfx/paint_vector_icon.cc
|
| diff --git a/ui/gfx/paint_vector_icon.cc b/ui/gfx/paint_vector_icon.cc
|
| index 42608450bb36c2b18b7431ddc584b988f1406388..0338e11d90f04dc04173dbd4503e4c351a030a38 100644
|
| --- a/ui/gfx/paint_vector_icon.cc
|
| +++ b/ui/gfx/paint_vector_icon.cc
|
| @@ -77,8 +77,11 @@ void PaintPath(Canvas* canvas,
|
| paints.push_back(SkPaint());
|
| paints.back().setColor(color);
|
|
|
| + SkRect clip_rect = SkRect::MakeEmpty();
|
| +
|
| for (size_t i = 0; path_elements[i].type != END; i++) {
|
| SkPath& path = paths.back();
|
| + SkPaint& paint = paints.back();
|
| switch (path_elements[i].type) {
|
| case NEW_PATH: {
|
| paths.push_back(SkPath());
|
| @@ -92,7 +95,14 @@ void PaintPath(Canvas* canvas,
|
| int r = SkScalarFloorToInt(path_elements[++i].arg);
|
| int g = SkScalarFloorToInt(path_elements[++i].arg);
|
| int b = SkScalarFloorToInt(path_elements[++i].arg);
|
| - paints.back().setColor(SkColorSetARGB(a, r, g, b));
|
| + paint.setColor(SkColorSetARGB(a, r, g, b));
|
| + break;
|
| + }
|
| +
|
| + case STROKE: {
|
| + paint.setStyle(SkPaint::kStroke_Style);
|
| + SkScalar width = path_elements[++i].arg;
|
| + paint.setStrokeWidth(width);
|
| break;
|
| }
|
|
|
| @@ -193,6 +203,15 @@ void PaintPath(Canvas* canvas,
|
| break;
|
| }
|
|
|
| + case CLIP: {
|
| + SkScalar x = path_elements[++i].arg;
|
| + SkScalar y = path_elements[++i].arg;
|
| + SkScalar w = path_elements[++i].arg;
|
| + SkScalar h = path_elements[++i].arg;
|
| + clip_rect = SkRect::MakeXYWH(x, y, w, h);
|
| + break;
|
| + }
|
| +
|
| case END:
|
| NOTREACHED();
|
| break;
|
| @@ -204,10 +223,13 @@ void PaintPath(Canvas* canvas,
|
| canvas->sk_canvas()->scale(scale, scale);
|
| }
|
|
|
| + if (!clip_rect.isEmpty())
|
| + canvas->sk_canvas()->clipRect(clip_rect);
|
| +
|
| DCHECK_EQ(paints.size(), paths.size());
|
| for (size_t i = 0; i < paths.size(); ++i) {
|
| - paints[i].setStyle(SkPaint::kFill_Style);
|
| paints[i].setAntiAlias(true);
|
| + paints[i].setStrokeCap(SkPaint::kRound_Cap);
|
| paths[i].setFillType(SkPath::kEvenOdd_FillType);
|
| canvas->DrawPath(paths[i], paints[i]);
|
| }
|
| @@ -304,7 +326,10 @@ void PaintVectorIcon(Canvas* canvas,
|
| size_t dip_size,
|
| SkColor color) {
|
| DCHECK(VectorIconId::VECTOR_ICON_NONE != id);
|
| - PaintPath(canvas, GetPathForVectorIcon(id), dip_size, color);
|
| + const PathElement* path = canvas->image_scale() == 1.f
|
| + ? GetPathForVectorIconAt1xScale(id)
|
| + : GetPathForVectorIcon(id);
|
| + PaintPath(canvas, path, dip_size, color);
|
| }
|
|
|
| ImageSkia CreateVectorIcon(VectorIconId id, size_t dip_size, SkColor color) {
|
|
|