use nothingToDraw more often

Bug: skia:
Change-Id: Ifafd8d90649f5aeb020335f46496a828dffac98e
Reviewed-on: https://skia-review.googlesource.com/149481
Auto-Submit: Mike Reed <reed@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Mike Reed 2018-08-27 10:48:52 -04:00 committed by Skia Commit-Bot
parent 3fee9235a4
commit 49f8da0209

View File

@ -920,9 +920,15 @@ int SkCanvas::saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPai
}
int SkCanvas::saveLayer(const SaveLayerRec& rec) {
SaveLayerStrategy strategy = this->getSaveLayerStrategy(rec);
fSaveCount += 1;
this->internalSaveLayer(rec, strategy);
if (rec.fPaint && rec.fPaint->nothingToDraw()) {
// no need for the layer (or any of the draws until the matching restore()
this->save();
this->clipRect({0,0,0,0});
} else {
SaveLayerStrategy strategy = this->getSaveLayerStrategy(rec);
fSaveCount += 1;
this->internalSaveLayer(rec, strategy);
}
return this->getSaveCount() - 1;
}
@ -2001,7 +2007,7 @@ void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
}
LOOPER_END
} else {
} else if (!paint.nothingToDraw()) {
this->predrawNotify(&r, &paint, false);
SkDrawIter iter(this);
while (iter.next()) {