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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRe
nderTarget(); | 134 GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRe
nderTarget(); |
135 SkASSERT(rt); | 135 SkASSERT(rt); |
136 | 136 |
137 // TODO: sorting the cacheable layers from smallest to largest | 137 // TODO: sorting the cacheable layers from smallest to largest |
138 // would improve the packing and reduce the number of swaps | 138 // would improve the packing and reduce the number of swaps |
139 // TODO: another optimization would be to make a first pass to | 139 // TODO: another optimization would be to make a first pass to |
140 // lock any required layer that is already in the atlas | 140 // lock any required layer that is already in the atlas |
141 GrLayerHoister::FindLayersToAtlas(context, data.fPicture, initialMat
rix, | 141 GrLayerHoister::FindLayersToAtlas(context, data.fPicture, initialMat
rix, |
142 clipBounds, | 142 clipBounds, |
143 &atlasedNeedRendering, &atlasedRec
ycled, | 143 &atlasedNeedRendering, &atlasedRec
ycled, |
144 rt->numSamples()); | 144 rt->numColorSamples()); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 GrLayerHoister::DrawLayersToAtlas(context, atlasedNeedRendering); | 148 GrLayerHoister::DrawLayersToAtlas(context, atlasedNeedRendering); |
149 | 149 |
150 SkTDArray<GrHoistedLayer> needRendering, recycled; | 150 SkTDArray<GrHoistedLayer> needRendering, recycled; |
151 #endif | 151 #endif |
152 | 152 |
153 for (int i = 0; i < count; ++i) { | 153 for (int i = 0; i < count; ++i) { |
154 const DrawData& data = fGPUDrawData[i]; | 154 const DrawData& data = fGPUDrawData[i]; |
(...skipping 12 matching lines...) Expand all Loading... |
167 | 167 |
168 const SkMatrix initialMatrix = canvas->getTotalMatrix(); | 168 const SkMatrix initialMatrix = canvas->getTotalMatrix(); |
169 | 169 |
170 GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRe
nderTarget(); | 170 GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRe
nderTarget(); |
171 SkASSERT(rt); | 171 SkASSERT(rt); |
172 | 172 |
173 // Find the layers required by this canvas. It will return atlased | 173 // Find the layers required by this canvas. It will return atlased |
174 // layers in the 'recycled' list since they have already been drawn. | 174 // layers in the 'recycled' list since they have already been drawn. |
175 GrLayerHoister::FindLayersToHoist(context, picture, initialMatrix, | 175 GrLayerHoister::FindLayersToHoist(context, picture, initialMatrix, |
176 clipBounds, &needRendering, &recyc
led, | 176 clipBounds, &needRendering, &recyc
led, |
177 rt->numSamples()); | 177 rt->numColorSamples()); |
178 | 178 |
179 GrLayerHoister::DrawLayers(context, needRendering); | 179 GrLayerHoister::DrawLayers(context, needRendering); |
180 | 180 |
181 // Render the entire picture using new layers | 181 // Render the entire picture using new layers |
182 GrRecordReplaceDraw(picture, canvas, context->getLayerCache(), | 182 GrRecordReplaceDraw(picture, canvas, context->getLayerCache(), |
183 initialMatrix, NULL); | 183 initialMatrix, NULL); |
184 | 184 |
185 GrLayerHoister::UnlockLayers(context, needRendering); | 185 GrLayerHoister::UnlockLayers(context, needRendering); |
186 GrLayerHoister::UnlockLayers(context, recycled); | 186 GrLayerHoister::UnlockLayers(context, recycled); |
187 | 187 |
(...skipping 11 matching lines...) Expand all Loading... |
199 | 199 |
200 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU | 200 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU |
201 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); | 201 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); |
202 GrLayerHoister::UnlockLayers(context, atlasedRecycled); | 202 GrLayerHoister::UnlockLayers(context, atlasedRecycled); |
203 #if !GR_CACHE_HOISTED_LAYERS | 203 #if !GR_CACHE_HOISTED_LAYERS |
204 GrLayerHoister::PurgeCache(context); | 204 GrLayerHoister::PurgeCache(context); |
205 #endif | 205 #endif |
206 #endif | 206 #endif |
207 } | 207 } |
208 | 208 |
OLD | NEW |