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 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 // todo: should handle these natively | 1809 // todo: should handle these natively |
1810 if (matrix || paint) { | 1810 if (matrix || paint) { |
1811 return false; | 1811 return false; |
1812 } | 1812 } |
1813 | 1813 |
1814 SkRect clipBounds; | 1814 SkRect clipBounds; |
1815 if (!mainCanvas->getClipBounds(&clipBounds)) { | 1815 if (!mainCanvas->getClipBounds(&clipBounds)) { |
1816 return true; | 1816 return true; |
1817 } | 1817 } |
1818 | 1818 |
1819 SkTDArray<GrHoistedLayer> atlased, nonAtlased, recycled; | 1819 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; |
1820 | 1820 |
1821 if (!GrLayerHoister::FindLayersToHoist(fContext, mainPicture, clipBounds, | 1821 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture, |
1822 &atlased, &nonAtlased, &recycled)) { | 1822 clipBounds, |
1823 return false; | 1823 &atlasedNeedRendering, &atlasedRecycled); |
1824 } | 1824 |
| 1825 GrLayerHoister::DrawLayersToAtlas(fContext, atlasedNeedRendering); |
| 1826 |
| 1827 SkTDArray<GrHoistedLayer> needRendering, recycled; |
| 1828 |
| 1829 GrLayerHoister::FindLayersToHoist(fContext, mainPicture, |
| 1830 clipBounds, |
| 1831 &needRendering, &recycled); |
| 1832 |
| 1833 GrLayerHoister::DrawLayers(fContext, needRendering); |
1825 | 1834 |
1826 GrReplacements replacements; | 1835 GrReplacements replacements; |
1827 | 1836 |
1828 GrLayerHoister::DrawLayers(fContext, atlased, nonAtlased, recycled, &replace
ments); | 1837 GrLayerHoister::ConvertLayersToReplacements(needRendering, &replacements); |
| 1838 GrLayerHoister::ConvertLayersToReplacements(recycled, &replacements); |
1829 | 1839 |
1830 // Render the entire picture using new layers | 1840 // Render the entire picture using new layers |
1831 const SkMatrix initialMatrix = mainCanvas->getTotalMatrix(); | 1841 const SkMatrix initialMatrix = mainCanvas->getTotalMatrix(); |
1832 | 1842 |
1833 GrRecordReplaceDraw(mainPicture, mainCanvas, &replacements, initialMatrix, N
ULL); | 1843 GrRecordReplaceDraw(mainPicture, mainCanvas, &replacements, initialMatrix, N
ULL); |
1834 | 1844 |
1835 GrLayerHoister::UnlockLayers(fContext, atlased, nonAtlased, recycled); | 1845 GrLayerHoister::UnlockLayers(fContext, needRendering); |
| 1846 GrLayerHoister::UnlockLayers(fContext, recycled); |
| 1847 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering); |
| 1848 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled); |
1836 | 1849 |
1837 return true; | 1850 return true; |
1838 } | 1851 } |
1839 | 1852 |
1840 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1853 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1841 // We always return a transient cache, so it is freed after each | 1854 // We always return a transient cache, so it is freed after each |
1842 // filter traversal. | 1855 // filter traversal. |
1843 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1856 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1844 } | 1857 } |
OLD | NEW |