From 43f8bf0f784f4182ed0fca9053ecf570caf7ad70 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Wed, 18 Oct 2017 08:33:29 -0400 Subject: Move clear-as-draw workaround to GrGLGpu and expose via GrContextOptions. Bug: skia:7154 Change-Id: I23ffc11dab4a377fbd6b7e4e33722b3fa0793d58 Reviewed-on: https://skia-review.googlesource.com/60681 Commit-Queue: Brian Salomon Reviewed-by: Robert Phillips --- tools/gpu/GrContextFactory.cpp | 6 ++++-- tools/gpu/GrContextFactory.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'tools/gpu') diff --git a/tools/gpu/GrContextFactory.cpp b/tools/gpu/GrContextFactory.cpp index b3ca1d929e..1bc4655558 100644 --- a/tools/gpu/GrContextFactory.cpp +++ b/tools/gpu/GrContextFactory.cpp @@ -116,7 +116,8 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv context.fShareIndex == shareIndex && !context.fAbandoned) { context.fTestContext->makeCurrent(); - return ContextInfo(context.fType, context.fTestContext, context.fGrContext); + return ContextInfo(context.fType, context.fTestContext, context.fGrContext, + context.fOptions); } } @@ -288,7 +289,8 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv context.fAbandoned = false; context.fShareContext = shareContext; context.fShareIndex = shareIndex; - return ContextInfo(context.fType, context.fTestContext, context.fGrContext); + context.fOptions = grOptions; + return ContextInfo(context.fType, context.fTestContext, context.fGrContext, context.fOptions); } ContextInfo GrContextFactory::getContextInfo(ContextType type, ContextOverrides overrides) { diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h index 8d3e69c765..1073f6a594 100644 --- a/tools/gpu/GrContextFactory.h +++ b/tools/gpu/GrContextFactory.h @@ -159,6 +159,7 @@ private: struct Context { ContextType fType; ContextOverrides fOverrides; + GrContextOptions fOptions; GrBackend fBackend; TestContext* fTestContext; GrContext* fGrContext; @@ -189,19 +190,18 @@ public: return static_cast(fTestContext); } + const GrContextOptions& options() const { return fOptions; } + private: - ContextInfo(GrContextFactory::ContextType type, - TestContext* testContext, - GrContext* grContext) - : fType(type) - , fTestContext(testContext) - , fGrContext(grContext) { - } + ContextInfo(GrContextFactory::ContextType type, TestContext* testContext, GrContext* grContext, + const GrContextOptions& options) + : fType(type), fTestContext(testContext), fGrContext(grContext), fOptions(options) {} GrContextFactory::ContextType fType = GrContextFactory::kGL_ContextType; // Valid until the factory destroys it via abandonContexts() or destroyContexts(). - TestContext* fTestContext = nullptr; - GrContext* fGrContext = nullptr; + TestContext* fTestContext = nullptr; + GrContext* fGrContext = nullptr; + GrContextOptions fOptions; friend class GrContextFactory; }; -- cgit v1.2.3