aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/gpu/GrTest.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-05-20 11:14:33 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-05-20 11:14:33 -0700
commit87f15c8ff11ad2bfb0c6711d7837020a50fe7fb8 (patch)
treefc3899058560ca294ba062de98c3246db3c225d2 /tools/gpu/GrTest.cpp
parentf2c96a2a6fa22c674083db701d15702636f9d5fc (diff)
Retract GrRenderTarget from GrTestTarget
Split out of: https://codereview.chromium.org/1988923002/ (Declassify GrClipMaskManager and Remove GrRenderTarget and GrDrawTarget from GrPipelineBuilder) GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=2004433002 Review-Url: https://codereview.chromium.org/2004433002
Diffstat (limited to 'tools/gpu/GrTest.cpp')
-rw-r--r--tools/gpu/GrTest.cpp28
1 files changed, 5 insertions, 23 deletions
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index fc2a9e1a20..be539cabbd 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -52,39 +52,21 @@ void SetupAlwaysEvictAtlas(GrContext* context) {
}
};
-void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target, GrRenderTarget* rt) {
+void GrTestTarget::init(GrContext* ctx, sk_sp<GrDrawContext> drawContext) {
SkASSERT(!fContext);
fContext.reset(SkRef(ctx));
- fDrawTarget.reset(SkRef(target));
- fRenderTarget.reset(SkRef(rt));
+ fDrawContext = drawContext;
}
-void GrContext::getTestTarget(GrTestTarget* tar, GrRenderTarget* rt) {
+void GrContext::getTestTarget(GrTestTarget* tar, sk_sp<GrDrawContext> drawContext) {
this->flush();
+ SkASSERT(drawContext);
// We could create a proxy GrDrawTarget that passes through to fGpu until ~GrTextTarget() and
// 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().
- if (!rt) {
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = 32;
- desc.fHeight = 32;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- desc.fSampleCnt = 0;
-
- SkAutoTUnref<GrTexture> texture(this->textureProvider()->createTexture(
- desc, SkBudgeted::kNo, nullptr, 0));
- if (nullptr == texture) {
- return;
- }
- SkASSERT(nullptr != texture->asRenderTarget());
- rt = texture->asRenderTarget();
- }
-
- SkAutoTUnref<GrDrawTarget> dt(fDrawingManager->newDrawTarget(rt));
- tar->init(this, dt, rt);
+ tar->init(this, std::move(drawContext));
}
void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) {