Chromium Code Reviews| Index: src/gpu/GrContext.cpp |
| diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
| index 5ebb2e95fbf62c478db804e0e1254827a37e5689..cae3a91bf15e09adb823e5da01324e521d18f462 100644 |
| --- a/src/gpu/GrContext.cpp |
| +++ b/src/gpu/GrContext.cpp |
| @@ -615,6 +615,37 @@ sk_sp<GrDrawContext> GrContext::drawContext(sk_sp<GrRenderTarget> rt, |
| return fDrawingManager->drawContext(std::move(rt), surfaceProps); |
| } |
| +sk_sp<GrDrawContext> GrContext::newDrawContext(BackingFit fit, |
| + int width, int height, |
| + GrPixelConfig config, |
| + int sampleCnt, |
| + GrSurfaceOrigin origin) { |
| + GrSurfaceDesc desc; |
| + desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| + desc.fOrigin = origin; |
| + desc.fWidth = width; |
| + desc.fHeight = height; |
| + desc.fConfig = config; |
| + desc.fSampleCnt = sampleCnt; |
| + |
| + sk_sp<GrTexture> maskTexture; |
|
bsalomon
2016/04/27 19:42:10
Why is this called maskTexture?
robertphillips
2016/04/27 19:59:10
Done - it was left over from copy & paste.
|
| + if (kTight_BackingFit == fit) { |
| + maskTexture.reset(this->textureProvider()->createTexture(desc, SkBudgeted::kYes)); |
| + } else { |
| + maskTexture.reset(this->textureProvider()->createApproxTexture(desc)); |
| + } |
| + if (!maskTexture) { |
| + return nullptr; |
| + } |
| + |
| + sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(maskTexture->asRenderTarget()))); |
| + if (!drawContext) { |
| + return nullptr; |
| + } |
| + |
| + return drawContext; |
| +} |
| + |
| bool GrContext::abandoned() const { |
| ASSERT_SINGLE_OWNER |
| return fDrawingManager->abandoned(); |