OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 #include "SkDeviceImageFilterProxy.h" | 25 #include "SkDeviceImageFilterProxy.h" |
26 #include "SkDrawProcs.h" | 26 #include "SkDrawProcs.h" |
27 #include "SkGlyphCache.h" | 27 #include "SkGlyphCache.h" |
28 #include "SkImageFilter.h" | 28 #include "SkImageFilter.h" |
29 #include "SkMaskFilter.h" | 29 #include "SkMaskFilter.h" |
30 #include "SkPathEffect.h" | 30 #include "SkPathEffect.h" |
31 #include "SkPicture.h" | 31 #include "SkPicture.h" |
32 #include "SkPictureData.h" | 32 #include "SkPictureData.h" |
33 #include "SkPicturePlayback.h" | 33 #include "SkPicturePlayback.h" |
| 34 #include "SkPictureRangePlayback.h" |
34 #include "SkRRect.h" | 35 #include "SkRRect.h" |
35 #include "SkStroke.h" | 36 #include "SkStroke.h" |
36 #include "SkSurface.h" | 37 #include "SkSurface.h" |
37 #include "SkTLazy.h" | 38 #include "SkTLazy.h" |
38 #include "SkUtils.h" | 39 #include "SkUtils.h" |
39 #include "SkVertState.h" | 40 #include "SkVertState.h" |
40 #include "SkErrorInternals.h" | 41 #include "SkErrorInternals.h" |
41 | 42 |
42 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 | 43 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 |
43 | 44 |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2003 | 2004 |
2004 if (!layer->rect().isEmpty()) { | 2005 if (!layer->rect().isEmpty()) { |
2005 // info.fCTM maps the layer's top/left to the origin. | 2006 // info.fCTM maps the layer's top/left to the origin. |
2006 // Since this layer is atlased the top/left corner needs | 2007 // Since this layer is atlased the top/left corner needs |
2007 // to be offset to some arbitrary location in the backing | 2008 // to be offset to some arbitrary location in the backing |
2008 // texture. | 2009 // texture. |
2009 canvas->translate(SkIntToScalar(layer->rect().fLeft), | 2010 canvas->translate(SkIntToScalar(layer->rect().fLeft), |
2010 SkIntToScalar(layer->rect().fTop)); | 2011 SkIntToScalar(layer->rect().fTop)); |
2011 } | 2012 } |
2012 | 2013 |
2013 SkPicturePlayback playback(picture); | 2014 SkPictureRangePlayback rangePlayback(picture, |
2014 playback.setDrawLimits(info.fSaveLayerOpID, info.fRestoreOpID); | 2015 info.fSaveLayerOpID, |
2015 playback.draw(canvas, NULL); | 2016 info.fRestoreOpID); |
| 2017 rangePlayback.draw(canvas, NULL); |
2016 | 2018 |
2017 canvas->flush(); | 2019 canvas->flush(); |
2018 } | 2020 } |
2019 } | 2021 } |
2020 } | 2022 } |
2021 | 2023 |
2022 // Playback using new layers | 2024 // Playback using new layers |
2023 SkPicturePlayback playback(picture); | 2025 SkPicturePlayback playback(picture); |
2024 | 2026 |
2025 playback.setReplacements(&replacements); | 2027 playback.setReplacements(&replacements); |
2026 playback.draw(canvas, NULL); | 2028 playback.draw(canvas, NULL); |
2027 | 2029 |
2028 // unlock the layers | 2030 // unlock the layers |
2029 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { | 2031 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { |
2030 GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture, i); | 2032 GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture, i); |
2031 fContext->getLayerCache()->unlock(layer); | 2033 fContext->getLayerCache()->unlock(layer); |
2032 } | 2034 } |
2033 | 2035 |
2034 return true; | 2036 return true; |
2035 } | 2037 } |
OLD | NEW |