diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-01-11 12:21:43 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-11 18:03:35 +0000 |
commit | d081ff314f07104adacaadc3d0f8f13dc741f016 (patch) | |
tree | f901365dd5ecfb32e284048fb8273a45d407fe1b /gm | |
parent | c456b73fef9589bbdc5eb83eaa83e53c357bb3da (diff) |
More fixes for distance field paths
Disables use of SDFs for very small paths (because of blurring) and
adds a border of 1 pixel in device space to handle antialiasing.
BUG=chromium:677889
Change-Id: I81e49477c943d41523fd836e55abd696a985491f
Reviewed-on: https://skia-review.googlesource.com/6832
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/pathfill.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/gm/pathfill.cpp b/gm/pathfill.cpp index da0efea243..2562e7c9a5 100644 --- a/gm/pathfill.cpp +++ b/gm/pathfill.cpp @@ -140,6 +140,49 @@ static SkScalar make_line(SkPath* path) { return SkIntToScalar(40); } +static SkScalar make_info(SkPath* path) { + path->moveTo(24, 4); + path->cubicTo(12.94999980926514f, + 4, + 4, + 12.94999980926514f, + 4, + 24); + path->cubicTo(4, + 35.04999923706055f, + 12.94999980926514f, + 44, + 24, + 44); + path->cubicTo(35.04999923706055f, + 44, + 44, + 35.04999923706055f, + 44, + 24); + path->cubicTo(44, + 12.95000076293945f, + 35.04999923706055f, + 4, + 24, + 4); + path->close(); + path->moveTo(26, 34); + path->lineTo(22, 34); + path->lineTo(22, 22); + path->lineTo(26, 22); + path->lineTo(26, 34); + path->close(); + path->moveTo(26, 18); + path->lineTo(22, 18); + path->lineTo(22, 14); + path->lineTo(26, 14); + path->lineTo(26, 18); + path->close(); + + return SkIntToScalar(44); +} + constexpr MakePathProc gProcs[] = { make_frame, make_triangle, @@ -158,11 +201,14 @@ constexpr MakePathProc gProcs[] = { class PathFillGM : public skiagm::GM { SkPath fPath[N]; SkScalar fDY[N]; + SkPath fInfoPath; protected: void onOnceBeforeDraw() override { for (size_t i = 0; i < N; i++) { fDY[i] = gProcs[i](&fPath[i]); } + + (void) make_info(&fInfoPath); } @@ -182,6 +228,10 @@ protected: canvas->drawPath(fPath[i], paint); canvas->translate(SkIntToScalar(0), fDY[i]); } + + canvas->scale(0.300000011920929f, 0.300000011920929f); + canvas->translate(50, 50); + canvas->drawPath(fInfoPath, paint); } private: |