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

Unified Diff: Source/platform/graphics/skia/SkiaUtils.h

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: apllied senorblanco feedback Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
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)
+{
+ 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

Powered by Google App Engine
This is Rietveld 408576698