aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/strokes.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-05-19 11:05:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-19 11:05:37 -0700
commit612f70d5fa2d4bf7a393c791966bbce933407017 (patch)
tree1174459cfba4fe50b0be8b75f149d4650e3e7aaa /gm/strokes.cpp
parentee2a8eede9ba9efd34cd132c5abc175f9c434b7a (diff)
handle large conic strokes better
A stroked conic computes the outset quad's control point by computing the intersection of the quad's endpoints. If the the denominator used to compute the scale factor for the control point is small, check to see if the numerator is also small so that the division stays bounded. Also clean up error returns and internal function calls to simplify the code. Additionally, remove comic max curvature (unimplemented) and call extrema functions instead to handle cases where the conic is degenerate or is a line. R=reed@google.com, fmalita@chromium.org BUG=skia:3843 Review URL: https://codereview.chromium.org/1144883003
Diffstat (limited to 'gm/strokes.cpp')
-rw-r--r--gm/strokes.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index a258dfe005..9de20911ce 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -241,12 +241,42 @@ private:
typedef skiagm::GM INHERITED;
};
+class Strokes4GM : public skiagm::GM {
+public:
+ Strokes4GM() {}
+
+protected:
+
+ SkString onShortName() override {
+ return SkString("strokes_zoomed");
+ }
+
+ SkISize onISize() override {
+ return SkISize::Make(W, H*2);
+ }
+
+ void onDraw(SkCanvas* canvas) override {
+ SkPaint paint;
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setStrokeWidth(0.055f);
+
+ canvas->scale(1000, 1000);
+ canvas->drawCircle(0, 2, 1.97f, paint);
+ }
+
+private:
+ typedef skiagm::GM INHERITED;
+};
+
+
//////////////////////////////////////////////////////////////////////////////
static skiagm::GM* F0(void*) { return new StrokesGM; }
static skiagm::GM* F1(void*) { return new Strokes2GM; }
static skiagm::GM* F2(void*) { return new Strokes3GM; }
+static skiagm::GM* F3(void*) { return new Strokes4GM; }
static skiagm::GMRegistry R0(F0);
static skiagm::GMRegistry R1(F1);
static skiagm::GMRegistry R2(F2);
+static skiagm::GMRegistry R3(F3);