Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: src/gpu/GrContext.cpp

Issue 217343006: Add a GrLayerCache to GrContext (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fixed compiler complaint Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrLayerCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 11
12 #include "effects/GrSingleTextureEffect.h" 12 #include "effects/GrSingleTextureEffect.h"
13 #include "effects/GrConfigConversionEffect.h" 13 #include "effects/GrConfigConversionEffect.h"
14 14
15 #include "GrAARectRenderer.h" 15 #include "GrAARectRenderer.h"
16 #include "GrBufferAllocPool.h" 16 #include "GrBufferAllocPool.h"
17 #include "GrGpu.h" 17 #include "GrGpu.h"
18 #include "GrDrawTargetCaps.h" 18 #include "GrDrawTargetCaps.h"
19 #include "GrIndexBuffer.h" 19 #include "GrIndexBuffer.h"
20 #include "GrInOrderDrawBuffer.h" 20 #include "GrInOrderDrawBuffer.h"
21 #include "GrLayerCache.h"
21 #include "GrOvalRenderer.h" 22 #include "GrOvalRenderer.h"
22 #include "GrPathRenderer.h" 23 #include "GrPathRenderer.h"
23 #include "GrPathUtils.h" 24 #include "GrPathUtils.h"
24 #include "GrResourceCache.h" 25 #include "GrResourceCache.h"
25 #include "GrSoftwarePathRenderer.h" 26 #include "GrSoftwarePathRenderer.h"
26 #include "GrStencilBuffer.h" 27 #include "GrStencilBuffer.h"
27 #include "GrTextStrike.h" 28 #include "GrTextStrike.h"
28 #include "GrTracing.h" 29 #include "GrTracing.h"
29 #include "SkGr.h" 30 #include "SkGr.h"
30 #include "SkRTConf.h" 31 #include "SkRTConf.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 fDrawState = SkNEW(GrDrawState); 118 fDrawState = SkNEW(GrDrawState);
118 fGpu->setDrawState(fDrawState); 119 fGpu->setDrawState(fDrawState);
119 120
120 fTextureCache = SkNEW_ARGS(GrResourceCache, 121 fTextureCache = SkNEW_ARGS(GrResourceCache,
121 (MAX_RESOURCE_CACHE_COUNT, 122 (MAX_RESOURCE_CACHE_COUNT,
122 MAX_RESOURCE_CACHE_BYTES)); 123 MAX_RESOURCE_CACHE_BYTES));
123 fTextureCache->setOverbudgetCallback(OverbudgetCB, this); 124 fTextureCache->setOverbudgetCallback(OverbudgetCB, this);
124 125
125 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); 126 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu));
126 127
128 fLayerCache.reset(SkNEW_ARGS(GrLayerCache, (fGpu)));
129
127 fLastDrawWasBuffered = kNo_BufferedDraw; 130 fLastDrawWasBuffered = kNo_BufferedDraw;
128 131
129 fAARectRenderer = SkNEW(GrAARectRenderer); 132 fAARectRenderer = SkNEW(GrAARectRenderer);
130 fOvalRenderer = SkNEW(GrOvalRenderer); 133 fOvalRenderer = SkNEW(GrOvalRenderer);
131 134
132 fDidTestPMConversions = false; 135 fDidTestPMConversions = false;
133 136
134 this->setupDrawBuffer(); 137 this->setupDrawBuffer();
135 138
136 return true; 139 return true;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 193
191 delete fDrawBufferIBAllocPool; 194 delete fDrawBufferIBAllocPool;
192 fDrawBufferIBAllocPool = NULL; 195 fDrawBufferIBAllocPool = NULL;
193 196
194 fAARectRenderer->reset(); 197 fAARectRenderer->reset();
195 fOvalRenderer->reset(); 198 fOvalRenderer->reset();
196 199
197 fTextureCache->purgeAllUnlocked(); 200 fTextureCache->purgeAllUnlocked();
198 201
199 fFontCache->freeAll(); 202 fFontCache->freeAll();
203 fLayerCache->freeAll();
200 fGpu->markContextDirty(); 204 fGpu->markContextDirty();
201 } 205 }
202 206
203 void GrContext::resetContext(uint32_t state) { 207 void GrContext::resetContext(uint32_t state) {
204 fGpu->markContextDirty(state); 208 fGpu->markContextDirty(state);
205 } 209 }
206 210
207 void GrContext::freeGpuResources() { 211 void GrContext::freeGpuResources() {
208 this->flush(); 212 this->flush();
209 213
210 fGpu->purgeResources(); 214 fGpu->purgeResources();
211 215
212 fAARectRenderer->reset(); 216 fAARectRenderer->reset();
213 fOvalRenderer->reset(); 217 fOvalRenderer->reset();
214 218
215 fTextureCache->purgeAllUnlocked(); 219 fTextureCache->purgeAllUnlocked();
216 fFontCache->freeAll(); 220 fFontCache->freeAll();
221 fLayerCache->freeAll();
217 // a path renderer may be holding onto resources 222 // a path renderer may be holding onto resources
218 SkSafeSetNull(fPathRendererChain); 223 SkSafeSetNull(fPathRendererChain);
219 SkSafeSetNull(fSoftwarePathRenderer); 224 SkSafeSetNull(fSoftwarePathRenderer);
220 } 225 }
221 226
222 size_t GrContext::getGpuTextureCacheBytes() const { 227 size_t GrContext::getGpuTextureCacheBytes() const {
223 return fTextureCache->getCachedResourceBytes(); 228 return fTextureCache->getCachedResourceBytes();
224 } 229 }
225 230
226 int GrContext::getGpuTextureCacheResourceCount() const { 231 int GrContext::getGpuTextureCacheResourceCount() const {
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 } 1798 }
1794 return path; 1799 return path;
1795 } 1800 }
1796 1801
1797 /////////////////////////////////////////////////////////////////////////////// 1802 ///////////////////////////////////////////////////////////////////////////////
1798 #if GR_CACHE_STATS 1803 #if GR_CACHE_STATS
1799 void GrContext::printCacheStats() const { 1804 void GrContext::printCacheStats() const {
1800 fTextureCache->printStats(); 1805 fTextureCache->printStats();
1801 } 1806 }
1802 #endif 1807 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrLayerCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698