Rename backing texture testing routines
authorjvanverth <jvanverth@google.com>
Tue, 14 Jul 2015 18:02:52 +0000 (11:02 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 14 Jul 2015 18:02:52 +0000 (11:02 -0700)
Review URL: https://codereview.chromium.org/1230193006

gm/imagefromyuvtextures.cpp
src/gpu/GrGpu.h
src/gpu/GrTest.cpp
src/gpu/gl/GrGLGpu.cpp
src/gpu/gl/GrGLGpu.h
tests/ResourceCacheTest.cpp
tests/SurfaceTest.cpp

index dbed06f..8dbfffd 100644 (file)
@@ -102,9 +102,10 @@ protected:
 
         for (int i = 0; i < 3; ++i) {
             SkASSERT(fYUVBmps[i].width() == SkToInt(fYUVBmps[i].rowBytes()));
-            yuvIDs[i] = gpu->createBackendTexture(fYUVBmps[i].getPixels(),
-                                                  fYUVBmps[i].width(), fYUVBmps[i].height(),
-                                                  kAlpha_8_GrPixelConfig);
+            yuvIDs[i] = gpu->createTestingOnlyBackendTexture(fYUVBmps[i].getPixels(),
+                                                             fYUVBmps[i].width(), 
+                                                             fYUVBmps[i].height(),
+                                                             kAlpha_8_GrPixelConfig);
         }
         context->resetContext();
     }
@@ -117,7 +118,7 @@ protected:
         }
 
         for (int i = 0; i < 3; ++i) {
-            gpu->deleteBackendTexture(yuvIDs[i]);
+            gpu->deleteTestingOnlyBackendTexture(yuvIDs[i]);
         }
 
         context->resetContext();
index b8bec3a..9365d89 100644 (file)
@@ -363,10 +363,11 @@ public:
     void restoreActiveTraceMarkers();
 
     // creation and deletion of raw texture for testing
-    virtual GrBackendObject createBackendTexture(void* pixels, int w, int h,
-                                                 GrPixelConfig config) const = 0;
-    virtual bool isBackendTexture(GrBackendObject id) const = 0;
-    virtual void deleteBackendTexture(GrBackendObject id) const = 0;
+    // only to be used in GPU-specific tests
+    virtual GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
+                                                            GrPixelConfig config) const = 0;
+    virtual bool isTestingOnlyBackendTexture(GrBackendObject id) const = 0;
+    virtual void deleteTestingOnlyBackendTexture(GrBackendObject id) const = 0;
 
     // Given a rt, find or create a stencil buffer and attach it
     bool attachStencilAttachmentToRenderTarget(GrRenderTarget* target);
index b070d84..34d75a8 100644 (file)
@@ -235,10 +235,12 @@ private:
 
     void didRemoveGpuTraceMarker() override {}
 
-    GrBackendObject createBackendTexture(void* pixels, int w, int h,
-                                         GrPixelConfig config) const override { return 0; }
-    bool isBackendTexture(GrBackendObject id) const override { return false;  }
-    void deleteBackendTexture(GrBackendObject id) const override {}
+    GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
+                                                    GrPixelConfig config) const override {
+        return 0; 
+    }
+    bool isTestingOnlyBackendTexture(GrBackendObject id) const override { return false; }
+    void deleteTestingOnlyBackendTexture(GrBackendObject id) const override {}
 
     typedef GrGpu INHERITED;
 };
index 7320d2e..5c03ab5 100644 (file)
@@ -3067,7 +3067,7 @@ void GrGLGpu::didRemoveGpuTraceMarker() {
     }
 }
 
-GrBackendObject GrGLGpu::createBackendTexture(void* pixels, int w, int h,
+GrBackendObject GrGLGpu::createTestingOnlyBackendTexture(void* pixels, int w, int h,
                                               GrPixelConfig config) const {
     GrGLuint texID;
     GL_CALL(GenTextures(1, &texID));
@@ -3091,7 +3091,7 @@ GrBackendObject GrGLGpu::createBackendTexture(void* pixels, int w, int h,
     return texID;
 }
 
-bool GrGLGpu::isBackendTexture(GrBackendObject id) const {
+bool GrGLGpu::isTestingOnlyBackendTexture(GrBackendObject id) const {
     GrGLuint texID = (GrGLuint)id;
 
     GrGLboolean result;
@@ -3100,7 +3100,7 @@ bool GrGLGpu::isBackendTexture(GrBackendObject id) const {
     return (GR_GL_TRUE == result);
 }
 
-void GrGLGpu::deleteBackendTexture(GrBackendObject id) const {
+void GrGLGpu::deleteTestingOnlyBackendTexture(GrBackendObject id) const {
     GrGLuint texID = (GrGLuint)id;
     GL_CALL(DeleteTextures(1, &texID));
 }
index baafea3..45337dd 100644 (file)
@@ -112,10 +112,10 @@ public:
         return &this->glContext();
     }
 
-    GrBackendObject createBackendTexture(void* pixels, int w, int h,
-                                         GrPixelConfig config) const override;
-    bool isBackendTexture(GrBackendObject id) const override;
-    void deleteBackendTexture(GrBackendObject id) const override;
+    GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h,
+                                                    GrPixelConfig config) const override;
+    bool isTestingOnlyBackendTexture(GrBackendObject id) const override;
+    void deleteTestingOnlyBackendTexture(GrBackendObject id) const override;
 
 private:
     GrGLGpu(GrGLContext* ctx, GrContext* context);
index a870a08..0b7cb10 100644 (file)
@@ -184,8 +184,8 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont
     static const int kW = 100;
     static const int kH = 100;
 
-    texIDs[0] = gpu->createBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
-    texIDs[1] = gpu->createBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
+    texIDs[0] = gpu->createTestingOnlyBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
+    texIDs[1] = gpu->createTestingOnlyBackendTexture(NULL, kW, kH, kRGBA_8888_GrPixelConfig);
 
     context->resetContext();
 
@@ -212,13 +212,13 @@ static void test_wrapped_resources(skiatest::Reporter* reporter, GrContext* cont
 
     context->flush();
 
-    bool borrowedIsAlive = gpu->isBackendTexture(texIDs[0]);
-    bool adoptedIsAlive = gpu->isBackendTexture(texIDs[1]);
+    bool borrowedIsAlive = gpu->isTestingOnlyBackendTexture(texIDs[0]);
+    bool adoptedIsAlive = gpu->isTestingOnlyBackendTexture(texIDs[1]);
 
     REPORTER_ASSERT(reporter, borrowedIsAlive);
     REPORTER_ASSERT(reporter, !adoptedIsAlive);
 
-    gpu->deleteBackendTexture(texIDs[0]);
+    gpu->deleteTestingOnlyBackendTexture(texIDs[0]);
 
     context->resetContext();
 }
index 7e1b3c9..9d0c645 100644 (file)
@@ -117,8 +117,8 @@ static void test_wrapped_texture_surface(skiatest::Reporter* reporter, GrContext
     static const uint32_t kOrigColor = 0xFFAABBCC;
     SkAutoTArray<uint32_t> pixels(kW * kH);
     sk_memset32(pixels.get(), kOrigColor, kW * kH);
-    GrBackendObject texID = gpu->createBackendTexture(pixels.get(), kW, kH,
-                                                      kRGBA_8888_GrPixelConfig);
+    GrBackendObject texID = gpu->createTestingOnlyBackendTexture(pixels.get(), kW, kH,
+                                                                 kRGBA_8888_GrPixelConfig);
 
     GrBackendTextureDesc wrappedDesc;
     wrappedDesc.fConfig = kRGBA_8888_GrPixelConfig;