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 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 for (int i = 0; i < kNumPixelGeometries; ++i) { | 80 for (int i = 0; i < kNumPixelGeometries; ++i) { |
81 for (int j = 0; j < kNumDFTOptions; ++j) { | 81 for (int j = 0; j < kNumDFTOptions; ++j) { |
82 if (fDrawContext[i][j]) { | 82 if (fDrawContext[i][j]) { |
83 SkSafeSetNull(fDrawContext[i][j]->fDrawTarget); | 83 SkSafeSetNull(fDrawContext[i][j]->fDrawTarget); |
84 SkSafeSetNull(fDrawContext[i][j]); | 84 SkSafeSetNull(fDrawContext[i][j]); |
85 } | 85 } |
86 } | 86 } |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 void GrContext::DrawingMgr::purgeResources() { | |
91 if (fDrawTarget) { | |
92 fDrawTarget->purgeResources(); | |
93 } | |
94 } | |
95 | |
96 void GrContext::DrawingMgr::reset() { | 90 void GrContext::DrawingMgr::reset() { |
97 if (fDrawTarget) { | 91 if (fDrawTarget) { |
98 fDrawTarget->reset(); | 92 fDrawTarget->reset(); |
99 } | 93 } |
100 } | 94 } |
101 | 95 |
102 void GrContext::DrawingMgr::flush() { | 96 void GrContext::DrawingMgr::flush() { |
103 if (fDrawTarget) { | 97 if (fDrawTarget) { |
104 fDrawTarget->flush(); | 98 fDrawTarget->flush(); |
105 } | 99 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 fTextBlobCache->freeAll(); | 230 fTextBlobCache->freeAll(); |
237 } | 231 } |
238 | 232 |
239 void GrContext::resetContext(uint32_t state) { | 233 void GrContext::resetContext(uint32_t state) { |
240 fGpu->markContextDirty(state); | 234 fGpu->markContextDirty(state); |
241 } | 235 } |
242 | 236 |
243 void GrContext::freeGpuResources() { | 237 void GrContext::freeGpuResources() { |
244 this->flush(); | 238 this->flush(); |
245 | 239 |
246 fDrawingMgr.purgeResources(); | |
247 | |
248 fBatchFontCache->freeAll(); | 240 fBatchFontCache->freeAll(); |
249 fLayerCache->freeAll(); | 241 fLayerCache->freeAll(); |
250 // a path renderer may be holding onto resources | 242 // a path renderer may be holding onto resources |
251 SkSafeSetNull(fPathRendererChain); | 243 SkSafeSetNull(fPathRendererChain); |
252 SkSafeSetNull(fSoftwarePathRenderer); | 244 SkSafeSetNull(fSoftwarePathRenderer); |
253 | 245 |
254 fResourceCache->purgeAllUnlocked(); | 246 fResourceCache->purgeAllUnlocked(); |
255 } | 247 } |
256 | 248 |
257 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
const { | 249 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
const { |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 | 749 |
758 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ | 750 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ |
759 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 751 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
760 } | 752 } |
761 | 753 |
762 ////////////////////////////////////////////////////////////////////////////// | 754 ////////////////////////////////////////////////////////////////////////////// |
763 | 755 |
764 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 756 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
765 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 757 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
766 } | 758 } |
OLD | NEW |