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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 GrAssert(NULL == fGpu); | 108 GrAssert(NULL == fGpu); |
109 | 109 |
110 fGpu = GrGpu::Create(backend, backendContext, this); | 110 fGpu = GrGpu::Create(backend, backendContext, this); |
111 if (NULL == fGpu) { | 111 if (NULL == fGpu) { |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 fDrawState = SkNEW(GrDrawState); | 115 fDrawState = SkNEW(GrDrawState); |
116 fGpu->setDrawState(fDrawState); | 116 fGpu->setDrawState(fDrawState); |
117 | 117 |
| 118 this->setReuseScratchTextures(fGpu->caps()->reuseScratchTextures()); |
118 | 119 |
119 fTextureCache = SkNEW_ARGS(GrResourceCache, | 120 fTextureCache = SkNEW_ARGS(GrResourceCache, |
120 (MAX_TEXTURE_CACHE_COUNT, | 121 (MAX_TEXTURE_CACHE_COUNT, |
121 MAX_TEXTURE_CACHE_BYTES)); | 122 MAX_TEXTURE_CACHE_BYTES)); |
122 fTextureCache->setOverbudgetCallback(OverbudgetCB, this); | 123 fTextureCache->setOverbudgetCallback(OverbudgetCB, this); |
123 | 124 |
124 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); | 125 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); |
125 | 126 |
126 fLastDrawWasBuffered = kNo_BufferedDraw; | 127 fLastDrawWasBuffered = kNo_BufferedDraw; |
127 | 128 |
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 return NULL; | 1681 return NULL; |
1681 } | 1682 } |
1682 } | 1683 } |
1683 | 1684 |
1684 /////////////////////////////////////////////////////////////////////////////// | 1685 /////////////////////////////////////////////////////////////////////////////// |
1685 #if GR_CACHE_STATS | 1686 #if GR_CACHE_STATS |
1686 void GrContext::printCacheStats() const { | 1687 void GrContext::printCacheStats() const { |
1687 fTextureCache->printStats(); | 1688 fTextureCache->printStats(); |
1688 } | 1689 } |
1689 #endif | 1690 #endif |
OLD | NEW |