OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 bool GrContext::init(GrBackend backend, GrBackendContext backendContext, | 69 bool GrContext::init(GrBackend backend, GrBackendContext backendContext, |
70 const GrContextOptions& options) { | 70 const GrContextOptions& options) { |
71 SkASSERT(!fGpu); | 71 SkASSERT(!fGpu); |
72 | 72 |
73 fGpu = GrGpu::Create(backend, backendContext, options, this); | 73 fGpu = GrGpu::Create(backend, backendContext, options, this); |
74 if (!fGpu) { | 74 if (!fGpu) { |
75 return false; | 75 return false; |
76 } | 76 } |
77 this->initCommon(); | 77 this->initCommon(options); |
78 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 void GrContext::initCommon() { | 81 void GrContext::initCommon(const GrContextOptions& options) { |
82 fCaps = SkRef(fGpu->caps()); | 82 fCaps = SkRef(fGpu->caps()); |
83 fResourceCache = new GrResourceCache(fCaps); | 83 fResourceCache = new GrResourceCache(fCaps); |
84 fResourceCache->setOverBudgetCallback(OverBudgetCB, this); | 84 fResourceCache->setOverBudgetCallback(OverBudgetCB, this); |
85 fResourceProvider = new GrResourceProvider(fGpu, fResourceCache); | 85 fResourceProvider = new GrResourceProvider(fGpu, fResourceCache); |
86 | 86 |
87 fLayerCache.reset(new GrLayerCache(this)); | 87 fLayerCache.reset(new GrLayerCache(this)); |
88 | 88 |
89 fDidTestPMConversions = false; | 89 fDidTestPMConversions = false; |
90 | 90 |
91 fDrawingManager.reset(new GrDrawingManager(this)); | 91 GrDrawTarget::Options dtOptions; |
| 92 dtOptions.fImmediateMode = options.fImmediateMode; |
| 93 fDrawingManager.reset(new GrDrawingManager(this, dtOptions)); |
92 | 94 |
93 // GrBatchFontCache will eventually replace GrFontCache | 95 // GrBatchFontCache will eventually replace GrFontCache |
94 fBatchFontCache = new GrBatchFontCache(this); | 96 fBatchFontCache = new GrBatchFontCache(this); |
95 | 97 |
96 fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB, this)); | 98 fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB, this)); |
97 } | 99 } |
98 | 100 |
99 GrContext::~GrContext() { | 101 GrContext::~GrContext() { |
100 if (!fGpu) { | 102 if (!fGpu) { |
101 SkASSERT(!fCaps); | 103 SkASSERT(!fCaps); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 667 |
666 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ | 668 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ |
667 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 669 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
668 } | 670 } |
669 | 671 |
670 ////////////////////////////////////////////////////////////////////////////// | 672 ////////////////////////////////////////////////////////////////////////////// |
671 | 673 |
672 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 674 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
673 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 675 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
674 } | 676 } |
OLD | NEW |