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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 fSoftwarePathRenderer = NULL; | 97 fSoftwarePathRenderer = NULL; |
98 fTextureCache = NULL; | 98 fTextureCache = NULL; |
99 fFontCache = NULL; | 99 fFontCache = NULL; |
100 fDrawBuffer = NULL; | 100 fDrawBuffer = NULL; |
101 fDrawBufferVBAllocPool = NULL; | 101 fDrawBufferVBAllocPool = NULL; |
102 fDrawBufferIBAllocPool = NULL; | 102 fDrawBufferIBAllocPool = NULL; |
103 fAARectRenderer = NULL; | 103 fAARectRenderer = NULL; |
104 fOvalRenderer = NULL; | 104 fOvalRenderer = NULL; |
105 fViewMatrix.reset(); | 105 fViewMatrix.reset(); |
106 fMaxTextureSizeOverride = 1 << 20; | 106 fMaxTextureSizeOverride = 1 << 20; |
| 107 fFlushCount = 0; |
107 } | 108 } |
108 | 109 |
109 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { | 110 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { |
110 GrAssert(NULL == fGpu); | 111 GrAssert(NULL == fGpu); |
111 | 112 |
112 fGpu = GrGpu::Create(backend, backendContext, this); | 113 fGpu = GrGpu::Create(backend, backendContext, this); |
113 if (NULL == fGpu) { | 114 if (NULL == fGpu) { |
114 return false; | 115 return false; |
115 } | 116 } |
116 | 117 |
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 void GrContext::flush(int flagsBitfield) { | 1144 void GrContext::flush(int flagsBitfield) { |
1144 if (NULL == fDrawBuffer) { | 1145 if (NULL == fDrawBuffer) { |
1145 return; | 1146 return; |
1146 } | 1147 } |
1147 | 1148 |
1148 if (kDiscard_FlushBit & flagsBitfield) { | 1149 if (kDiscard_FlushBit & flagsBitfield) { |
1149 fDrawBuffer->reset(); | 1150 fDrawBuffer->reset(); |
1150 } else { | 1151 } else { |
1151 fDrawBuffer->flush(); | 1152 fDrawBuffer->flush(); |
1152 } | 1153 } |
| 1154 ++fFlushCount; |
1153 } | 1155 } |
1154 | 1156 |
1155 bool GrContext::writeTexturePixels(GrTexture* texture, | 1157 bool GrContext::writeTexturePixels(GrTexture* texture, |
1156 int left, int top, int width, int height, | 1158 int left, int top, int width, int height, |
1157 GrPixelConfig config, const void* buffer, siz
e_t rowBytes, | 1159 GrPixelConfig config, const void* buffer, siz
e_t rowBytes, |
1158 uint32_t flags) { | 1160 uint32_t flags) { |
1159 SK_TRACE_EVENT0("GrContext::writeTexturePixels"); | 1161 SK_TRACE_EVENT0("GrContext::writeTexturePixels"); |
1160 ASSERT_OWNED_RESOURCE(texture); | 1162 ASSERT_OWNED_RESOURCE(texture); |
1161 | 1163 |
1162 if ((kUnpremul_PixelOpsFlag & flags) || !fGpu->canWriteTexturePixels(texture
, config)) { | 1164 if ((kUnpremul_PixelOpsFlag & flags) || !fGpu->canWriteTexturePixels(texture
, config)) { |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 return NULL; | 1719 return NULL; |
1718 } | 1720 } |
1719 } | 1721 } |
1720 | 1722 |
1721 /////////////////////////////////////////////////////////////////////////////// | 1723 /////////////////////////////////////////////////////////////////////////////// |
1722 #if GR_CACHE_STATS | 1724 #if GR_CACHE_STATS |
1723 void GrContext::printCacheStats() const { | 1725 void GrContext::printCacheStats() const { |
1724 fTextureCache->printStats(); | 1726 fTextureCache->printStats(); |
1725 } | 1727 } |
1726 #endif | 1728 #endif |
OLD | NEW |