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

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

Issue 504393002: Switch GPU Optimization code to SkRecord (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT 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 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 return; 1854 return;
1855 } 1855 }
1856 1856
1857 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); 1857 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey();
1858 1858
1859 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y); 1859 const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(ke y);
1860 if (NULL != existing) { 1860 if (NULL != existing) {
1861 return; 1861 return;
1862 } 1862 }
1863 1863
1864 SkAutoTUnref<GrAccelData> data(SkNEW_ARGS(GrAccelData, (key))); 1864 GPUOptimize(picture);
1865
1866 picture->EXPERIMENTAL_addAccelData(data);
1867
1868 GatherGPUInfo(picture, data);
1869 1865
1870 fContext->getLayerCache()->trackPicture(picture); 1866 fContext->getLayerCache()->trackPicture(picture);
1871 } 1867 }
1872 1868
1873 static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* re sult) { 1869 static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* re sult) {
1874 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); 1870 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
1875 result->setInfo(info); 1871 result->setInfo(info);
1876 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); 1872 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
1877 } 1873 }
1878 1874
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 SkPictureReplacementPlayback::PlaybackReplacements replacements; 1993 SkPictureReplacementPlayback::PlaybackReplacements replacements;
1998 1994
1999 SkTDArray<GrCachedLayer*> atlased, nonAtlased; 1995 SkTDArray<GrCachedLayer*> atlased, nonAtlased;
2000 atlased.setReserve(gpuData->numSaveLayers()); 1996 atlased.setReserve(gpuData->numSaveLayers());
2001 1997
2002 // Generate the layer and/or ensure it is locked 1998 // Generate the layer and/or ensure it is locked
2003 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { 1999 for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
2004 if (pullForward[i]) { 2000 if (pullForward[i]) {
2005 const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); 2001 const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i);
2006 2002
2007 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate( picture->uniqueID(), 2003 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate( picture->uniqueID(),
2008 info.fSaveLayerOpID, 2004 info.fSaveLayerOpID,
2009 info.fRestoreOpID, 2005 info.fRestoreOpID,
2010 info.fCTM); 2006 info.fOriginXform);
2011 2007
2012 SkPictureReplacementPlayback::PlaybackReplacements::ReplacementInfo* layerInfo = 2008 SkPictureReplacementPlayback::PlaybackReplacements::ReplacementInfo* layerInfo =
2013 replacem ents.push(); 2009 replacem ents.push();
2014 layerInfo->fStart = info.fSaveLayerOpID; 2010 layerInfo->fStart = info.fSaveLayerOpID;
2015 layerInfo->fStop = info.fRestoreOpID; 2011 layerInfo->fStop = info.fRestoreOpID;
2016 layerInfo->fPos = info.fOffset; 2012 layerInfo->fPos = info.fOffset;
2017 2013
2018 GrTextureDesc desc; 2014 GrTextureDesc desc;
2019 desc.fFlags = kRenderTarget_GrTextureFlagBit; 2015 desc.fFlags = kRenderTarget_GrTextureFlagBit;
2020 desc.fWidth = info.fSize.fWidth; 2016 desc.fWidth = info.fSize.fWidth;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data); 2154 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data);
2159 SkASSERT(0 != gpuData->numSaveLayers()); 2155 SkASSERT(0 != gpuData->numSaveLayers());
2160 2156
2161 // unlock the layers 2157 // unlock the layers
2162 for (int i = 0; i < gpuData->numSaveLayers(); ++i) { 2158 for (int i = 0; i < gpuData->numSaveLayers(); ++i) {
2163 const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i); 2159 const GrAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(i);
2164 2160
2165 GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture->uni queID(), 2161 GrCachedLayer* layer = fContext->getLayerCache()->findLayer(picture->uni queID(),
2166 info.fSaveLa yerOpID, 2162 info.fSaveLa yerOpID,
2167 info.fRestor eOpID, 2163 info.fRestor eOpID,
2168 info.fCTM); 2164 info.fOrigin Xform);
2169 fContext->getLayerCache()->unlock(layer); 2165 fContext->getLayerCache()->unlock(layer);
2170 } 2166 }
2171 2167
2172 #if DISABLE_CACHING 2168 #if DISABLE_CACHING
2173 // This code completely clears out the atlas. It is required when 2169 // This code completely clears out the atlas. It is required when
2174 // caching is disabled so the atlas doesn't fill up and force more 2170 // caching is disabled so the atlas doesn't fill up and force more
2175 // free floating layers 2171 // free floating layers
2176 fContext->getLayerCache()->purge(picture->uniqueID()); 2172 fContext->getLayerCache()->purge(picture->uniqueID());
2177 2173
2178 fContext->getLayerCache()->purgeAll(); 2174 fContext->getLayerCache()->purgeAll();
2179 #endif 2175 #endif
2180 } 2176 }
2181 2177
2182 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 2178 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
2183 // We always return a transient cache, so it is freed after each 2179 // We always return a transient cache, so it is freed after each
2184 // filter traversal. 2180 // filter traversal.
2185 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 2181 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
2186 } 2182 }
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