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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // them (if necessary). Hoisting the free floating layers is deferred until | 105 // them (if necessary). Hoisting the free floating layers is deferred until |
106 // drawing the canvas that requires them. | 106 // drawing the canvas that requires them. |
107 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; | 107 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; |
108 | 108 |
109 for (int i = 0; i < count; ++i) { | 109 for (int i = 0; i < count; ++i) { |
110 const DrawData& data = fGPUDrawData[i]; | 110 const DrawData& data = fGPUDrawData[i]; |
111 // we only expect 1 context for all the canvases | 111 // we only expect 1 context for all the canvases |
112 SkASSERT(data.fCanvas->getGrContext() == context); | 112 SkASSERT(data.fCanvas->getGrContext() == context); |
113 | 113 |
114 if (!data.fPaint && data.fMatrix.isIdentity()) { | 114 if (!data.fPaint && data.fMatrix.isIdentity()) { |
115 // TODO: this path always tries to optimize pictures. Should we | |
116 // switch to this API approach (vs. SkCanvas::EXPERIMENTAL_optimize)
? | |
117 data.fCanvas->EXPERIMENTAL_optimize(data.fPicture); | |
118 | |
119 SkRect clipBounds; | 115 SkRect clipBounds; |
120 if (!data.fCanvas->getClipBounds(&clipBounds)) { | 116 if (!data.fCanvas->getClipBounds(&clipBounds)) { |
121 continue; | 117 continue; |
122 } | 118 } |
123 | 119 |
124 GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRe
nderTarget(); | 120 GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRe
nderTarget(); |
125 SkASSERT(rt); | 121 SkASSERT(rt); |
126 | 122 |
127 // TODO: sorting the cacheable layers from smallest to largest | 123 // TODO: sorting the cacheable layers from smallest to largest |
128 // would improve the packing and reduce the number of swaps | 124 // would improve the packing and reduce the number of swaps |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 184 |
189 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU | 185 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU |
190 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); | 186 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); |
191 GrLayerHoister::UnlockLayers(context, atlasedRecycled); | 187 GrLayerHoister::UnlockLayers(context, atlasedRecycled); |
192 #if !GR_CACHE_HOISTED_LAYERS | 188 #if !GR_CACHE_HOISTED_LAYERS |
193 GrLayerHoister::PurgeCache(context); | 189 GrLayerHoister::PurgeCache(context); |
194 #endif | 190 #endif |
195 #endif | 191 #endif |
196 } | 192 } |
197 | 193 |
OLD | NEW |