diff options
author | 2017-06-23 10:58:19 -0400 | |
---|---|---|
committer | 2017-06-23 15:42:15 +0000 | |
commit | 91a3e52552c15751aea09b7a8a896e4edd09d42e (patch) | |
tree | d615cde3a2207d435bc6b1ae750688fa671957a7 /src/gpu/GrContext.cpp | |
parent | a46969229d6b028f513995303001b659b4dcdc1d (diff) |
Move mock gpu and caps, add Gr prefix, and create via GrContext::Create
Change-Id: I02427839f78372e337ed717b071c6baaa8ba4450
Reviewed-on: https://skia-review.googlesource.com/20622
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rw-r--r-- | src/gpu/GrContext.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index b0d40f6668..405668d4c4 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -53,14 +53,12 @@ GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext) GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext, const GrContextOptions& options) { - GrContext* context = new GrContext; + sk_sp<GrContext> context(new GrContext); - if (context->init(backend, backendContext, options)) { - return context; - } else { - context->unref(); + if (!context->init(backend, backendContext, options)) { return nullptr; } + return context.release(); } static int32_t gNextID = 1; @@ -91,12 +89,6 @@ bool GrContext::init(GrBackend backend, GrBackendContext backendContext, if (!fGpu) { return false; } - this->initCommon(options); - return true; -} - -void GrContext::initCommon(const GrContextOptions& options) { - ASSERT_SINGLE_OWNER fCaps = SkRef(fGpu->caps()); fResourceCache = new GrResourceCache(fCaps, fUniqueID); @@ -113,6 +105,8 @@ void GrContext::initCommon(const GrContextOptions& options) { fAtlasGlyphCache = new GrAtlasGlyphCache(this, options.fGlyphCacheTextureMaximumBytes); fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB, this)); + + return true; } GrContext::~GrContext() { |