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 | |
121 for (int i = 0; i < count; ++i) { | 119 for (int i = 0; i < count; ++i) { |
122 const DrawData& data = fGPUDrawData[i]; | 120 const DrawData& data = fGPUDrawData[i]; |
123 // we only expect 1 context for all the canvases | 121 // we only expect 1 context for all the canvases |
124 SkASSERT(data.fCanvas->getGrContext() == context); | 122 SkASSERT(data.fCanvas->getGrContext() == context); |
125 | 123 |
126 if (!data.fPaint) { | 124 if (!data.fPaint) { |
127 SkRect clipBounds; | 125 SkRect clipBounds; |
128 if (!data.fCanvas->getClipBounds(&clipBounds)) { | 126 if (!data.fCanvas->getClipBounds(&clipBounds)) { |
129 continue; | 127 continue; |
130 } | 128 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 canvas->drawPicture(picture, &data.fMatrix, data.fPaint); | 192 canvas->drawPicture(picture, &data.fMatrix, data.fPaint); |
195 } | 193 } |
196 if (flush) { | 194 if (flush) { |
197 canvas->flush(); | 195 canvas->flush(); |
198 } | 196 } |
199 } | 197 } |
200 | 198 |
201 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU | 199 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU |
202 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); | 200 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); |
203 GrLayerHoister::UnlockLayers(context, atlasedRecycled); | 201 GrLayerHoister::UnlockLayers(context, atlasedRecycled); |
204 GrLayerHoister::End(context); | 202 #if !GR_CACHE_HOISTED_LAYERS |
| 203 GrLayerHoister::PurgeCache(context); |
| 204 #endif |
205 #endif | 205 #endif |
206 } | 206 } |
207 | 207 |
OLD | NEW |