Commit ae5bc7f7 authored by mtklein's avatar mtklein Committed by Commit bot

Update AnalysisCanvas drawRect early-exit logic to match SkCanvas.cpp again.

We're getting away without checking bounds today because we're building
and checking a bounding-box hierarchy at record time; draws outside the
picture bounds happen to never be recorded.

This isn't a guarantee of the recording API, and indeed doesn't happen if you
record without a bounding-box hierarchy.  We want to lean on this lack of
guarantee a bit more.  To cut down on time spent recording, we may move around
when we build a bounding box hierarchy.  The upshot is that the SkPicture may
contain commands that won't draw anything, and AnalysisCanvas might receive them.

In short, the safe thing to do is quickReject just like SkCanvas does.

tested: cc_unittests, unit_tests

(Background: found this when debugging PicturePileImplTest.AnalyzeIsSolid* failures from  http://crrev.com/504823003)

BUG=

Review URL: https://codereview.chromium.org/505263002

Cr-Commit-Position: refs/heads/master@{#292141}
parent 65f10d02
......@@ -110,8 +110,14 @@ void AnalysisCanvas::drawPoints(SkCanvas::PointMode mode,
}
void AnalysisCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
// This recreates the early-exit logic in SkCanvas.cpp, which aborts early
// if the paint will "draw nothing".
// This recreates the early-exit logic in SkCanvas.cpp.
SkRect scratch;
if (paint.canComputeFastBounds() &&
quickReject(paint.computeFastBounds(rect, &scratch))) {
return;
}
// An extra no-op check SkCanvas.cpp doesn't do.
if (paint.nothingToDraw())
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment