diff options
author | mtklein <mtklein@chromium.org> | 2014-08-27 07:23:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-27 14:24:51 +0000 |
commit | ae5bc7f7a80a8d8eb2bef1fc50c2e935def19d7b (patch) | |
tree | 47dbc00d9cb7f112cb9c2c6f2382c40c10647ded /skia | |
parent | 65f10d02cf68fd51bcd3bfcf42ef5f50335e7b65 (diff) | |
download | chromium_src-ae5bc7f7a80a8d8eb2bef1fc50c2e935def19d7b.zip chromium_src-ae5bc7f7a80a8d8eb2bef1fc50c2e935def19d7b.tar.gz chromium_src-ae5bc7f7a80a8d8eb2bef1fc50c2e935def19d7b.tar.bz2 |
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}
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/analysis_canvas.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc index 8be5f5b..5f9f48c 100644 --- a/skia/ext/analysis_canvas.cc +++ b/skia/ext/analysis_canvas.cc @@ -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; |