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 #if SK_SUPPORT_GPU | 8 #if SK_SUPPORT_GPU |
9 #include "GrLayerHoister.h" | 9 #include "GrLayerHoister.h" |
10 #include "GrRecordReplaceDraw.h" | 10 #include "GrRecordReplaceDraw.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 SkASSERT(context); | 107 SkASSERT(context); |
108 | 108 |
109 // Start by collecting all the layers that are going to be atlased and rende
r | 109 // Start by collecting all the layers that are going to be atlased and rende
r |
110 // them (if necessary). Hoisting the free floating layers is deferred until | 110 // them (if necessary). Hoisting the free floating layers is deferred until |
111 // drawing the canvas that requires them. | 111 // drawing the canvas that requires them. |
112 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; | 112 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; |
113 | 113 |
114 for (int i = 0; i < count; ++i) { | 114 for (int i = 0; i < count; ++i) { |
115 const DrawData& data = fGPUDrawData[i]; | 115 const DrawData& data = fGPUDrawData[i]; |
116 // we only expect 1 context for all the canvases | 116 // we only expect 1 context for all the canvases |
117 SkASSERT(data.canvas->getGrContext() == context); | 117 SkASSERT(data.fCanvas->getGrContext() == context); |
118 | 118 |
119 if (!data.fPaint && data.fMatrix.isIdentity()) { | 119 if (!data.fPaint && data.fMatrix.isIdentity()) { |
120 // TODO: this path always tries to optimize pictures. Should we | 120 // TODO: this path always tries to optimize pictures. Should we |
121 // switch to this API approach (vs. SkCanvas::EXPERIMENTAL_optimize)
? | 121 // switch to this API approach (vs. SkCanvas::EXPERIMENTAL_optimize)
? |
122 data.fCanvas->EXPERIMENTAL_optimize(data.fPicture); | 122 data.fCanvas->EXPERIMENTAL_optimize(data.fPicture); |
123 | 123 |
124 SkRect clipBounds; | 124 SkRect clipBounds; |
125 if (!data.fCanvas->getClipBounds(&clipBounds)) { | 125 if (!data.fCanvas->getClipBounds(&clipBounds)) { |
126 continue; | 126 continue; |
127 } | 127 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 #ifndef SK_IGNORE_GPU_LAYER_HOISTING | 186 #ifndef SK_IGNORE_GPU_LAYER_HOISTING |
187 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); | 187 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); |
188 GrLayerHoister::UnlockLayers(context, atlasedRecycled); | 188 GrLayerHoister::UnlockLayers(context, atlasedRecycled); |
189 #if !GR_CACHE_HOISTED_LAYERS | 189 #if !GR_CACHE_HOISTED_LAYERS |
190 GrLayerHoister::PurgeCache(context); | 190 GrLayerHoister::PurgeCache(context); |
191 #endif | 191 #endif |
192 #endif | 192 #endif |
193 } | 193 } |
194 | 194 |
OLD | NEW |