Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 595543002: Update layer hoisting code to correctly render sub-picture layers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1818 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y); 1829 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y);
1830 if (existing) { 1830 if (existing) {
1831 return; 1831 return;
1832 } 1832 }
1833 1833
1834 GPUOptimize(picture); 1834 GPUOptimize(picture);
1835 1835
1836 fContext->getLayerCache()->trackPicture(picture); 1836 fContext->getLayerCache()->trackPicture(picture);
1837 } 1837 }
1838 1838
1839 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture * picture, 1839 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture * mainPicture,
1840 const SkMatrix* matrix, const SkPaint * paint) { 1840 const SkMatrix* matrix, const SkPaint * paint) {
1841 // todo: should handle these natively 1841 // todo: should handle these natively
1842 if (matrix || paint) { 1842 if (matrix || paint) {
1843 return false; 1843 return false;
1844 } 1844 }
1845 1845
1846 fContext->getLayerCache()->processDeletedPictures(); 1846 fContext->getLayerCache()->processDeletedPictures();
1847 1847
1848 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey();
1849
1850 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key);
1851 if (NULL == data) {
1852 return false;
1853 }
1854
1855 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data);
1856 if (0 == gpuData->numSaveLayers()) {
1857 return false;
1858 }
1859
1860 SkRect clipBounds; 1848 SkRect clipBounds;
1861 if (!mainCanvas->getClipBounds(&clipBounds)) { 1849 if (!mainCanvas->getClipBounds(&clipBounds)) {
1862 return true; 1850 return true;
1863 } 1851 }
1864 1852
1865 SkTDArray<GrCachedLayer*> atlased, nonAtlased; 1853 SkTDArray<GrLayerHoister::HoistingInfo> atlased, nonAtlased;
1866 1854
1867 if (!GrLayerHoister::FindLayersToHoist(gpuData, clipBounds, &atlased, &nonAt lased, 1855 if (!GrLayerHoister::FindLayersToHoist(mainPicture, clipBounds, &atlased, &n onAtlased,
1868 fContext->getLayerCache())) { 1856 fContext->getLayerCache())) {
1869 return false; 1857 return false;
1870 } 1858 }
1871 1859
1872 GrReplacements replacements; 1860 GrReplacements replacements;
1873 1861
1874 GrLayerHoister::DrawLayers(picture, atlased, nonAtlased, &replacements); 1862 GrLayerHoister::DrawLayers(atlased, nonAtlased, &replacements);
1875 1863
1876 // Render the entire picture using new layers 1864 // Render the entire picture using new layers
1877 GrRecordReplaceDraw(*picture->fRecord, mainCanvas, picture->fBBH.get(), &rep lacements, NULL); 1865 GrRecordReplaceDraw(*mainPicture->fRecord, mainCanvas, mainPicture->fBBH.get (),
1866 &replacements, NULL);
1878 1867
1879 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); 1868 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), atlased, nonAtlased) ;
1880 1869
1881 return true; 1870 return true;
1882 } 1871 }
1883 1872
1884 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1873 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1885 // We always return a transient cache, so it is freed after each 1874 // We always return a transient cache, so it is freed after each
1886 // filter traversal. 1875 // filter traversal.
1887 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1876 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1888 } 1877 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698