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

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

Issue 1261643004: Some cleanup in GrTextureProvider and GrResourceProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@pathargs
Patch Set: fix Created 5 years, 4 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
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"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 GrSurfaceDesc desc; 176 GrSurfaceDesc desc;
177 desc.fFlags = kRenderTarget_GrSurfaceFlag; 177 desc.fFlags = kRenderTarget_GrSurfaceFlag;
178 desc.fWidth = SkScalarFloorToInt(srcRect.width()); 178 desc.fWidth = SkScalarFloorToInt(srcRect.width());
179 desc.fHeight = SkScalarFloorToInt(srcRect.height()); 179 desc.fHeight = SkScalarFloorToInt(srcRect.height());
180 desc.fConfig = srcTexture->config(); 180 desc.fConfig = srcTexture->config();
181 181
182 GrTexture* dstTexture; 182 GrTexture* dstTexture;
183 GrTexture* tempTexture; 183 GrTexture* tempTexture;
184 SkAutoTUnref<GrTexture> temp1, temp2; 184 SkAutoTUnref<GrTexture> temp1, temp2;
185 185
186 temp1.reset(context->textureProvider()->refScratchTexture( 186 temp1.reset(context->textureProvider()->createApproxTexture(desc));
187 desc, GrTextureProvider::kApprox_ScratchTexMatch));
188 dstTexture = temp1.get(); 187 dstTexture = temp1.get();
189 if (canClobberSrc) { 188 if (canClobberSrc) {
190 tempTexture = srcTexture; 189 tempTexture = srcTexture;
191 } else { 190 } else {
192 temp2.reset(context->textureProvider()->refScratchTexture( 191 temp2.reset(context->textureProvider()->createApproxTexture(desc));
193 desc, GrTextureProvider::kApprox_ScratchTexMatch));
194 tempTexture = temp2.get(); 192 tempTexture = temp2.get();
195 } 193 }
196 194
197 if (NULL == dstTexture || NULL == tempTexture) { 195 if (NULL == dstTexture || NULL == tempTexture) {
198 return NULL; 196 return NULL;
199 } 197 }
200 198
201 GrDrawContext* srcDrawContext = NULL; 199 GrDrawContext* srcDrawContext = NULL;
202 200
203 for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) { 201 for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 srcRect = dstRect; 359 srcRect = dstRect;
362 srcTexture = dstTexture; 360 srcTexture = dstTexture;
363 SkTSwap(dstTexture, tempTexture); 361 SkTSwap(dstTexture, tempTexture);
364 } 362 }
365 363
366 return SkRef(srcTexture); 364 return SkRef(srcTexture);
367 } 365 }
368 #endif 366 #endif
369 367
370 } 368 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698