| 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. |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkCanvasPriv.h" | 12 #include "SkCanvasPriv.h" |
| 13 #include "SkMultiPictureDraw.h" | 13 #include "SkMultiPictureDraw.h" |
| 14 #include "SkPicture.h" | 14 #include "SkPicture.h" |
| 15 #include "SkTaskGroup.h" | 15 #include "SkTaskGroup.h" |
| 16 | 16 |
| 17 #if SK_SUPPORT_GPU | 17 #if SK_SUPPORT_GPU |
| 18 #include "GrContext.h" |
| 18 #include "GrLayerHoister.h" | 19 #include "GrLayerHoister.h" |
| 19 #include "GrRecordReplaceDraw.h" | 20 #include "GrRecordReplaceDraw.h" |
| 20 #include "GrRenderTarget.h" | 21 #include "GrRenderTarget.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 void SkMultiPictureDraw::DrawData::draw() { | 24 void SkMultiPictureDraw::DrawData::draw() { |
| 24 fCanvas->drawPicture(fPicture, &fMatrix, fPaint); | 25 fCanvas->drawPicture(fPicture, &fMatrix, fPaint); |
| 25 } | 26 } |
| 26 | 27 |
| 27 void SkMultiPictureDraw::DrawData::init(SkCanvas* canvas, const SkPicture* pictu
re, | 28 void SkMultiPictureDraw::DrawData::init(SkCanvas* canvas, const SkPicture* pictu
re, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 SkASSERT(rt); | 162 SkASSERT(rt); |
| 162 | 163 |
| 163 // Find the layers required by this canvas. It will return atlased | 164 // Find the layers required by this canvas. It will return atlased |
| 164 // layers in the 'recycled' list since they have already been drawn. | 165 // layers in the 'recycled' list since they have already been drawn. |
| 165 GrLayerHoister::FindLayersToHoist(context, picture, initialMatrix, | 166 GrLayerHoister::FindLayersToHoist(context, picture, initialMatrix, |
| 166 clipBounds, &needRendering, &recyc
led, | 167 clipBounds, &needRendering, &recyc
led, |
| 167 rt->numSamples()); | 168 rt->numSamples()); |
| 168 | 169 |
| 169 GrLayerHoister::DrawLayers(context, needRendering); | 170 GrLayerHoister::DrawLayers(context, needRendering); |
| 170 | 171 |
| 171 GrReplacements replacements; | |
| 172 | |
| 173 GrLayerHoister::ConvertLayersToReplacements(picture, needRendering,
&replacements); | |
| 174 GrLayerHoister::ConvertLayersToReplacements(picture, recycled, &repl
acements); | |
| 175 | |
| 176 // Render the entire picture using new layers | 172 // Render the entire picture using new layers |
| 177 GrRecordReplaceDraw(picture, canvas, &replacements, initialMatrix, N
ULL); | 173 GrRecordReplaceDraw(picture, canvas, context->getLayerCache(), |
| 174 initialMatrix, NULL); |
| 178 | 175 |
| 179 GrLayerHoister::UnlockLayers(context, needRendering); | 176 GrLayerHoister::UnlockLayers(context, needRendering); |
| 180 GrLayerHoister::UnlockLayers(context, recycled); | 177 GrLayerHoister::UnlockLayers(context, recycled); |
| 181 | 178 |
| 182 needRendering.rewind(); | 179 needRendering.rewind(); |
| 183 recycled.rewind(); | 180 recycled.rewind(); |
| 184 } else | 181 } else |
| 185 #endif | 182 #endif |
| 186 { | 183 { |
| 187 canvas->drawPicture(picture, &data.fMatrix, data.fPaint); | 184 canvas->drawPicture(picture, &data.fMatrix, data.fPaint); |
| 188 } | 185 } |
| 189 } | 186 } |
| 190 | 187 |
| 191 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU | 188 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU |
| 192 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); | 189 GrLayerHoister::UnlockLayers(context, atlasedNeedRendering); |
| 193 GrLayerHoister::UnlockLayers(context, atlasedRecycled); | 190 GrLayerHoister::UnlockLayers(context, atlasedRecycled); |
| 194 #if !GR_CACHE_HOISTED_LAYERS | 191 #if !GR_CACHE_HOISTED_LAYERS |
| 195 GrLayerHoister::PurgeCache(context); | 192 GrLayerHoister::PurgeCache(context); |
| 196 #endif | 193 #endif |
| 197 #endif | 194 #endif |
| 198 } | 195 } |
| 199 | 196 |
| OLD | NEW |