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" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 174 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
175 desc.fWidth = SkScalarFloorToInt(srcRect.width()); | 175 desc.fWidth = SkScalarFloorToInt(srcRect.width()); |
176 desc.fHeight = SkScalarFloorToInt(srcRect.height()); | 176 desc.fHeight = SkScalarFloorToInt(srcRect.height()); |
177 desc.fConfig = srcTexture->config(); | 177 desc.fConfig = srcTexture->config(); |
178 | 178 |
179 GrTexture* dstTexture; | 179 GrTexture* dstTexture; |
180 GrTexture* tempTexture; | 180 GrTexture* tempTexture; |
181 SkAutoTUnref<GrTexture> temp1, temp2; | 181 SkAutoTUnref<GrTexture> temp1, temp2; |
182 | 182 |
183 temp1.reset(context->textureProvider()->refScratchTexture( | 183 temp1.reset(context->textureProvider()->refScratchTexture( |
184 desc, GrTextureProvider::kApprox_ScratchTexMatch)); | 184 desc, GrTextureProvider::kApprox_ScratchMatch)); |
185 dstTexture = temp1.get(); | 185 dstTexture = temp1.get(); |
186 if (canClobberSrc) { | 186 if (canClobberSrc) { |
187 tempTexture = srcTexture; | 187 tempTexture = srcTexture; |
188 } else { | 188 } else { |
189 temp2.reset(context->textureProvider()->refScratchTexture( | 189 temp2.reset(context->textureProvider()->refScratchTexture( |
190 desc, GrTextureProvider::kApprox_ScratchTexMatch)); | 190 desc, GrTextureProvider::kApprox_ScratchMatch)); |
191 tempTexture = temp2.get(); | 191 tempTexture = temp2.get(); |
192 } | 192 } |
193 | 193 |
194 if (NULL == dstTexture || NULL == tempTexture) { | 194 if (NULL == dstTexture || NULL == tempTexture) { |
195 return NULL; | 195 return NULL; |
196 } | 196 } |
197 | 197 |
198 for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) { | 198 for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) { |
199 GrPaint paint; | 199 GrPaint paint; |
200 SkMatrix matrix; | 200 SkMatrix matrix; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 SkMatrix::I(), dstRect, srcRect); | 301 SkMatrix::I(), dstRect, srcRect); |
302 srcRect = dstRect; | 302 srcRect = dstRect; |
303 srcTexture = dstTexture; | 303 srcTexture = dstTexture; |
304 SkTSwap(dstTexture, tempTexture); | 304 SkTSwap(dstTexture, tempTexture); |
305 } | 305 } |
306 return SkRef(srcTexture); | 306 return SkRef(srcTexture); |
307 } | 307 } |
308 #endif | 308 #endif |
309 | 309 |
310 } | 310 } |
OLD | NEW |