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

Side by Side Diff: src/gpu/SkGr.cpp

Issue 1321353002: Limit lifetime of GrDrawContext objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 3 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 2010 Google Inc. 2 * Copyright 2010 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 "SkGr.h" 8 #include "SkGr.h"
9 9
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // copies of texels from the original. 305 // copies of texels from the original.
306 GrTextureParams params(SkShader::kClamp_TileMode, 306 GrTextureParams params(SkShader::kClamp_TileMode,
307 Stretch::kBilerp_Type == stretch.fType ? 307 Stretch::kBilerp_Type == stretch.fType ?
308 GrTextureParams::kBilerp_FilterMode : 308 GrTextureParams::kBilerp_FilterMode :
309 GrTextureParams::kNone_FilterMode); 309 GrTextureParams::kNone_FilterMode);
310 paint.addColorTextureProcessor(inputTexture, SkMatrix::I(), params); 310 paint.addColorTextureProcessor(inputTexture, SkMatrix::I(), params);
311 311
312 SkRect rect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(rtD esc.fHeight)); 312 SkRect rect = SkRect::MakeWH(SkIntToScalar(rtDesc.fWidth), SkIntToScalar(rtD esc.fHeight));
313 SkRect localRect = SkRect::MakeWH(1.f, 1.f); 313 SkRect localRect = SkRect::MakeWH(1.f, 1.f);
314 314
315 GrDrawContext* drawContext = context->drawContext(); 315 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext());
316 if (!drawContext) { 316 if (!drawContext) {
317 return nullptr; 317 return nullptr;
318 } 318 }
319 319
320 drawContext->drawNonAARectToRect(stretched->asRenderTarget(), GrClip::WideOp en(), paint, 320 drawContext->drawNonAARectToRect(stretched->asRenderTarget(), GrClip::WideOp en(), paint,
321 SkMatrix::I(), rect, localRect); 321 SkMatrix::I(), rect, localRect);
322 322
323 return stretched; 323 return stretched;
324 } 324 }
325 325
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 GrPaint paint; 467 GrPaint paint;
468 SkAutoTUnref<GrFragmentProcessor> 468 SkAutoTUnref<GrFragmentProcessor>
469 yuvToRgbProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManager (), yuvTextures[0], 469 yuvToRgbProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManager (), yuvTextures[0],
470 yuvTextures[1], yuvTextures[2 ], 470 yuvTextures[1], yuvTextures[2 ],
471 yuvInfo.fSize, yuvInfo.fColor Space)); 471 yuvInfo.fSize, yuvInfo.fColor Space));
472 paint.addColorFragmentProcessor(yuvToRgbProcessor); 472 paint.addColorFragmentProcessor(yuvToRgbProcessor);
473 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth), 473 SkRect r = SkRect::MakeWH(SkIntToScalar(yuvInfo.fSize[0].fWidth),
474 SkIntToScalar(yuvInfo.fSize[0].fHeight)); 474 SkIntToScalar(yuvInfo.fSize[0].fHeight));
475 475
476 GrDrawContext* drawContext = ctx->drawContext(); 476 SkAutoTUnref<GrDrawContext> drawContext(ctx->drawContext());
477 if (!drawContext) { 477 if (!drawContext) {
478 return nullptr; 478 return nullptr;
479 } 479 }
480 480
481 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I() , r); 481 drawContext->drawRect(renderTarget, GrClip::WideOpen(), paint, SkMatrix::I() , r);
482 482
483 return result; 483 return result;
484 } 484 }
485 485
486 static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx, 486 static GrTexture* create_unstretched_bitmap_texture(GrContext* ctx,
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 SkErrorInternals::SetError( kInvalidPaint_SkError, 920 SkErrorInternals::SetError( kInvalidPaint_SkError,
921 "Sorry, I don't understand the filtering " 921 "Sorry, I don't understand the filtering "
922 "mode you asked for. Falling back to " 922 "mode you asked for. Falling back to "
923 "MIPMaps."); 923 "MIPMaps.");
924 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 924 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
925 break; 925 break;
926 926
927 } 927 }
928 return textureFilterMode; 928 return textureFilterMode;
929 } 929 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698