| 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 | 9 |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 fPathRendererChain = NULL; | 95 fPathRendererChain = NULL; |
| 96 fSoftwarePathRenderer = NULL; | 96 fSoftwarePathRenderer = NULL; |
| 97 fTextureCache = NULL; | 97 fTextureCache = NULL; |
| 98 fFontCache = NULL; | 98 fFontCache = NULL; |
| 99 fDrawBuffer = NULL; | 99 fDrawBuffer = NULL; |
| 100 fDrawBufferVBAllocPool = NULL; | 100 fDrawBufferVBAllocPool = NULL; |
| 101 fDrawBufferIBAllocPool = NULL; | 101 fDrawBufferIBAllocPool = NULL; |
| 102 fAARectRenderer = NULL; | 102 fAARectRenderer = NULL; |
| 103 fOvalRenderer = NULL; | 103 fOvalRenderer = NULL; |
| 104 fViewMatrix.reset(); | 104 fViewMatrix.reset(); |
| 105 fMaxTextureSizeOverride = 1 << 20; |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { | 108 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { |
| 108 GrAssert(NULL == fGpu); | 109 GrAssert(NULL == fGpu); |
| 109 | 110 |
| 110 fGpu = GrGpu::Create(backend, backendContext, this); | 111 fGpu = GrGpu::Create(backend, backendContext, this); |
| 111 if (NULL == fGpu) { | 112 if (NULL == fGpu) { |
| 112 return false; | 113 return false; |
| 113 } | 114 } |
| 114 | 115 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 void GrContext::getTextureCacheLimits(int* maxTextures, | 548 void GrContext::getTextureCacheLimits(int* maxTextures, |
| 548 size_t* maxTextureBytes) const { | 549 size_t* maxTextureBytes) const { |
| 549 fTextureCache->getLimits(maxTextures, maxTextureBytes); | 550 fTextureCache->getLimits(maxTextures, maxTextureBytes); |
| 550 } | 551 } |
| 551 | 552 |
| 552 void GrContext::setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) { | 553 void GrContext::setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) { |
| 553 fTextureCache->setLimits(maxTextures, maxTextureBytes); | 554 fTextureCache->setLimits(maxTextures, maxTextureBytes); |
| 554 } | 555 } |
| 555 | 556 |
| 556 int GrContext::getMaxTextureSize() const { | 557 int GrContext::getMaxTextureSize() const { |
| 557 return fGpu->caps()->maxTextureSize(); | 558 return GrMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride); |
| 558 } | 559 } |
| 559 | 560 |
| 560 int GrContext::getMaxRenderTargetSize() const { | 561 int GrContext::getMaxRenderTargetSize() const { |
| 561 return fGpu->caps()->maxRenderTargetSize(); | 562 return fGpu->caps()->maxRenderTargetSize(); |
| 562 } | 563 } |
| 563 | 564 |
| 564 int GrContext::getMaxSampleCount() const { | 565 int GrContext::getMaxSampleCount() const { |
| 565 return fGpu->caps()->maxSampleCount(); | 566 return fGpu->caps()->maxSampleCount(); |
| 566 } | 567 } |
| 567 | 568 |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 return NULL; | 1704 return NULL; |
| 1704 } | 1705 } |
| 1705 } | 1706 } |
| 1706 | 1707 |
| 1707 /////////////////////////////////////////////////////////////////////////////// | 1708 /////////////////////////////////////////////////////////////////////////////// |
| 1708 #if GR_CACHE_STATS | 1709 #if GR_CACHE_STATS |
| 1709 void GrContext::printCacheStats() const { | 1710 void GrContext::printCacheStats() const { |
| 1710 fTextureCache->printStats(); | 1711 fTextureCache->printStats(); |
| 1711 } | 1712 } |
| 1712 #endif | 1713 #endif |
| OLD | NEW |