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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 scale_rect(&srcRect, static_cast<float>(scaleFactorX), | 160 scale_rect(&srcRect, static_cast<float>(scaleFactorX), |
161 static_cast<float>(scaleFactorY)); | 161 static_cast<float>(scaleFactorY)); |
162 | 162 |
163 GrContext::AutoClip acs(context, SkRect::MakeWH(srcRect.width(), srcRect.hei
ght())); | 163 GrContext::AutoClip acs(context, SkRect::MakeWH(srcRect.width(), srcRect.hei
ght())); |
164 | 164 |
165 SkASSERT(kBGRA_8888_GrPixelConfig == srcTexture->config() || | 165 SkASSERT(kBGRA_8888_GrPixelConfig == srcTexture->config() || |
166 kRGBA_8888_GrPixelConfig == srcTexture->config() || | 166 kRGBA_8888_GrPixelConfig == srcTexture->config() || |
167 kAlpha_8_GrPixelConfig == srcTexture->config()); | 167 kAlpha_8_GrPixelConfig == srcTexture->config()); |
168 | 168 |
169 GrSurfaceDesc desc; | 169 GrSurfaceDesc desc; |
170 desc.fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurfaceFlag; | 170 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
171 desc.fWidth = SkScalarFloorToInt(srcRect.width()); | 171 desc.fWidth = SkScalarFloorToInt(srcRect.width()); |
172 desc.fHeight = SkScalarFloorToInt(srcRect.height()); | 172 desc.fHeight = SkScalarFloorToInt(srcRect.height()); |
173 desc.fConfig = srcTexture->config(); | 173 desc.fConfig = srcTexture->config(); |
174 | 174 |
175 GrTexture* dstTexture; | 175 GrTexture* dstTexture; |
176 GrTexture* tempTexture; | 176 GrTexture* tempTexture; |
177 SkAutoTUnref<GrTexture> temp1, temp2; | 177 SkAutoTUnref<GrTexture> temp1, temp2; |
178 | 178 |
179 temp1.reset(context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMa
tch)); | 179 temp1.reset(context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMa
tch)); |
180 dstTexture = temp1.get(); | 180 dstTexture = temp1.get(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 srcRect); | 293 srcRect); |
294 srcRect = dstRect; | 294 srcRect = dstRect; |
295 srcTexture = dstTexture; | 295 srcTexture = dstTexture; |
296 SkTSwap(dstTexture, tempTexture); | 296 SkTSwap(dstTexture, tempTexture); |
297 } | 297 } |
298 return SkRef(srcTexture); | 298 return SkRef(srcTexture); |
299 } | 299 } |
300 #endif | 300 #endif |
301 | 301 |
302 } | 302 } |
OLD | NEW |