aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRecordDraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkRecordDraw.cpp')
-rw-r--r--src/core/SkRecordDraw.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index a14b031695..5dd2ba3296 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -204,19 +204,29 @@ private:
this->pushControl();
}
+ static bool PaintMayAffectTransparentBlack(const SkPaint* paint) {
+ // FIXME: this is very conservative
+ return paint && (paint->getImageFilter() || paint->getColorFilter());
+ }
+
SkIRect popSaveBlock() {
// We're done the Save block. Apply the block's bounds to all control ops inside it.
SaveBounds sb;
fSaveStack.pop(&sb);
+
+ // If the paint affects transparent black, we can't trust any of our calculated bounds.
+ const SkIRect& bounds =
+ PaintMayAffectTransparentBlack(sb.paint) ? fCurrentClipBounds : sb.bounds;
+
while (sb.controlOps --> 0) {
- this->popControl(sb.bounds);
+ this->popControl(bounds);
}
// This whole Save block may be part another Save block.
- this->updateSaveBounds(sb.bounds);
+ this->updateSaveBounds(bounds);
// If called from a real Restore (not a phony one for balance), it'll need the bounds.
- return sb.bounds;
+ return bounds;
}
void pushControl() {