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

Side by Side Diff: src/effects/SkGpuBlurUtils.cpp

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 years 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
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGpuBlurUtils.h" 8 #include "SkGpuBlurUtils.h"
9 9
10 #include "SkRect.h" 10 #include "SkRect.h"
11 11
12 #if SK_SUPPORT_GPU 12 #if SK_SUPPORT_GPU
13 #include "effects/GrConvolutionEffect.h" 13 #include "effects/GrConvolutionEffect.h"
14 #include "effects/GrTextureDomainEffect.h" 14 #include "effects/GrTextureDomainEffect.h"
15 #include "GrContext.h" 15 #include "GrContext.h"
16 #endif 16 #endif
17 17
18 namespace SkGpuBlurUtils { 18 namespace SkGpuBlurUtils {
19 19
20 #if SK_SUPPORT_GPU 20 #if SK_SUPPORT_GPU
21 21
22 #define MAX_BLUR_SIGMA 4.0f 22 #define MAX_BLUR_SIGMA 4.0f
23 23
24 static void scale_rect(SkRect* rect, float xScale, float yScale) { 24 static void scale_rect(SkRect* rect, float xScale, float yScale) {
25 rect->fLeft = SkScalarMul(rect->fLeft, SkFloatToScalar(xScale)); 25 rect->fLeft = SkScalarMul(rect->fLeft, xScale);
26 rect->fTop = SkScalarMul(rect->fTop, SkFloatToScalar(yScale)); 26 rect->fTop = SkScalarMul(rect->fTop, yScale);
27 rect->fRight = SkScalarMul(rect->fRight, SkFloatToScalar(xScale)); 27 rect->fRight = SkScalarMul(rect->fRight, xScale);
28 rect->fBottom = SkScalarMul(rect->fBottom, SkFloatToScalar(yScale)); 28 rect->fBottom = SkScalarMul(rect->fBottom, yScale);
29 } 29 }
30 30
31 static float adjust_sigma(float sigma, int *scaleFactor, int *radius) { 31 static float adjust_sigma(float sigma, int *scaleFactor, int *radius) {
32 *scaleFactor = 1; 32 *scaleFactor = 1;
33 while (sigma > MAX_BLUR_SIGMA) { 33 while (sigma > MAX_BLUR_SIGMA) {
34 *scaleFactor *= 2; 34 *scaleFactor *= 2;
35 sigma *= 0.5f; 35 sigma *= 0.5f;
36 } 36 }
37 *radius = static_cast<int>(ceilf(sigma * 3.0f)); 37 *radius = static_cast<int>(ceilf(sigma * 3.0f));
38 SkASSERT(*radius <= GrConvolutionEffect::kMaxKernelRadius); 38 SkASSERT(*radius <= GrConvolutionEffect::kMaxKernelRadius);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } else if (srcTexture == temp2.texture()) { 256 } else if (srcTexture == temp2.texture()) {
257 return temp2.detach(); 257 return temp2.detach();
258 } else { 258 } else {
259 srcTexture->ref(); 259 srcTexture->ref();
260 return srcTexture; 260 return srcTexture;
261 } 261 }
262 } 262 }
263 #endif 263 #endif
264 264
265 } 265 }
OLDNEW
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698