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

Side by Side 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: rebase Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved. 2 * Copyright (c) 2006,2007,2008, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 InterpolationQuality limitInterpolationQuality(const GraphicsContext*, Interpola tionQuality resampling); 120 InterpolationQuality limitInterpolationQuality(const GraphicsContext*, Interpola tionQuality resampling);
121 121
122 InterpolationQuality computeInterpolationQuality( 122 InterpolationQuality computeInterpolationQuality(
123 const SkMatrix&, 123 const SkMatrix&,
124 float srcWidth, 124 float srcWidth,
125 float srcHeight, 125 float srcHeight,
126 float destWidth, 126 float destWidth,
127 float destHeight, 127 float destHeight,
128 bool isDataComplete = true); 128 bool isDataComplete = true);
129 129
130 bool shouldDrawAntiAliased(const GraphicsContext*, const SkRect& destRect);
131
132 // This replicates the old skia behavior when it used to take radius for blur. N ow it takes sigma. 130 // This replicates the old skia behavior when it used to take radius for blur. N ow it takes sigma.
133 inline SkScalar skBlurRadiusToSigma(SkScalar radius) 131 inline SkScalar skBlurRadiusToSigma(SkScalar radius)
134 { 132 {
135 SkASSERT(radius >= 0); 133 SkASSERT(radius >= 0);
136 return 0.288675f * radius + 0.5f; 134 return 0.288675f * radius + 0.5f;
137 } 135 }
138 136
137 template<typename DrawFunc>
138 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
139 {
140 SkPaint paint;
141 paint.setAntiAlias(true);
142 paint.setStyle(SkPaint::kStroke_Style);
143 paint.setColor(color);
144
145 #if OS(MACOSX)
146 paint.setStrokeWidth(width);
147 paint.setAlpha(64);
148 float cornerRadius = (width - 1) * 0.5f;
149 #else
150 paint.setStrokeWidth(1);
151 const float cornerRadius = 1;
152 #endif
153
154 drawFunc(paint, cornerRadius);
155
156 #if OS(MACOSX)
157 // Inner part
158 paint.setAlpha(128);
159 paint.setStrokeWidth(paint.getStrokeWidth() * 0.5f);
160 drawFunc(paint, cornerRadius);
161 #endif
162 }
163
139 } // namespace blink 164 } // namespace blink
140 165
141 #endif // SkiaUtils_h 166 #endif // SkiaUtils_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/StaticBitmapImage.cpp ('k') | Source/platform/graphics/skia/SkiaUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698