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

Unified Diff: gm/bug5252.cpp

Issue 1943403006: fix hairline clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixed indenting; removed debugging Created 4 years, 7 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 | src/core/SkScan_Hairline.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/bug5252.cpp
diff --git a/gm/bug5252.cpp b/gm/bug5252.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9142a1e37f3ecf5f00109fa9f213043ff35f23f1
--- /dev/null
+++ b/gm/bug5252.cpp
@@ -0,0 +1,43 @@
+/*
+* Copyright 2016 Google Inc.
+*
+* Use of this source code is governed by a BSD-style license that can be
+* found in the LICENSE file.
+*/
+
+#include "gm.h"
+#include "SkCanvas.h"
+#include "SkRect.h"
+#include "SkPath.h"
+
+DEF_SIMPLE_GM(bug5252, canvas, 500, 500) {
+ canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
+
+ SkPath clip1;
+ clip1.addOval(SkRect::MakeWH(225, 200));
+ canvas->clipPath(clip1); // bug
+
+ SkPath clip2;
+ clip2.addRect(SkRect::MakeWH(220, 200));
+ //canvas->clipPath(clip2); // ok
+
+ SkPaint pa;
+ pa.setStyle(SkPaint::kStroke_Style);
+ pa.setAntiAlias(true);
+ pa.setStrokeWidth(1.0f);
+ for (int i = 0; i < 15; i++)
+ {
+ for (int j = 0; j < 10; j++)
+ {
+ SkAutoCanvasRestore acs(canvas, true);
+
+ canvas->translate(i * 15.f, j * 20.f);
+ canvas->drawRect(SkRect::MakeXYWH(5, 5, 10, 15),pa);
+ SkPath path;
+ path.moveTo(6, 6);
+ path.cubicTo(14, 10, 13, 12, 10, 12);
+ path.cubicTo(7, 15, 8, 17, 14, 18);
+ canvas->drawPath(path, pa);
+ }
+ }
+}
« no previous file with comments | « no previous file | src/core/SkScan_Hairline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698