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 |
11 #include "GrAARectRenderer.h" | 11 #include "GrAARectRenderer.h" |
12 #include "GrBatch.h" | 12 #include "GrBatch.h" |
13 #include "GrBatchFontCache.h" | 13 #include "GrBatchFontCache.h" |
14 #include "GrBatchTarget.h" | 14 #include "GrBatchTarget.h" |
15 #include "GrBatchTest.h" | 15 #include "GrBatchTest.h" |
| 16 #include "GrBufferedDrawTarget.h" |
16 #include "GrCaps.h" | 17 #include "GrCaps.h" |
17 #include "GrContextOptions.h" | 18 #include "GrContextOptions.h" |
18 #include "GrDefaultGeoProcFactory.h" | 19 #include "GrDefaultGeoProcFactory.h" |
19 #include "GrDrawContext.h" | 20 #include "GrDrawContext.h" |
20 #include "GrGpuResource.h" | 21 #include "GrGpuResource.h" |
21 #include "GrGpuResourcePriv.h" | 22 #include "GrGpuResourcePriv.h" |
22 #include "GrGpu.h" | 23 #include "GrGpu.h" |
23 #include "GrImmediateDrawTarget.h" | 24 #include "GrImmediateDrawTarget.h" |
24 #include "GrIndexBuffer.h" | 25 #include "GrIndexBuffer.h" |
25 #include "GrInOrderDrawBuffer.h" | |
26 #include "GrLayerCache.h" | 26 #include "GrLayerCache.h" |
27 #include "GrOvalRenderer.h" | 27 #include "GrOvalRenderer.h" |
28 #include "GrPathRenderer.h" | 28 #include "GrPathRenderer.h" |
29 #include "GrPathUtils.h" | 29 #include "GrPathUtils.h" |
30 #include "GrRenderTargetPriv.h" | 30 #include "GrRenderTargetPriv.h" |
31 #include "GrResourceCache.h" | 31 #include "GrResourceCache.h" |
32 #include "GrResourceProvider.h" | 32 #include "GrResourceProvider.h" |
33 #include "GrSoftwarePathRenderer.h" | 33 #include "GrSoftwarePathRenderer.h" |
34 #include "GrStrokeInfo.h" | 34 #include "GrStrokeInfo.h" |
35 #include "GrSurfacePriv.h" | 35 #include "GrSurfacePriv.h" |
(...skipping 23 matching lines...) Expand all Loading... |
59 | 59 |
60 | 60 |
61 //////////////////////////////////////////////////////////////////////////////// | 61 //////////////////////////////////////////////////////////////////////////////// |
62 | 62 |
63 void GrContext::DrawingMgr::init(GrContext* context) { | 63 void GrContext::DrawingMgr::init(GrContext* context) { |
64 fContext = context; | 64 fContext = context; |
65 | 65 |
66 #ifdef IMMEDIATE_MODE | 66 #ifdef IMMEDIATE_MODE |
67 fDrawTarget = SkNEW_ARGS(GrImmediateDrawTarget, (context)); | 67 fDrawTarget = SkNEW_ARGS(GrImmediateDrawTarget, (context)); |
68 #else | 68 #else |
69 fDrawTarget = SkNEW_ARGS(GrInOrderDrawBuffer, (context)); | 69 fDrawTarget = SkNEW_ARGS(GrBufferedDrawTarget, (context)); |
70 #endif | 70 #endif |
71 } | 71 } |
72 | 72 |
73 void GrContext::DrawingMgr::cleanup() { | 73 void GrContext::DrawingMgr::cleanup() { |
74 SkSafeSetNull(fDrawTarget); | 74 SkSafeSetNull(fDrawTarget); |
75 for (int i = 0; i < kNumPixelGeometries; ++i) { | 75 for (int i = 0; i < kNumPixelGeometries; ++i) { |
76 SkSafeSetNull(fDrawContext[i][0]); | 76 SkSafeSetNull(fDrawContext[i][0]); |
77 SkSafeSetNull(fDrawContext[i][1]); | 77 SkSafeSetNull(fDrawContext[i][1]); |
78 } | 78 } |
79 } | 79 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 //////////////////////////////////////////////////////////////////////////////// | 272 //////////////////////////////////////////////////////////////////////////////// |
273 | 273 |
274 void GrContext::OverBudgetCB(void* data) { | 274 void GrContext::OverBudgetCB(void* data) { |
275 SkASSERT(data); | 275 SkASSERT(data); |
276 | 276 |
277 GrContext* context = reinterpret_cast<GrContext*>(data); | 277 GrContext* context = reinterpret_cast<GrContext*>(data); |
278 | 278 |
279 // Flush the InOrderDrawBuffer to possibly free up some textures | 279 // Flush the GrBufferedDrawTarget to possibly free up some textures |
280 context->fFlushToReduceCacheSize = true; | 280 context->fFlushToReduceCacheSize = true; |
281 } | 281 } |
282 | 282 |
283 void GrContext::TextBlobCacheOverBudgetCB(void* data) { | 283 void GrContext::TextBlobCacheOverBudgetCB(void* data) { |
284 SkASSERT(data); | 284 SkASSERT(data); |
285 | 285 |
286 // 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 |
287 // 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 |
288 // 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 |
289 // drawPath on SkGpuDevice | 289 // drawPath on SkGpuDevice |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 ////////////////////////////////////////////////////////////////////////////// | 736 ////////////////////////////////////////////////////////////////////////////// |
737 | 737 |
738 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { | 738 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { |
739 fGpu->addGpuTraceMarker(marker); | 739 fGpu->addGpuTraceMarker(marker); |
740 } | 740 } |
741 | 741 |
742 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 742 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
743 fGpu->removeGpuTraceMarker(marker); | 743 fGpu->removeGpuTraceMarker(marker); |
744 } | 744 } |
745 | 745 |
OLD | NEW |