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

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

Issue 313613004: Alter SkCanvas::drawPicture (devirtualize, take const SkPicture, take pointer) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add staging entry point for Chromium and Android Created 6 years, 6 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 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 GrPrintf("---- failed to create compatible device texture [%d %d]\n", 1809 GrPrintf("---- failed to create compatible device texture [%d %d]\n",
1810 info.width(), info.height()); 1810 info.width(), info.height());
1811 return NULL; 1811 return NULL;
1812 } 1812 }
1813 } 1813 }
1814 1814
1815 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) { 1815 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) {
1816 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples( )); 1816 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples( ));
1817 } 1817 }
1818 1818
1819 void SkGpuDevice::EXPERIMENTAL_optimize(SkPicture* picture) { 1819 void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) {
1820 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); 1820 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
1821 1821
1822 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y); 1822 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y);
1823 if (NULL != existing) { 1823 if (NULL != existing) {
1824 return; 1824 return;
1825 } 1825 }
1826 1826
1827 SkAutoTUnref<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key))); 1827 SkAutoTUnref<GPUAccelData> data(SkNEW_ARGS(GPUAccelData, (key)));
1828 1828
1829 picture->EXPERIMENTAL_addAccelData(data); 1829 picture->EXPERIMENTAL_addAccelData(data);
1830 1830
1831 GatherGPUInfo(picture, data); 1831 GatherGPUInfo(picture, data);
1832 } 1832 }
1833 1833
1834 static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* re sult) { 1834 static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* re sult) {
1835 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); 1835 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
1836 result->setInfo(info); 1836 result->setInfo(info);
1837 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); 1837 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
1838 } 1838 }
1839 1839
1840 void SkGpuDevice::EXPERIMENTAL_purge(SkPicture* picture) { 1840 void SkGpuDevice::EXPERIMENTAL_purge(const SkPicture* picture) {
1841 1841
1842 } 1842 }
1843 1843
1844 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, SkPicture* picture) { 1844 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pi cture) {
1845 1845
1846 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); 1846 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey();
1847 1847
1848 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key); 1848 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key);
1849 if (NULL == data) { 1849 if (NULL == data) {
1850 return false; 1850 return false;
1851 } 1851 }
1852 1852
1853 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data); 1853 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data);
1854 1854
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict ure, i); 2006 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict ure, i);
2007 2007
2008 if (NULL != layer->getTexture()) { 2008 if (NULL != layer->getTexture()) {
2009 fContext->unlockScratchTexture(layer->getTexture()); 2009 fContext->unlockScratchTexture(layer->getTexture());
2010 layer->setTexture(NULL); 2010 layer->setTexture(NULL);
2011 } 2011 }
2012 } 2012 }
2013 2013
2014 return true; 2014 return true;
2015 } 2015 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698