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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(GrBufferedDrawTarget, (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 } |
80 | 80 |
(...skipping 24 matching lines...) Expand all Loading... | |
105 fDrawTarget->reset(); | 105 fDrawTarget->reset(); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 void GrContext::DrawingMgr::flush() { | 109 void GrContext::DrawingMgr::flush() { |
110 if (fDrawTarget) { | 110 if (fDrawTarget) { |
111 fDrawTarget->flush(); | 111 fDrawTarget->flush(); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 GrDrawContext* GrContext::DrawingMgr::drawContext(const SkSurfaceProps* surfaceP rops) { | 115 GrDrawContext* GrContext::DrawingMgr::drawContext(const SkSurfaceProps* surfaceP rops) { |
116 if (this->abandoned()) { | 116 if (this->abandoned()) { |
117 return NULL; | 117 return NULL; |
118 } | 118 } |
119 | 119 |
120 const SkSurfaceProps props(SkSurfacePropsCopyOrDefault(surfaceProps)); | 120 const SkSurfaceProps props(SkSurfacePropsCopyOrDefault(surfaceProps)); |
121 | 121 |
122 SkASSERT(props.pixelGeometry() < kNumPixelGeometries); | 122 SkASSERT(props.pixelGeometry() < kNumPixelGeometries); |
123 if (!fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()]) { | 123 if (!fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()]) { |
124 fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()] = | 124 fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()] = |
125 SkNEW_ARGS(GrDrawContext, (fContext, fDrawTarget, props)); | 125 SkNEW_ARGS(GrDrawContext, (fContext, fDrawTarget, props)); |
126 } | 126 } |
127 | 127 |
128 return fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()]; | 128 return fDrawContext[props.pixelGeometry()][props.isUseDistanceFieldFonts()]; |
129 } | 129 } |
130 | 130 |
131 //////////////////////////////////////////////////////////////////////////////// | 131 //////////////////////////////////////////////////////////////////////////////// |
132 | 132 |
133 | 133 |
134 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext) { | 134 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext) { |
135 GrContextOptions defaultOptions; | 135 GrContextOptions defaultOptions; |
136 return Create(backend, backendContext, defaultOptions); | 136 return Create(backend, backendContext, defaultOptions); |
137 } | 137 } |
138 | 138 |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 ////////////////////////////////////////////////////////////////////////////// | 754 ////////////////////////////////////////////////////////////////////////////// |
755 | 755 |
756 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { | 756 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { |
757 fGpu->addGpuTraceMarker(marker); | 757 fGpu->addGpuTraceMarker(marker); |
758 } | 758 } |
759 | 759 |
760 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 760 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
761 fGpu->removeGpuTraceMarker(marker); | 761 fGpu->removeGpuTraceMarker(marker); |
762 } | 762 } |
763 | 763 |
764 ////////////////////////////////////////////////////////////////////////////// | |
ssid
2015/08/26 17:10:03
New line after this?
ericrk
2015/08/26 19:40:21
done.
| |
765 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | |
766 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | |
767 } | |
OLD | NEW |