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 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 } | 1843 } |
1844 } | 1844 } |
1845 | 1845 |
1846 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) { | 1846 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) { |
1847 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples(
)); | 1847 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples(
)); |
1848 } | 1848 } |
1849 | 1849 |
1850 void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { | 1850 void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { |
1851 fContext->getLayerCache()->processDeletedPictures(); | 1851 fContext->getLayerCache()->processDeletedPictures(); |
1852 | 1852 |
| 1853 if (NULL != picture->fData.get() && !picture->fData->suitableForLayerOptimiz
ation()) { |
| 1854 return; |
| 1855 } |
| 1856 |
1853 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); | 1857 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); |
1854 | 1858 |
1855 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke
y); | 1859 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke
y); |
1856 if (NULL != existing) { | 1860 if (NULL != existing) { |
1857 return; | 1861 return; |
1858 } | 1862 } |
1859 | 1863 |
1860 SkAutoTUnref<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key))); | 1864 SkAutoTUnref<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key))); |
1861 | 1865 |
1862 picture->EXPERIMENTAL_addAccelData(data); | 1866 picture->EXPERIMENTAL_addAccelData(data); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 } | 2134 } |
2131 | 2135 |
2132 return true; | 2136 return true; |
2133 } | 2137 } |
2134 | 2138 |
2135 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 2139 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
2136 // We always return a transient cache, so it is freed after each | 2140 // We always return a transient cache, so it is freed after each |
2137 // filter traversal. | 2141 // filter traversal. |
2138 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 2142 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
2139 } | 2143 } |
OLD | NEW |