diff options
author | 2014-10-14 11:47:22 -0700 | |
---|---|---|
committer | 2014-10-14 11:47:22 -0700 | |
commit | e30597375c19dfb5197fd065a3d1768401eb00fa (patch) | |
tree | d61474ce6dc1ed158456299951a194800e119ad4 /src/gpu/SkGr.cpp | |
parent | ec87dc64dd40c1a4f80088023c94764caca79bf9 (diff) |
Remove uses of GrAutoScratchTexture.
Rename GrContext::lockAndRefScratchTexture to refScratchTexture.
GrSurface::writePixels returns bool instead of void.
BUG=skia:2889
Review URL: https://codereview.chromium.org/638403003
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r-- | src/gpu/SkGr.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 4a2cf47663..fdd4a79e48 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -159,7 +159,7 @@ static GrTexture* sk_gr_allocate_texture(GrContext* ctx, // cache so no one else can find it. Additionally, once unlocked, the // scratch texture will go to the end of the list for purging so will // likely be available for this volatile bitmap the next time around. - result = ctx->lockAndRefScratchTexture(desc, GrContext::kExact_ScratchTexMatch); + result = ctx->refScratchTexture(desc, GrContext::kExact_ScratchTexMatch); if (pixels) { result->writePixels(0, 0, bm.width(), bm.height(), desc.fConfig, pixels, rowBytes); } @@ -248,14 +248,15 @@ static GrTexture *load_yuv_texture(GrContext* ctx, bool cache, const GrTexturePa GrTextureDesc yuvDesc; yuvDesc.fConfig = kAlpha_8_GrPixelConfig; - GrAutoScratchTexture yuvTextures[3]; + SkAutoTUnref<GrTexture> yuvTextures[3]; for (int i = 0; i < 3; ++i) { yuvDesc.fWidth = yuvSizes[i].fWidth; yuvDesc.fHeight = yuvSizes[i].fHeight; - yuvTextures[i].set(ctx, yuvDesc); - if ((NULL == yuvTextures[i].texture()) || - !yuvTextures[i].texture()->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight, - yuvDesc.fConfig, planes[i], rowBytes[i])) { + yuvTextures[i].reset( + ctx->refScratchTexture(yuvDesc, GrContext::kApprox_ScratchTexMatch)); + if (!yuvTextures[i] || + !yuvTextures[i]->writePixels(0, 0, yuvDesc.fWidth, yuvDesc.fHeight, + yuvDesc.fConfig, planes[i], rowBytes[i])) { return NULL; } } @@ -269,9 +270,8 @@ static GrTexture *load_yuv_texture(GrContext* ctx, bool cache, const GrTexturePa GrRenderTarget* renderTarget = result ? result->asRenderTarget() : NULL; if (renderTarget) { - SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor(GrYUVtoRGBEffect::Create( - yuvTextures[0].texture(), yuvTextures[1].texture(), yuvTextures[2].texture(), - colorSpace)); + SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor( + GrYUVtoRGBEffect::Create(yuvTextures[0], yuvTextures[1], yuvTextures[2], colorSpace)); GrPaint paint; paint.addColorProcessor(yuvToRgbProcessor); SkRect r = SkRect::MakeWH(SkIntToScalar(yuvSizes[0].fWidth), |