diff options
author | fmalita <fmalita@chromium.org> | 2015-10-06 07:24:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-06 07:24:03 -0700 |
commit | b0cd8b714629352638f17154cfc05ade03fff8f5 (patch) | |
tree | 851c673ece96e62a507b51fc81512db9c4450ab0 | |
parent | 8d57faf31819e714de797ba43194f199d7616c39 (diff) |
[SkDebugger] Handle path empty-bounds gracefully
Paths with empty bounds crash the debugger: mapping their bounds onto
the shapshot area gets the canvas into an unhappy state.
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/1387173003
-rw-r--r-- | src/utils/debugger/SkDrawCommand.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp index 20aad3b9a5..99c120bb7f 100644 --- a/src/utils/debugger/SkDrawCommand.cpp +++ b/src/utils/debugger/SkDrawCommand.cpp @@ -100,10 +100,13 @@ void xlate_and_scale_to_bounds(SkCanvas* canvas, const SkRect& bounds) { void render_path(SkCanvas* canvas, const SkPath& path) { canvas->clear(0xFFFFFFFF); - canvas->save(); const SkRect& bounds = path.getBounds(); + if (bounds.isEmpty()) { + return; + } + SkAutoCanvasRestore acr(canvas, true); xlate_and_scale_to_bounds(canvas, bounds); SkPaint p; @@ -111,7 +114,6 @@ void render_path(SkCanvas* canvas, const SkPath& path) { p.setStyle(SkPaint::kStroke_Style); canvas->drawPath(path, p); - canvas->restore(); } void render_bitmap(SkCanvas* canvas, const SkBitmap& input, const SkRect* srcRect = nullptr) { |