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

Unified Diff: gm/strokes.cpp

Issue 1418133007: fix for teeny strokes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | src/core/SkStroke.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/strokes.cpp
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index e74d35f800ed091d742069856baea76ce1674dae..4cdfe61e4962cc2e71018d7b26d1cece4246d787 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -158,6 +158,42 @@ private:
typedef skiagm::GM INHERITED;
};
+class TeenyStrokesGM : public skiagm::GM {
+
+ SkString onShortName() override {
+ return SkString("teenyStrokes");
+ }
+
+ SkISize onISize() override {
+ return SkISize::Make(W, H*2);
+ }
+
+ static void line(SkScalar scale, SkCanvas* canvas, SkColor color) {
+ SkPaint p;
+ p.setAntiAlias(true);
+ p.setStyle(SkPaint::kStroke_Style);
+ p.setColor(color);
+ canvas->translate(50, 0);
+ canvas->save();
+ p.setStrokeWidth(scale * 5);
+ canvas->scale(1 / scale, 1 / scale);
+ canvas->drawLine(20 * scale, 20 * scale, 20 * scale, 100 * scale, p);
+ canvas->drawLine(20 * scale, 20 * scale, 100 * scale, 100 * scale, p);
+ canvas->restore();
+ }
+
+ void onDraw(SkCanvas* canvas) override {
+ line(0.00005f, canvas, SK_ColorBLACK);
+ line(0.000045f, canvas, SK_ColorRED);
+ line(0.0000035f, canvas, SK_ColorGREEN);
+ line(0.000003f, canvas, SK_ColorBLUE);
+ line(0.000002f, canvas, SK_ColorBLACK);
+ }
+private:
+ typedef skiagm::GM INHERITED;
+};
+
+
class Strokes2GM : public skiagm::GM {
SkPath fPath;
protected:
@@ -418,3 +454,4 @@ static skiagm::GMRegistry R3(F3);
static skiagm::GMRegistry R4(F4);
DEF_GM( return new ZeroLenStrokesGM; )
+DEF_GM( return new TeenyStrokesGM; )
« no previous file with comments | « no previous file | src/core/SkStroke.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698