Chromium Code Reviews| Index: Source/platform/graphics/skia/SkiaUtils.h |
| diff --git a/Source/platform/graphics/skia/SkiaUtils.h b/Source/platform/graphics/skia/SkiaUtils.h |
| index f0372ae22414ae02e762cbb7e7d86f351aede557..181bce0b17356946749e236348e27da008820390 100644 |
| --- a/Source/platform/graphics/skia/SkiaUtils.h |
| +++ b/Source/platform/graphics/skia/SkiaUtils.h |
| @@ -127,8 +127,6 @@ InterpolationQuality computeInterpolationQuality( |
| float destHeight, |
| bool isDataComplete = true); |
| -bool shouldDrawAntiAliased(const GraphicsContext*, const SkRect& destRect); |
| - |
| // This replicates the old skia behavior when it used to take radius for blur. Now it takes sigma. |
| inline SkScalar skBlurRadiusToSigma(SkScalar radius) |
| { |
| @@ -136,6 +134,33 @@ inline SkScalar skBlurRadiusToSigma(SkScalar radius) |
| return 0.288675f * radius + 0.5f; |
| } |
| +template<typename DrawFunc> |
| +void drawPlatformFocusRing(const DrawFunc& drawFunc, SkColor color, int width) |
|
Stephen White
2015/05/29 17:26:37
It looks like the two call sites which draw focus
|
| +{ |
| + SkPaint paint; |
| + paint.setAntiAlias(true); |
| + paint.setStyle(SkPaint::kStroke_Style); |
| + paint.setColor(color); |
| + |
| +#if OS(MACOSX) |
| + paint.setStrokeWidth(width); |
| + paint.setAlpha(64); |
| + float cornerRadius = (width - 1) * 0.5f; |
| +#else |
| + paint.setStrokeWidth(1); |
| + const float cornerRadius = 1; |
| +#endif |
| + |
| + drawFunc(paint, cornerRadius); |
| + |
| +#if OS(MACOSX) |
| + // Inner part |
| + paint.setAlpha(128); |
| + paint.setStrokeWidth(paint.getStrokeWidth() * 0.5f); |
| + drawFunc(paint, cornerRadius); |
| +#endif |
| +} |
| + |
| } // namespace blink |
| #endif // SkiaUtils_h |