| 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 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 kSaveLayerMaxSize < info.fSize.fHeight || | 1990 kSaveLayerMaxSize < info.fSize.fHeight || |
| 1991 info.fIsNested) { | 1991 info.fIsNested) { |
| 1992 continue; // this layer is unsuitable | 1992 continue; // this layer is unsuitable |
| 1993 } | 1993 } |
| 1994 | 1994 |
| 1995 pullForward[j] = true; | 1995 pullForward[j] = true; |
| 1996 } | 1996 } |
| 1997 } | 1997 } |
| 1998 } else { | 1998 } else { |
| 1999 // In this case there is no BBH associated with the picture. Pre-render | 1999 // In this case there is no BBH associated with the picture. Pre-render |
| 2000 // all the layers | 2000 // all the layers that intersect the drawn region |
| 2001 // TODO: intersect the bounds of each layer with the clip region to | |
| 2002 // reduce the number of pre-rendered layers | |
| 2003 for (int j = 0; j < gpuData->numSaveLayers(); ++j) { | 2001 for (int j = 0; j < gpuData->numSaveLayers(); ++j) { |
| 2004 const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(j); | 2002 const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(j); |
| 2005 | 2003 |
| 2004 SkIRect layerRect = SkIRect::MakeXYWH(info.fOffset.fX, |
| 2005 info.fOffset.fY, |
| 2006 info.fSize.fWidth, |
| 2007 info.fSize.fHeight); |
| 2008 |
| 2009 if (!SkIRect::Intersects(query, layerRect)) { |
| 2010 continue; |
| 2011 } |
| 2012 |
| 2006 // TODO: once this code is more stable unsuitable layers can | 2013 // TODO: once this code is more stable unsuitable layers can |
| 2007 // just be omitted during the optimization stage | 2014 // just be omitted during the optimization stage |
| 2008 if (!info.fValid || | 2015 if (!info.fValid || |
| 2009 kSaveLayerMaxSize < info.fSize.fWidth || | 2016 kSaveLayerMaxSize < info.fSize.fWidth || |
| 2010 kSaveLayerMaxSize < info.fSize.fHeight || | 2017 kSaveLayerMaxSize < info.fSize.fHeight || |
| 2011 info.fIsNested) { | 2018 info.fIsNested) { |
| 2012 continue; | 2019 continue; |
| 2013 } | 2020 } |
| 2014 | 2021 |
| 2015 pullForward[j] = true; | 2022 pullForward[j] = true; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2085 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); | 2092 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); |
| 2086 | 2093 |
| 2087 if (NULL != layer->getTexture()) { | 2094 if (NULL != layer->getTexture()) { |
| 2088 fContext->unlockScratchTexture(layer->getTexture()); | 2095 fContext->unlockScratchTexture(layer->getTexture()); |
| 2089 layer->setTexture(NULL); | 2096 layer->setTexture(NULL); |
| 2090 } | 2097 } |
| 2091 } | 2098 } |
| 2092 | 2099 |
| 2093 return true; | 2100 return true; |
| 2094 } | 2101 } |
| OLD | NEW |