| 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 "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
| (...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | |
| 1991 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture, | 1989 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture, |
| 1992 initialMatrix, | 1990 initialMatrix, |
| 1993 clipBounds, | 1991 clipBounds, |
| 1994 &atlasedNeedRendering, &atlasedRecycled, | 1992 &atlasedNeedRendering, &atlasedRecycled, |
| 1995 fRenderTarget->numColorSamples()); | 1993 fRenderTarget->numColorSamples()); |
| 1996 | 1994 |
| 1997 GrLayerHoister::DrawLayersToAtlas(fContext, atlasedNeedRendering); | 1995 GrLayerHoister::DrawLayersToAtlas(fContext, atlasedNeedRendering); |
| 1998 | 1996 |
| 1999 SkTDArray<GrHoistedLayer> needRendering, recycled; | 1997 SkTDArray<GrHoistedLayer> needRendering, recycled; |
| 2000 | 1998 |
| 2001 SkAutoCanvasMatrixPaint acmp(mainCanvas, matrix, paint, mainPicture->cullRec
t()); | 1999 SkAutoCanvasMatrixPaint acmp(mainCanvas, matrix, paint, mainPicture->cullRec
t()); |
| 2002 | 2000 |
| 2003 GrLayerHoister::FindLayersToHoist(fContext, mainPicture, | 2001 GrLayerHoister::FindLayersToHoist(fContext, mainPicture, |
| 2004 initialMatrix, | 2002 initialMatrix, |
| 2005 clipBounds, | 2003 clipBounds, |
| 2006 &needRendering, &recycled, | 2004 &needRendering, &recycled, |
| 2007 fRenderTarget->numColorSamples()); | 2005 fRenderTarget->numColorSamples()); |
| 2008 | 2006 |
| 2009 GrLayerHoister::DrawLayers(fContext, needRendering); | 2007 GrLayerHoister::DrawLayers(fContext, needRendering); |
| 2010 | 2008 |
| 2011 // Render the entire picture using new layers | 2009 // Render the entire picture using new layers |
| 2012 GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(), | 2010 GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(), |
| 2013 initialMatrix, nullptr); | 2011 initialMatrix, nullptr); |
| 2014 | 2012 |
| 2015 GrLayerHoister::UnlockLayers(fContext, needRendering); | 2013 GrLayerHoister::UnlockLayers(fContext, needRendering); |
| 2016 GrLayerHoister::UnlockLayers(fContext, recycled); | 2014 GrLayerHoister::UnlockLayers(fContext, recycled); |
| 2017 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering); | 2015 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering); |
| 2018 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled); | 2016 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled); |
| 2019 GrLayerHoister::End(fContext); | |
| 2020 | 2017 |
| 2021 return true; | 2018 return true; |
| 2022 #else | 2019 #else |
| 2023 return false; | 2020 return false; |
| 2024 #endif | 2021 #endif |
| 2025 } | 2022 } |
| 2026 | 2023 |
| 2027 SkImageFilter::Cache* SkGpuDevice::NewImageFilterCache() { | 2024 SkImageFilter::Cache* SkGpuDevice::NewImageFilterCache() { |
| 2028 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 2025 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 2029 } | 2026 } |
| 2030 | 2027 |
| 2031 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 2028 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 2032 // We always return a transient cache, so it is freed after each | 2029 // We always return a transient cache, so it is freed after each |
| 2033 // filter traversal. | 2030 // filter traversal. |
| 2034 return SkGpuDevice::NewImageFilterCache(); | 2031 return SkGpuDevice::NewImageFilterCache(); |
| 2035 } | 2032 } |
| 2036 | 2033 |
| 2037 #endif | 2034 #endif |
| OLD | NEW |