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

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

Issue 1406013006: Update Layer Hoisting to store its atlas texture in the resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix build Created 5 years, 1 month 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 "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 1979
1980 SkIRect iBounds; 1980 SkIRect iBounds;
1981 if (!mainCanvas->getClipDeviceBounds(&iBounds)) { 1981 if (!mainCanvas->getClipDeviceBounds(&iBounds)) {
1982 return false; 1982 return false;
1983 } 1983 }
1984 1984
1985 SkRect clipBounds = SkRect::Make(iBounds); 1985 SkRect clipBounds = SkRect::Make(iBounds);
1986 1986
1987 SkMatrix initialMatrix = mainCanvas->getTotalMatrix(); 1987 SkMatrix initialMatrix = mainCanvas->getTotalMatrix();
1988 1988
1989 GrLayerHoister::Begin(fContext);
1990
1989 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture, 1991 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture,
1990 initialMatrix, 1992 initialMatrix,
1991 clipBounds, 1993 clipBounds,
1992 &atlasedNeedRendering, &atlasedRecycled, 1994 &atlasedNeedRendering, &atlasedRecycled,
1993 fRenderTarget->numColorSamples()); 1995 fRenderTarget->numColorSamples());
1994 1996
1995 GrLayerHoister::DrawLayersToAtlas(fContext, atlasedNeedRendering); 1997 GrLayerHoister::DrawLayersToAtlas(fContext, atlasedNeedRendering);
1996 1998
1997 SkTDArray<GrHoistedLayer> needRendering, recycled; 1999 SkTDArray<GrHoistedLayer> needRendering, recycled;
1998 2000
1999 SkAutoCanvasMatrixPaint acmp(mainCanvas, matrix, paint, mainPicture->cullRec t()); 2001 SkAutoCanvasMatrixPaint acmp(mainCanvas, matrix, paint, mainPicture->cullRec t());
2000 2002
2001 GrLayerHoister::FindLayersToHoist(fContext, mainPicture, 2003 GrLayerHoister::FindLayersToHoist(fContext, mainPicture,
2002 initialMatrix, 2004 initialMatrix,
2003 clipBounds, 2005 clipBounds,
2004 &needRendering, &recycled, 2006 &needRendering, &recycled,
2005 fRenderTarget->numColorSamples()); 2007 fRenderTarget->numColorSamples());
2006 2008
2007 GrLayerHoister::DrawLayers(fContext, needRendering); 2009 GrLayerHoister::DrawLayers(fContext, needRendering);
2008 2010
2009 // Render the entire picture using new layers 2011 // Render the entire picture using new layers
2010 GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(), 2012 GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(),
2011 initialMatrix, nullptr); 2013 initialMatrix, nullptr);
2012 2014
2013 GrLayerHoister::UnlockLayers(fContext, needRendering); 2015 GrLayerHoister::UnlockLayers(fContext, needRendering);
2014 GrLayerHoister::UnlockLayers(fContext, recycled); 2016 GrLayerHoister::UnlockLayers(fContext, recycled);
2015 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering); 2017 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering);
2016 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled); 2018 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled);
2019 GrLayerHoister::End(fContext);
2017 2020
2018 return true; 2021 return true;
2019 #else 2022 #else
2020 return false; 2023 return false;
2021 #endif 2024 #endif
2022 } 2025 }
2023 2026
2024 SkImageFilter::Cache* SkGpuDevice::NewImageFilterCache() { 2027 SkImageFilter::Cache* SkGpuDevice::NewImageFilterCache() {
2025 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 2028 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
2026 } 2029 }
2027 2030
2028 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 2031 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
2029 // We always return a transient cache, so it is freed after each 2032 // We always return a transient cache, so it is freed after each
2030 // filter traversal. 2033 // filter traversal.
2031 return SkGpuDevice::NewImageFilterCache(); 2034 return SkGpuDevice::NewImageFilterCache();
2032 } 2035 }
2033 2036
2034 #endif 2037 #endif
OLDNEW
« src/gpu/GrLayerAtlas.cpp ('K') | « src/gpu/GrTest.cpp ('k') | tests/GpuLayerCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698