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 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 fContext->getLayerCache()->trackPicture(picture); | 1827 fContext->getLayerCache()->trackPicture(picture); |
1828 } | 1828 } |
1829 | 1829 |
1830 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
* mainPicture, | 1830 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
* mainPicture, |
1831 const SkMatrix* matrix, const SkPaint
* paint) { | 1831 const SkMatrix* matrix, const SkPaint
* paint) { |
1832 // todo: should handle these natively | 1832 // todo: should handle these natively |
1833 if (matrix || paint) { | 1833 if (matrix || paint) { |
1834 return false; | 1834 return false; |
1835 } | 1835 } |
1836 | 1836 |
1837 fContext->getLayerCache()->processDeletedPictures(); | |
1838 | |
1839 SkRect clipBounds; | 1837 SkRect clipBounds; |
1840 if (!mainCanvas->getClipBounds(&clipBounds)) { | 1838 if (!mainCanvas->getClipBounds(&clipBounds)) { |
1841 return true; | 1839 return true; |
1842 } | 1840 } |
1843 | 1841 |
1844 SkTDArray<GrLayerHoister::HoistedLayer> atlased, nonAtlased, recycled; | 1842 SkTDArray<GrHoistedLayer> atlased, nonAtlased, recycled; |
1845 | 1843 |
1846 if (!GrLayerHoister::FindLayersToHoist(mainPicture, clipBounds, &atlased, &n
onAtlased, | 1844 if (!GrLayerHoister::FindLayersToHoist(fContext, mainPicture, clipBounds, |
1847 &recycled, fContext->getLayerCache())
) { | 1845 &atlased, &nonAtlased, &recycled)) { |
1848 return false; | 1846 return false; |
1849 } | 1847 } |
1850 | 1848 |
1851 GrReplacements replacements; | 1849 GrReplacements replacements; |
1852 | 1850 |
1853 GrLayerHoister::DrawLayers(atlased, nonAtlased, recycled, &replacements); | 1851 GrLayerHoister::DrawLayers(atlased, nonAtlased, recycled, &replacements); |
1854 | 1852 |
1855 // Render the entire picture using new layers | 1853 // Render the entire picture using new layers |
1856 const SkMatrix initialMatrix = mainCanvas->getTotalMatrix(); | 1854 const SkMatrix initialMatrix = mainCanvas->getTotalMatrix(); |
1857 | 1855 |
1858 GrRecordReplaceDraw(mainPicture, mainCanvas, &replacements, initialMatrix, N
ULL); | 1856 GrRecordReplaceDraw(mainPicture, mainCanvas, &replacements, initialMatrix, N
ULL); |
1859 | 1857 |
1860 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), atlased, nonAtlased,
recycled); | 1858 GrLayerHoister::UnlockLayers(fContext, atlased, nonAtlased, recycled); |
1861 | 1859 |
1862 return true; | 1860 return true; |
1863 } | 1861 } |
1864 | 1862 |
1865 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1863 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1866 // We always return a transient cache, so it is freed after each | 1864 // We always return a transient cache, so it is freed after each |
1867 // filter traversal. | 1865 // filter traversal. |
1868 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1866 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1869 } | 1867 } |
OLD | NEW |