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();
}
}
for (int i = 0; i < 3; ++i) {
- gpu->deleteBackendTexture(yuvIDs[i]);
+ gpu->deleteTestingOnlyBackendTexture(yuvIDs[i]);
}
context->resetContext();
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);
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;
};
}
}
-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));
return texID;
}
-bool GrGLGpu::isBackendTexture(GrBackendObject id) const {
+bool GrGLGpu::isTestingOnlyBackendTexture(GrBackendObject id) const {
GrGLuint texID = (GrGLuint)id;
GrGLboolean result;
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));
}
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);
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();
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();
}
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;