| Index: tests/GLProgramsTest.cpp
|
| diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
|
| index 75032bdbe6a168b8b0a3daba063b0c9794823711..cf3d90cbca99063f1d5a06b81d2c03ac0cddfa9b 100644
|
| --- a/tests/GLProgramsTest.cpp
|
| +++ b/tests/GLProgramsTest.cpp
|
| @@ -111,14 +111,15 @@ static GrRenderTarget* random_render_target(GrGpuGL* gpu,
|
| texDesc.fOrigin = random->nextBool() == true ? kTopLeft_GrSurfaceOrigin :
|
| kBottomLeft_GrSurfaceOrigin;
|
|
|
| - GrTexture* texture = gpu->getContext()->findAndRefTexture(texDesc, cacheId, ¶ms);
|
| - if (NULL == texture) {
|
| - texture = gpu->getContext()->createTexture(¶ms, texDesc, cacheId, 0, 0);
|
| - if (NULL == texture) {
|
| + SkAutoTUnref<GrTexture> texture(
|
| + gpu->getContext()->findAndRefTexture(texDesc, cacheId, ¶ms));
|
| + if (!texture) {
|
| + texture.reset(gpu->getContext()->createTexture(¶ms, texDesc, cacheId, 0, 0));
|
| + if (!texture) {
|
| return NULL;
|
| }
|
| }
|
| - return texture->asRenderTarget();
|
| + return SkRef(texture->asRenderTarget());
|
| }
|
|
|
| // TODO clean this up, we have to do this to test geometry processors but there has got to be
|
| @@ -417,12 +418,11 @@ bool GrGpuGL::programUnitTest(int maxStages) {
|
| static const int NUM_TESTS = 512;
|
| for (int t = 0; t < NUM_TESTS;) {
|
| // setup random render target(can fail)
|
| - GrRenderTarget* rtPtr = random_render_target(this, glProgramsCacheID, &random);
|
| - if (!rtPtr) {
|
| + SkAutoTUnref<GrRenderTarget> rt(random_render_target(this, glProgramsCacheID, &random));
|
| + if (!rt) {
|
| SkDebugf("Could not allocate render target");
|
| return false;
|
| }
|
| - GrTGpuResourceRef<GrRenderTarget> rt(SkRef(rtPtr), kWrite_GrIOType);
|
|
|
| GrDrawState* ds = this->drawState();
|
| ds->setRenderTarget(rt.get());
|
|
|