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

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: Add cast 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
« no previous file with comments | « src/gpu/GrPictureUtils.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y); 1831 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y);
1832 if (existing) { 1832 if (existing) {
1833 return; 1833 return;
1834 } 1834 }
1835 1835
1836 GPUOptimize(picture); 1836 GPUOptimize(picture);
1837 1837
1838 fContext->getLayerCache()->trackPicture(picture); 1838 fContext->getLayerCache()->trackPicture(picture);
1839 } 1839 }
1840 1840
1841 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture * picture, 1841 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture * mainPicture,
1842 const SkMatrix* matrix, const SkPaint * paint) { 1842 const SkMatrix* matrix, const SkPaint * paint) {
1843 // todo: should handle these natively 1843 // todo: should handle these natively
1844 if (matrix || paint) { 1844 if (matrix || paint) {
1845 return false; 1845 return false;
1846 } 1846 }
1847 1847
1848 fContext->getLayerCache()->processDeletedPictures(); 1848 fContext->getLayerCache()->processDeletedPictures();
1849 1849
1850 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey();
1851
1852 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key);
1853 if (NULL == data) {
1854 return false;
1855 }
1856
1857 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data);
1858 if (0 == gpuData->numSaveLayers()) {
1859 return false;
1860 }
1861
1862 SkRect clipBounds; 1850 SkRect clipBounds;
1863 if (!mainCanvas->getClipBounds(&clipBounds)) { 1851 if (!mainCanvas->getClipBounds(&clipBounds)) {
1864 return true; 1852 return true;
1865 } 1853 }
1866 1854
1867 SkTDArray<GrCachedLayer*> atlased, nonAtlased; 1855 SkTDArray<GrLayerHoister::HoistedLayer> atlased, nonAtlased;
1868 1856
1869 if (!GrLayerHoister::FindLayersToHoist(gpuData, clipBounds, &atlased, &nonAt lased, 1857 if (!GrLayerHoister::FindLayersToHoist(mainPicture, clipBounds, &atlased, &n onAtlased,
1870 fContext->getLayerCache())) { 1858 fContext->getLayerCache())) {
1871 return false; 1859 return false;
1872 } 1860 }
1873 1861
1874 GrReplacements replacements; 1862 GrReplacements replacements;
1875 1863
1876 GrLayerHoister::DrawLayers(picture, atlased, nonAtlased, &replacements); 1864 GrLayerHoister::DrawLayers(atlased, nonAtlased, &replacements);
1877 1865
1878 // Render the entire picture using new layers 1866 // Render the entire picture using new layers
1879 GrRecordReplaceDraw(*picture->fRecord, mainCanvas, picture->fBBH.get(), &rep lacements, NULL); 1867 GrRecordReplaceDraw(*mainPicture->fRecord, mainCanvas, mainPicture->fBBH.get (),
1868 &replacements, NULL);
1880 1869
1881 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), picture); 1870 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), atlased, nonAtlased) ;
1882 1871
1883 return true; 1872 return true;
1884 } 1873 }
1885 1874
1886 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1875 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1887 // We always return a transient cache, so it is freed after each 1876 // We always return a transient cache, so it is freed after each
1888 // filter traversal. 1877 // filter traversal.
1889 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1878 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1890 } 1879 }
OLDNEW
« no previous file with comments | « src/gpu/GrPictureUtils.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698