aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/pathfill.cpp
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2017-02-10 15:24:39 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-10 21:26:33 +0000
commit6e83b13c226246041a33dc7bf0e92626581b5e79 (patch)
tree555310ae893c0e52c440e1163bb43dace38e4afa /gm/pathfill.cpp
parent368af4605db18f7197ed3289d2ebdc93bbb5879b (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/pathfill.cpp')
-rw-r--r--gm/pathfill.cpp55
1 files changed, 52 insertions, 3 deletions
diff --git a/gm/pathfill.cpp b/gm/pathfill.cpp
index 2562e7c9a5..66a31b5b70 100644
--- a/gm/pathfill.cpp
+++ b/gm/pathfill.cpp
@@ -140,7 +140,7 @@ static SkScalar make_line(SkPath* path) {
return SkIntToScalar(40);
}
-static SkScalar make_info(SkPath* path) {
+static void make_info(SkPath* path) {
path->moveTo(24, 4);
path->cubicTo(12.94999980926514f,
4,
@@ -179,8 +179,49 @@ static SkScalar make_info(SkPath* path) {
path->lineTo(26, 14);
path->lineTo(26, 18);
path->close();
+}
- return SkIntToScalar(44);
+static void make_accessibility(SkPath* path) {
+ path->moveTo(12, 2);
+ path->cubicTo(13.10000038146973f,
+ 2,
+ 14,
+ 2.900000095367432f,
+ 14,
+ 4);
+ path->cubicTo(14,
+ 5.099999904632568f,
+ 13.10000038146973f,
+ 6,
+ 12,
+ 6);
+ path->cubicTo(10.89999961853027f,
+ 6,
+ 10,
+ 5.099999904632568f,
+ 10,
+ 4);
+ path->cubicTo(10,
+ 2.900000095367432f,
+ 10.89999961853027f,
+ 2,
+ 12,
+ 2);
+ path->close();
+ path->moveTo(21, 9);
+ path->lineTo(15, 9);
+ path->lineTo(15, 22);
+ path->lineTo(13, 22);
+ path->lineTo(13, 16);
+ path->lineTo(11, 16);
+ path->lineTo(11, 22);
+ path->lineTo(9, 22);
+ path->lineTo(9, 9);
+ path->lineTo(3, 9);
+ path->lineTo(3, 7);
+ path->lineTo(21, 7);
+ path->lineTo(21, 9);
+ path->close();
}
constexpr MakePathProc gProcs[] = {
@@ -202,13 +243,15 @@ class PathFillGM : public skiagm::GM {
SkPath fPath[N];
SkScalar fDY[N];
SkPath fInfoPath;
+ SkPath fAccessibilityPath;
protected:
void onOnceBeforeDraw() override {
for (size_t i = 0; i < N; i++) {
fDY[i] = gProcs[i](&fPath[i]);
}
- (void) make_info(&fInfoPath);
+ make_info(&fInfoPath);
+ make_accessibility(&fAccessibilityPath);
}
@@ -229,9 +272,15 @@ protected:
canvas->translate(SkIntToScalar(0), fDY[i]);
}
+ canvas->save();
canvas->scale(0.300000011920929f, 0.300000011920929f);
canvas->translate(50, 50);
canvas->drawPath(fInfoPath, paint);
+ canvas->restore();
+
+ canvas->scale(2, 2);
+ canvas->translate(5, 15);
+ canvas->drawPath(fAccessibilityPath, paint);
}
private: