Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Unified Diff: src/utils/debugger/SkDrawCommand.cpp

Issue 1387173003: [SkDebugger] Handle path empty-bounds gracefully (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/debugger/SkDrawCommand.cpp
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp
index 20aad3b9a510b6824d92b63a60d71034631e7d29..99c120bb7f6e3e08611384433cd75ec30b8b6324 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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698