// The bounds of clip ops need to be adjusted for the paints of saveLayers they're inside. void updateClipBoundsForClipOp(const SkIRect& devBounds) { Bounds clip = SkRect::Make(devBounds); // We don't call adjustAndMap() because as its last step it would intersect the adjusted // clip bounds with the previous clip, exactly what we can't do when the clip grows. if (this->adjustForSaveLayerPaints(&clip)) { fCurrentClipBounds = clip.intersect(fCullRect) ? clip : Bounds::MakeEmpty(); } else { fCurrentClipBounds = fCullRect; } }
// Restore holds the devBounds for the clip after the {save,saveLayer}/restore block completes. void updateClipBounds(const Restore& op) { // This is just like the clip ops above, but we need to skip the effects (if any) of our // paired saveLayer (if it is one); it has not yet been popped off the save stack. Our // devBounds reflect the state of the world after the saveLayer/restore block is done, // so they are not affected by the saveLayer's paint. const int kSavesToIgnore = 1; Bounds clip = SkRect::Make(op.devBounds); if (this->adjustForSaveLayerPaints(&clip, kSavesToIgnore)) { fCurrentClipBounds = clip.intersect(fCullRect) ? clip : Bounds::MakeEmpty(); } else { fCurrentClipBounds = fCullRect; } }