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 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 SkDebugf("---- failed to create compatible device texture [%d %d]\n", | 1782 SkDebugf("---- failed to create compatible device texture [%d %d]\n", |
1783 info.width(), info.height()); | 1783 info.width(), info.height()); |
1784 return NULL; | 1784 return NULL; |
1785 } | 1785 } |
1786 } | 1786 } |
1787 | 1787 |
1788 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps
& props) { | 1788 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps
& props) { |
1789 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples(
), &props); | 1789 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples(
), &props); |
1790 } | 1790 } |
1791 | 1791 |
1792 void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { | |
1793 fContext->getLayerCache()->processDeletedPictures(); | |
1794 | |
1795 if (picture->fData.get() && !picture->fData->suitableForLayerOptimization())
{ | |
1796 return; | |
1797 } | |
1798 | |
1799 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); | |
1800 | |
1801 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke
y); | |
1802 if (existing) { | |
1803 return; | |
1804 } | |
1805 | |
1806 GPUOptimize(picture); | |
1807 | |
1808 fContext->getLayerCache()->trackPicture(picture); | |
1809 } | |
1810 | |
1811 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
* mainPicture, | 1792 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
* mainPicture, |
1812 const SkMatrix* matrix, const SkPaint
* paint) { | 1793 const SkMatrix* matrix, const SkPaint
* paint) { |
1813 // todo: should handle these natively | 1794 // todo: should handle these natively |
1814 if (matrix || paint) { | 1795 if (matrix || paint) { |
1815 return false; | 1796 return false; |
1816 } | 1797 } |
1817 | 1798 |
| 1799 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); |
| 1800 |
| 1801 const SkPicture::AccelData* data = mainPicture->EXPERIMENTAL_getAccelData(ke
y); |
| 1802 if (!data) { |
| 1803 return false; |
| 1804 } |
| 1805 |
1818 SkRect clipBounds; | 1806 SkRect clipBounds; |
1819 if (!mainCanvas->getClipBounds(&clipBounds)) { | 1807 if (!mainCanvas->getClipBounds(&clipBounds)) { |
1820 return true; | 1808 return true; |
1821 } | 1809 } |
1822 | 1810 |
1823 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; | 1811 SkTDArray<GrHoistedLayer> atlasedNeedRendering, atlasedRecycled; |
1824 | 1812 |
1825 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture, | 1813 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture, |
1826 clipBounds, | 1814 clipBounds, |
1827 &atlasedNeedRendering, &atlasedRecycled, | 1815 &atlasedNeedRendering, &atlasedRecycled, |
(...skipping 28 matching lines...) Expand all Loading... |
1856 return true; | 1844 return true; |
1857 } | 1845 } |
1858 | 1846 |
1859 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1847 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1860 // We always return a transient cache, so it is freed after each | 1848 // We always return a transient cache, so it is freed after each |
1861 // filter traversal. | 1849 // filter traversal. |
1862 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1850 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1863 } | 1851 } |
1864 | 1852 |
1865 #endif | 1853 #endif |
OLD | NEW |