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 #include "GrContext.h" | 9 #include "GrContext.h" |
10 | 10 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 GrContext::GrContext() : fUniqueID(next_id()) { | 139 GrContext::GrContext() : fUniqueID(next_id()) { |
140 fGpu = NULL; | 140 fGpu = NULL; |
141 fResourceCache = NULL; | 141 fResourceCache = NULL; |
142 fResourceProvider = NULL; | 142 fResourceProvider = NULL; |
143 fPathRendererChain = NULL; | 143 fPathRendererChain = NULL; |
144 fSoftwarePathRenderer = NULL; | 144 fSoftwarePathRenderer = NULL; |
145 fBatchFontCache = NULL; | 145 fBatchFontCache = NULL; |
146 fFlushToReduceCacheSize = false; | 146 fFlushToReduceCacheSize = false; |
147 fMaxTextureSizeOverride = 1 << 20; | |
148 } | 147 } |
149 | 148 |
150 bool GrContext::init(GrBackend backend, GrBackendContext backendContext, | 149 bool GrContext::init(GrBackend backend, GrBackendContext backendContext, |
151 const GrContextOptions& options) { | 150 const GrContextOptions& options) { |
152 SkASSERT(!fGpu); | 151 SkASSERT(!fGpu); |
153 | 152 |
154 fGpu = GrGpu::Create(backend, backendContext, options, this); | 153 fGpu = GrGpu::Create(backend, backendContext, options, this); |
155 if (!fGpu) { | 154 if (!fGpu) { |
156 return false; | 155 return false; |
157 } | 156 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 285 |
287 // Unlike the GrResourceCache, TextBlobs are drawn at the SkGpuDevice level,
therefore they | 286 // Unlike the GrResourceCache, TextBlobs are drawn at the SkGpuDevice level,
therefore they |
288 // cannot use fFlushTorReduceCacheSize because it uses AutoCheckFlush. The
solution is to move | 287 // cannot use fFlushTorReduceCacheSize because it uses AutoCheckFlush. The
solution is to move |
289 // drawText calls to below the GrContext level, but this is not trivial beca
use they call | 288 // drawText calls to below the GrContext level, but this is not trivial beca
use they call |
290 // drawPath on SkGpuDevice | 289 // drawPath on SkGpuDevice |
291 GrContext* context = reinterpret_cast<GrContext*>(data); | 290 GrContext* context = reinterpret_cast<GrContext*>(data); |
292 context->flush(); | 291 context->flush(); |
293 } | 292 } |
294 | 293 |
295 int GrContext::getMaxTextureSize() const { | 294 int GrContext::getMaxTextureSize() const { |
296 return SkTMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride); | 295 return fGpu->caps()->maxTextureSize(); |
297 } | 296 } |
298 | 297 |
299 int GrContext::getMaxRenderTargetSize() const { | 298 int GrContext::getMaxRenderTargetSize() const { |
300 return fGpu->caps()->maxRenderTargetSize(); | 299 return fGpu->caps()->maxRenderTargetSize(); |
301 } | 300 } |
302 | 301 |
303 int GrContext::getMaxSampleCount() const { | 302 int GrContext::getMaxSampleCount() const { |
304 return fGpu->caps()->maxSampleCount(); | 303 return fGpu->caps()->maxSampleCount(); |
305 } | 304 } |
306 | 305 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 ////////////////////////////////////////////////////////////////////////////// | 769 ////////////////////////////////////////////////////////////////////////////// |
771 | 770 |
772 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { | 771 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { |
773 fGpu->addGpuTraceMarker(marker); | 772 fGpu->addGpuTraceMarker(marker); |
774 } | 773 } |
775 | 774 |
776 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 775 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
777 fGpu->removeGpuTraceMarker(marker); | 776 fGpu->removeGpuTraceMarker(marker); |
778 } | 777 } |
779 | 778 |
OLD | NEW |