diff options
author | robertphillips <robertphillips@google.com> | 2014-09-30 06:54:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-30 06:54:17 -0700 |
commit | dbe6074a06efc5fb6883bb5e4f251ed67c8c0ab4 (patch) | |
tree | 9da0008e6fe68fbe2010ad14f5e6c54c7fa5008b /gm | |
parent | 3d398c876440deaab39bbf2a9b881c337e6dc8d4 (diff) |
Revert of GrResourceCache2 manages scratch texture. (patchset #14 id:260001 of https://codereview.chromium.org/608883003/)
Reason for revert:
Turning bots red:
Nanobench seems to be uniformly failing on Android
(http://108.170.220.21:10117/builders/Perf-Android-Venue8-PowerVR-x86-Release/builds/99/steps/RunNanobench/logs/stdio)
Ubuntu GTX660 32bit is failing in both Debug and Release on GM generation (it appears to be out of memory) (http://108.170.220.120:10117/builders/Test-Ubuntu12-ShuttleA-GTX660-x86-Debug/builds/2457/steps/GenerateGMs/logs/stdio)
Original issue's description:
> GrResourceCache2 manages scratch texture.
>
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/3d398c876440deaab39bbf2a9b881c337e6dc8d4
R=bsalomon@google.com
TBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/611383003
Diffstat (limited to 'gm')
-rw-r--r-- | gm/texturedomaineffect.cpp | 5 | ||||
-rw-r--r-- | gm/yuvtorgbeffect.cpp | 70 |
2 files changed, 39 insertions, 36 deletions
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index acf039513d..6534b0c1dd 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -92,8 +92,8 @@ protected: GrDrawState* drawState = tt.target()->drawState(); - SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fBmp, NULL)); - if (!texture) { + GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fBmp, NULL); + if (NULL == texture) { return; } @@ -144,6 +144,7 @@ protected: y += renderRect.height() + kTestPad; } } + GrUnlockAndUnrefCachedBitmapTexture(texture); } private: diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index 265491b757..026823e8ee 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -83,12 +83,11 @@ protected: GrDrawState* drawState = tt.target()->drawState(); - SkAutoTUnref<GrTexture> texture[3]; - texture[0].reset(GrRefCachedBitmapTexture(context, fBmp[0], NULL)); - texture[1].reset(GrRefCachedBitmapTexture(context, fBmp[1], NULL)); - texture[2].reset(GrRefCachedBitmapTexture(context, fBmp[2], NULL)); - - if (!texture[0] || !texture[1] || !texture[2]) { + GrTexture* texture[3]; + texture[0] = GrLockAndRefCachedBitmapTexture(context, fBmp[0], NULL); + texture[1] = GrLockAndRefCachedBitmapTexture(context, fBmp[1], NULL); + texture[2] = GrLockAndRefCachedBitmapTexture(context, fBmp[2], NULL); + if ((NULL == texture[0]) || (NULL == texture[1]) || (NULL == texture[2])) { return; } @@ -98,35 +97,38 @@ protected: for (int space = kJPEG_SkYUVColorSpace; space <= kLastEnum_SkYUVColorSpace; ++space) { - SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), - SkIntToScalar(fBmp[0].height())); - renderRect.outset(kDrawPad, kDrawPad); - - SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; - SkScalar x = kDrawPad + kTestPad; - - const int indices[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, - {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}; - - for (int i = 0; i < 6; ++i) { - SkAutoTUnref<GrFragmentProcessor> fp( - GrYUVtoRGBEffect::Create(texture[indices[i][0]], - texture[indices[i][1]], - texture[indices[i][2]], - static_cast<SkYUVColorSpace>(space))); - if (fp) { - SkMatrix viewMatrix; - viewMatrix.setTranslate(x, y); - drawState->reset(viewMatrix); - drawState->setRenderTarget(rt); - drawState->setColor(0xffffffff); - drawState->addColorProcessor(fp); - tt.target()->drawSimpleRect(renderRect); - } - x += renderRect.width() + kTestPad; - } + SkRect renderRect = SkRect::MakeWH(SkIntToScalar(fBmp[0].width()), + SkIntToScalar(fBmp[0].height())); + renderRect.outset(kDrawPad, kDrawPad); + + SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; + SkScalar x = kDrawPad + kTestPad; + + const int indices[6][3] = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}; + + for (int i = 0; i < 6; ++i) { + SkAutoTUnref<GrFragmentProcessor> fp( + GrYUVtoRGBEffect::Create(texture[indices[i][0]], + texture[indices[i][1]], + texture[indices[i][2]], + static_cast<SkYUVColorSpace>(space))); + if (fp) { + SkMatrix viewMatrix; + viewMatrix.setTranslate(x, y); + drawState->reset(viewMatrix); + drawState->setRenderTarget(rt); + drawState->setColor(0xffffffff); + drawState->addColorProcessor(fp); + tt.target()->drawSimpleRect(renderRect); + } + x += renderRect.width() + kTestPad; + } } - } + + GrUnlockAndUnrefCachedBitmapTexture(texture[0]); + GrUnlockAndUnrefCachedBitmapTexture(texture[1]); + GrUnlockAndUnrefCachedBitmapTexture(texture[2]); + } private: SkBitmap fBmp[3]; |