OLD | NEW |
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/GrMatrixConvolutionEffect.h" | 14 #include "effects/GrMatrixConvolutionEffect.h" |
15 #include "GrContext.h" | 15 #include "GrContext.h" |
| 16 #include "GrCaps.h" |
16 #include "GrDrawContext.h" | 17 #include "GrDrawContext.h" |
17 #endif | 18 #endif |
18 | 19 |
19 namespace SkGpuBlurUtils { | 20 namespace SkGpuBlurUtils { |
20 | 21 |
21 #if SK_SUPPORT_GPU | 22 #if SK_SUPPORT_GPU |
22 | 23 |
23 #define MAX_BLUR_SIGMA 4.0f | 24 #define MAX_BLUR_SIGMA 4.0f |
24 | 25 |
25 static void scale_rect(SkRect* rect, float xScale, float yScale) { | 26 static void scale_rect(SkRect* rect, float xScale, float yScale) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 bool canClobberSrc, | 148 bool canClobberSrc, |
148 const SkRect& rect, | 149 const SkRect& rect, |
149 bool cropToRect, | 150 bool cropToRect, |
150 float sigmaX, | 151 float sigmaX, |
151 float sigmaY) { | 152 float sigmaY) { |
152 SkASSERT(context); | 153 SkASSERT(context); |
153 | 154 |
154 SkIRect clearRect; | 155 SkIRect clearRect; |
155 int scaleFactorX, radiusX; | 156 int scaleFactorX, radiusX; |
156 int scaleFactorY, radiusY; | 157 int scaleFactorY, radiusY; |
157 int maxTextureSize = context->getMaxTextureSize(); | 158 int maxTextureSize = context->caps()->maxTextureSize(); |
158 sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX); | 159 sigmaX = adjust_sigma(sigmaX, maxTextureSize, &scaleFactorX, &radiusX); |
159 sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY); | 160 sigmaY = adjust_sigma(sigmaY, maxTextureSize, &scaleFactorY, &radiusY); |
160 | 161 |
161 SkRect srcRect(rect); | 162 SkRect srcRect(rect); |
162 scale_rect(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY); | 163 scale_rect(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY); |
163 srcRect.roundOut(&srcRect); | 164 srcRect.roundOut(&srcRect); |
164 scale_rect(&srcRect, static_cast<float>(scaleFactorX), | 165 scale_rect(&srcRect, static_cast<float>(scaleFactorX), |
165 static_cast<float>(scaleFactorY)); | 166 static_cast<float>(scaleFactorY)); |
166 | 167 |
167 // setup new clip | 168 // setup new clip |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 SkMatrix::I(), dstRect, srcRect); | 308 SkMatrix::I(), dstRect, srcRect); |
308 srcRect = dstRect; | 309 srcRect = dstRect; |
309 srcTexture = dstTexture; | 310 srcTexture = dstTexture; |
310 SkTSwap(dstTexture, tempTexture); | 311 SkTSwap(dstTexture, tempTexture); |
311 } | 312 } |
312 return SkRef(srcTexture); | 313 return SkRef(srcTexture); |
313 } | 314 } |
314 #endif | 315 #endif |
315 | 316 |
316 } | 317 } |
OLD | NEW |