Index: src/gpu/SkGpuDevice.cpp |
=================================================================== |
--- src/gpu/SkGpuDevice.cpp (revision 14658) |
+++ src/gpu/SkGpuDevice.cpp (working copy) |
@@ -1997,12 +1997,19 @@ |
} |
} else { |
// In this case there is no BBH associated with the picture. Pre-render |
- // all the layers |
- // TODO: intersect the bounds of each layer with the clip region to |
- // reduce the number of pre-rendered layers |
+ // all the layers that intersect the drawn region |
for (int j = 0; j < gpuData->numSaveLayers(); ++j) { |
const GPUAccelData::SaveLayerInfo& info = gpuData->saveLayerInfo(j); |
+ SkIRect layerRect = SkIRect::MakeXYWH(info.fOffset.fX, |
+ info.fOffset.fY, |
+ info.fSize.fWidth, |
+ info.fSize.fHeight); |
+ |
+ if (!SkIRect::Intersects(query, layerRect)) { |
+ continue; |
+ } |
+ |
// TODO: once this code is more stable unsuitable layers can |
// just be omitted during the optimization stage |
if (!info.fValid || |