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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // limitations) should we disable AA or draw wrong? | 47 // limitations) should we disable AA or draw wrong? |
48 #define DISABLE_COVERAGE_AA_FOR_BLEND 1 | 48 #define DISABLE_COVERAGE_AA_FOR_BLEND 1 |
49 | 49 |
50 #ifdef SK_DEBUG | 50 #ifdef SK_DEBUG |
51 // change this to a 1 to see notifications when partial coverage fails | 51 // change this to a 1 to see notifications when partial coverage fails |
52 #define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0 | 52 #define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0 |
53 #else | 53 #else |
54 #define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0 | 54 #define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0 |
55 #endif | 55 #endif |
56 | 56 |
57 static const size_t MAX_TEXTURE_CACHE_COUNT = 2048; | 57 static const size_t MAX_RESOURCE_CACHE_COUNT = GR_DEFAULT_RESOURCE_CACHE_COUNT_L
IMIT; |
58 static const size_t MAX_TEXTURE_CACHE_BYTES = GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT
* 1024 * 1024; | 58 static const size_t MAX_RESOURCE_CACHE_BYTES = GR_DEFAULT_RESOURCE_CACHE_MB_LIMI
T * 1024 * 1024; |
59 | 59 |
60 static const size_t DRAW_BUFFER_VBPOOL_BUFFER_SIZE = 1 << 15; | 60 static const size_t DRAW_BUFFER_VBPOOL_BUFFER_SIZE = 1 << 15; |
61 static const int DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS = 4; | 61 static const int DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS = 4; |
62 | 62 |
63 static const size_t DRAW_BUFFER_IBPOOL_BUFFER_SIZE = 1 << 11; | 63 static const size_t DRAW_BUFFER_IBPOOL_BUFFER_SIZE = 1 << 11; |
64 static const int DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS = 4; | 64 static const int DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS = 4; |
65 | 65 |
66 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) | 66 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) |
67 | 67 |
68 // Glorified typedef to avoid including GrDrawState.h in GrContext.h | 68 // Glorified typedef to avoid including GrDrawState.h in GrContext.h |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 fGpu = GrGpu::Create(backend, backendContext, this); | 128 fGpu = GrGpu::Create(backend, backendContext, this); |
129 if (NULL == fGpu) { | 129 if (NULL == fGpu) { |
130 return false; | 130 return false; |
131 } | 131 } |
132 | 132 |
133 fDrawState = SkNEW(GrDrawState); | 133 fDrawState = SkNEW(GrDrawState); |
134 fGpu->setDrawState(fDrawState); | 134 fGpu->setDrawState(fDrawState); |
135 | 135 |
136 fTextureCache = SkNEW_ARGS(GrResourceCache, | 136 fTextureCache = SkNEW_ARGS(GrResourceCache, |
137 (MAX_TEXTURE_CACHE_COUNT, | 137 (MAX_RESOURCE_CACHE_COUNT, |
138 MAX_TEXTURE_CACHE_BYTES)); | 138 MAX_RESOURCE_CACHE_BYTES)); |
139 fTextureCache->setOverbudgetCallback(OverbudgetCB, this); | 139 fTextureCache->setOverbudgetCallback(OverbudgetCB, this); |
140 | 140 |
141 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); | 141 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); |
142 | 142 |
143 fLastDrawWasBuffered = kNo_BufferedDraw; | 143 fLastDrawWasBuffered = kNo_BufferedDraw; |
144 | 144 |
145 fAARectRenderer = SkNEW(GrAARectRenderer); | 145 fAARectRenderer = SkNEW(GrAARectRenderer); |
146 fOvalRenderer = SkNEW(GrOvalRenderer); | 146 fOvalRenderer = SkNEW(GrOvalRenderer); |
147 | 147 |
148 fDidTestPMConversions = false; | 148 fDidTestPMConversions = false; |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 return NULL; | 1809 return NULL; |
1810 } | 1810 } |
1811 } | 1811 } |
1812 | 1812 |
1813 /////////////////////////////////////////////////////////////////////////////// | 1813 /////////////////////////////////////////////////////////////////////////////// |
1814 #if GR_CACHE_STATS | 1814 #if GR_CACHE_STATS |
1815 void GrContext::printCacheStats() const { | 1815 void GrContext::printCacheStats() const { |
1816 fTextureCache->printStats(); | 1816 fTextureCache->printStats(); |
1817 } | 1817 } |
1818 #endif | 1818 #endif |
OLD | NEW |