aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBBoxHierarchyRecord.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkBBoxHierarchyRecord.cpp')
-rw-r--r--src/core/SkBBoxHierarchyRecord.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp
index f0382e6470..d6fbd21239 100644
--- a/src/core/SkBBoxHierarchyRecord.cpp
+++ b/src/core/SkBBoxHierarchyRecord.cpp
@@ -35,8 +35,29 @@ void SkBBoxHierarchyRecord::willSave(SaveFlags flags) {
SkCanvas::SaveLayerStrategy SkBBoxHierarchyRecord::willSaveLayer(const SkRect* bounds,
const SkPaint* paint,
SaveFlags flags) {
+ // For now, assume all filters affect transparent black.
+ // FIXME: This could be made less conservative as an optimization.
+ bool paintAffectsTransparentBlack = NULL != paint &&
+ ((NULL != paint->getImageFilter()) ||
+ (NULL != paint->getColorFilter()));
+ SkRect drawBounds;
+ if (paintAffectsTransparentBlack) {
+ if (bounds) {
+ drawBounds = *bounds;
+ this->getTotalMatrix().mapRect(&drawBounds);
+ } else {
+ SkIRect deviceBounds;
+ this->getClipDeviceBounds(&deviceBounds);
+ drawBounds.set(deviceBounds);
+ }
+ }
fStateTree->appendSaveLayer(this->writeStream().bytesWritten());
- return this->INHERITED::willSaveLayer(bounds, paint, flags);
+ SkCanvas::SaveLayerStrategy strategy = this->INHERITED::willSaveLayer(bounds, paint, flags);
+ if (paintAffectsTransparentBlack) {
+ this->handleBBox(drawBounds);
+ this->addNoOp();
+ }
+ return strategy;
}
void SkBBoxHierarchyRecord::willRestore() {