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

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: don't forget to restore 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..a57f36e7173899c1783fa9c94f3ce0da712f9cae 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -99,10 +99,13 @@ void xlate_and_scale_to_bounds(SkCanvas* canvas, const SkRect& bounds) {
void render_path(SkCanvas* canvas, const SkPath& path) {
robertphillips 2015/10/06 14:12:55 Maybe put this after the clear so we get a blank s
f(malita) 2015/10/06 14:17:21 Done.
- canvas->clear(0xFFFFFFFF);
- canvas->save();
-
const SkRect& bounds = path.getBounds();
+ if (bounds.isEmpty()) {
+ return;
+ }
+
+ SkAutoCanvasRestore acr(canvas, true);
+ canvas->clear(0xFFFFFFFF);
xlate_and_scale_to_bounds(canvas, bounds);
@@ -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