diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-02-10 15:24:39 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-10 21:26:33 +0000 |
commit | 6e83b13c226246041a33dc7bf0e92626581b5e79 (patch) | |
tree | 555310ae893c0e52c440e1163bb43dace38e4afa /gm/convexpaths.cpp | |
parent | 368af4605db18f7197ed3289d2ebdc93bbb5879b (diff) |
Use SDF path miplevels based on the original path's size.
Should produce sharper results than arbitrary fixed sizes.
Adds a new test to pathfill GM.
BUG=chromium:682918
Change-Id: I5a394098665d01e995a244fde278236f1471e6c9
Reviewed-on: https://skia-review.googlesource.com/8328
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'gm/convexpaths.cpp')
-rw-r--r-- | gm/convexpaths.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/gm/convexpaths.cpp b/gm/convexpaths.cpp index 50939f9183..766a6cee18 100644 --- a/gm/convexpaths.cpp +++ b/gm/convexpaths.cpp @@ -260,29 +260,29 @@ protected: virtual void onDraw(SkCanvas* canvas) { this->makePaths(); - SkPaint paint; - paint.setAntiAlias(true); - SkRandom rand; - canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); - - // As we've added more paths this has gotten pretty big. Scale the whole thing down. - canvas->scale(2 * SK_Scalar1 / 3, 2 * SK_Scalar1 / 3); - - for (int i = 0; i < fPaths.count(); ++i) { - canvas->save(); - // position the path, and make it at off-integer coords. - canvas->translate(SK_Scalar1 * 200 * (i % 5) + SK_Scalar1 / 10, - SK_Scalar1 * 200 * (i / 5) + 9 * SK_Scalar1 / 10); - SkColor color = rand.nextU(); - color |= 0xff000000; - paint.setColor(color); -#if 0 // This hitting on 32bit Linux builds for some paths. Temporarily disabling while it is - // debugged. - SkASSERT(fPaths[i].isConvex()); + SkPaint paint; + paint.setAntiAlias(true); + SkRandom rand; + canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); + + // As we've added more paths this has gotten pretty big. Scale the whole thing down. + canvas->scale(2 * SK_Scalar1 / 3, 2 * SK_Scalar1 / 3); + + for (int i = 0; i < fPaths.count(); ++i) { + canvas->save(); + // position the path, and make it at off-integer coords. + canvas->translate(SK_Scalar1 * 200 * (i % 5) + SK_Scalar1 / 10, + SK_Scalar1 * 200 * (i / 5) + 9 * SK_Scalar1 / 10); + SkColor color = rand.nextU(); + color |= 0xff000000; + paint.setColor(color); +#if 0 // This hitting on 32bit Linux builds for some paths. Temporarily disabling while it is + // debugged. + SkASSERT(fPaths[i].isConvex()); #endif - canvas->drawPath(fPaths[i], paint); - canvas->restore(); - } + canvas->drawPath(fPaths[i], paint); + canvas->restore(); + } } private: |