aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/pathfill.cpp
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2017-02-15 15:46:52 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-16 13:35:20 +0000
commitf9e678d6964bc5a6c2b38edbc36d9f23cf96c37f (patch)
tree990878ccfa1b0102f48d7108b9bc0000dd95cee8 /gm/pathfill.cpp
parentfa64774820cb42594d3f5bc2059953510f038636 (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. Was: https://skia-review.googlesource.com/c/8328/ BUG=chromium:682918, skia:6238 Change-Id: Ia62ea5ce6b4a5ac2b8b51d06d57dc951d6c340b8 Reviewed-on: https://skia-review.googlesource.com/8384 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 de762a9548..a36ab1f459 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: