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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 fDrawTarget->reset(); | 104 fDrawTarget->reset(); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 void GrContext::DrawingMgr::flush() { | 108 void GrContext::DrawingMgr::flush() { |
109 if (fDrawTarget) { | 109 if (fDrawTarget) { |
110 fDrawTarget->flush(); | 110 fDrawTarget->flush(); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 GrDrawContext* GrContext::DrawingMgr::drawContext(const SkDeviceProperties* devP
rops, bool useDFT) { | 114 GrDrawContext* GrContext::DrawingMgr::drawContext(const SkDeviceProperties* devP
rops) { |
115 if (this->abandoned()) { | 115 if (this->abandoned()) { |
116 return NULL; | 116 return NULL; |
117 } | 117 } |
118 | 118 |
119 const SkDeviceProperties defProps; | 119 const SkDeviceProperties defProps; |
120 if (!devProps) { | 120 if (!devProps) { |
121 devProps = &defProps; | 121 devProps = &defProps; |
122 } | 122 } |
123 | 123 |
124 SkASSERT(devProps->pixelGeometry() < kNumPixelGeometries); | 124 SkASSERT(devProps->pixelGeometry() < kNumPixelGeometries); |
125 if (!fDrawContext[devProps->pixelGeometry()][useDFT]) { | 125 if (!fDrawContext[devProps->pixelGeometry()][devProps->useDFT()]) { |
126 fDrawContext[devProps->pixelGeometry()][useDFT] = | 126 fDrawContext[devProps->pixelGeometry()][devProps->useDFT()] = |
127 SkNEW_ARGS(GrDrawContext, (fContext, fDrawTarget, *devProps, use
DFT)); | 127 SkNEW_ARGS(GrDrawContext, (fContext, fDrawTarget, *devProps)); |
128 } | 128 } |
129 | 129 |
130 SkASSERT(fDrawContext[devProps->pixelGeometry()][useDFT]->fDevProps->pixelGe
ometry() == | 130 return fDrawContext[devProps->pixelGeometry()][devProps->useDFT()]; |
131 devProps->pixelGeometry()); | |
132 SkASSERT(fDrawContext[devProps->pixelGeometry()][useDFT]->fDevProps->gamma()
== | |
133 devProps->gamma()); | |
134 SkASSERT(fDrawContext[devProps->pixelGeometry()][useDFT]->fUseDFT == useDFT)
; | |
135 | |
136 return fDrawContext[devProps->pixelGeometry()][useDFT]; | |
137 } | 131 } |
138 | 132 |
139 //////////////////////////////////////////////////////////////////////////////// | 133 //////////////////////////////////////////////////////////////////////////////// |
140 | 134 |
141 | 135 |
142 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ | 136 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext)
{ |
143 GrContextOptions defaultOptions; | 137 GrContextOptions defaultOptions; |
144 return Create(backend, backendContext, defaultOptions); | 138 return Create(backend, backendContext, defaultOptions); |
145 } | 139 } |
146 | 140 |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 ////////////////////////////////////////////////////////////////////////////// | 755 ////////////////////////////////////////////////////////////////////////////// |
762 | 756 |
763 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { | 757 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { |
764 fGpu->addGpuTraceMarker(marker); | 758 fGpu->addGpuTraceMarker(marker); |
765 } | 759 } |
766 | 760 |
767 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 761 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
768 fGpu->removeGpuTraceMarker(marker); | 762 fGpu->removeGpuTraceMarker(marker); |
769 } | 763 } |
770 | 764 |
OLD | NEW |