aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTest.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-11-13 06:06:03 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-13 06:06:03 -0800
commit9c8605144a0f15e3e69a4e1dcd5d3e63f339380e (patch)
tree1917c14e2ade64311654c27353a32eb7e637cb37 /src/gpu/GrTest.cpp
parent7fdda6091ca0579e823cc014a000828dd53571e6 (diff)
Update testing frameworks/tests for MDB
This CL: Fixes an ordering problem w.r.t. drawTarget clean up in GrContext::abandonContext (for text test that abandons context) Fixes when the lastDrawTarget field is set on a RenderTarget (now in GrDrawTarget ctor) due to GrTestTarget use case Updates the ProgramUnitTest to use multiple drawTargets Adds renderTarget creation to GrTestTargets (in MDB drawTargets require them) BUG=skia:4094 Review URL: https://codereview.chromium.org/1441533003
Diffstat (limited to 'src/gpu/GrTest.cpp')
-rw-r--r--src/gpu/GrTest.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 6e9df211fa..24042ee31d 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -44,11 +44,12 @@ void SetupAlwaysEvictAtlas(GrContext* context) {
}
};
-void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
+void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, GrRenderTarget* rt) {
SkASSERT(!fContext);
fContext.reset(SkRef(ctx));
fDrawTarget.reset(SkRef(target));
+ fRenderTarget.reset(SkRef(rt));
}
void GrContext::getTestTarget(GrTestTarget* tar) {
@@ -57,8 +58,22 @@ void GrContext::getTestTarget(GrTestTarget* tar) {
// then disconnects. This would help prevent test writers from mixing using the returned
// GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
// until ~GrTestTarget().
- SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(nullptr));
- tar->init(this, dt);
+ GrSurfaceDesc desc;
+ desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fWidth = 32;
+ desc.fHeight = 32;
+ desc.fConfig = kRGBA_8888_GrPixelConfig;
+ desc.fSampleCnt = 0;
+
+ GrTexture* texture = this->textureProvider()->createTexture(desc, false, nullptr, 0);
+ if (nullptr == texture) {
+ return;
+ }
+ SkASSERT(nullptr != texture->asRenderTarget());
+ GrRenderTarget* rt = texture->asRenderTarget();
+
+ SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(rt));
+ tar->init(this, dt, rt);
}
void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) {