OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 // Need to include something before #if SK_SUPPORT_GPU so that the Android | 8 // Need to include something before #if SK_SUPPORT_GPU so that the Android |
9 // framework build, which gets its defines from SkTypes rather than a makefile, | 9 // framework build, which gets its defines from SkTypes rather than a makefile, |
10 // has the definition before checking it. | 10 // has the definition before checking it. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU | 110 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU |
111 GrContext* context = fGPUDrawData[0].fCanvas->getGrContext(); | 111 GrContext* context = fGPUDrawData[0].fCanvas->getGrContext(); |
112 SkASSERT(context); | 112 SkASSERT(context); |
113 | 113 |
114 // Start by collecting all the layers that are going to be atlased and rende
r | 114 // Start by collecting all the layers that are going to be atlased and rende
r |
115 // them (if necessary). Hoisting the free floating layers is deferred until | 115 // them (if necessary). Hoisting the free floating layers is deferred until |
116 // drawing the canvas that requires them. | 116 // drawing the canvas that requires them. |
117 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; | 117 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; |
118 | 118 |
| 119 GrLayerHoister::Begin(context); |
| 120 |
119 for (int i = 0; i < count; ++i) { | 121 for (int i = 0; i < count; ++i) { |
120 const DrawData& data = fGPUDrawData[i]; | 122 const DrawData& data = fGPUDrawData[i]; |
121 // we only expect 1 context for all the canvases | 123 // we only expect 1 context for all the canvases |
122 SkASSERT(data.fCanvas->getGrContext() == context); | 124 SkASSERT(data.fCanvas->getGrContext() == context); |
123 | 125 |
124 if (!data.fPaint) { | 126 if (!data.fPaint) { |
125 SkRect clipBounds; | 127 SkRect clipBounds; |
126 if (!data.fCanvas->getClipBounds(&clipBounds)) { | 128 if (!data.fCanvas->getClipBounds(&clipBounds)) { |
127 continue; | 129 continue; |
128 } | 130 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 canvas->drawPicture(picture, &data.fMatrix, data.fPaint); | 194 canvas->drawPicture(picture, &data.fMatrix, data.fPaint); |
193 } | 195 } |
194 if (flush) { | 196 if (flush) { |
195 canvas->flush(); | 197 canvas->flush(); |
196 } | 198 } |
197 } | 199 } |
198 | 200 |
199 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU | 201 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU |
200 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); | 202 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); |
201 GrLayerHoister::UnlockLayers(context, atlasedRecycled); | 203 GrLayerHoister::UnlockLayers(context, atlasedRecycled); |
202 #if !GR_CACHE_HOISTED_LAYERS | 204 GrLayerHoister::End(context); |
203 GrLayerHoister::PurgeCache(context); | |
204 #endif | |
205 #endif | 205 #endif |
206 } | 206 } |
207 | 207 |
OLD | NEW |