diff options
author | 2016-05-20 11:14:33 -0700 | |
---|---|---|
committer | 2016-05-20 11:14:33 -0700 | |
commit | 87f15c8ff11ad2bfb0c6711d7837020a50fe7fb8 (patch) | |
tree | fc3899058560ca294ba062de98c3246db3c225d2 /tools/gpu/GrTest.cpp | |
parent | f2c96a2a6fa22c674083db701d15702636f9d5fc (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.cpp | 28 |
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) { |