aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2015-07-14 11:02:52 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-14 11:02:52 -0700
commit889579287770ba35156a73aa02d9ef5d2313c490 (patch)
tree7d9208a61c8895a1caf548232435fbcfd79b34c2
parent3df1e2163f9d7afc997dc14c440fab31277bff5c (diff)
Rename backing texture testing routines
-rw-r--r--gm/imagefromyuvtextures.cpp9
-rw-r--r--src/gpu/GrGpu.h9
-rw-r--r--src/gpu/GrTest.cpp10
-rw-r--r--src/gpu/gl/GrGLGpu.cpp6
-rw-r--r--src/gpu/gl/GrGLGpu.h8
-rw-r--r--tests/ResourceCacheTest.cpp10
-rw-r--r--tests/SurfaceTest.cpp4
7 files changed, 30 insertions, 26 deletions
diff --git a/gm/imagefromyuvtextures.cpp b/gm/imagefromyuvtextures.cpp
index dbed06fa21..8dbfffd831 100644
--- a/gm/imagefromyuvtextures.cpp
+++ b/gm/imagefromyuvtextures.cpp
@@ -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();
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index b8bec3a609..9365d8927f 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -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);
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index b070d8412a..34d75a84f5 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -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;
};
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 7320d2e30e..5c03ab57d2 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -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));
}
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index baafea3f1e..45337ddb3c 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -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);
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index a870a084ec..0b7cb10fa3 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -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();
}
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 7e1b3c90c5..9d0c6459c1 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -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;