Skip to content

Commit

Permalink
fix make_path to not care about param-eval-order
Browse files Browse the repository at this point in the history
Change-Id: I2ed4568768628fd1870acda0272056dc7e9920fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258516
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
  • Loading branch information
reed-at-google authored and Skia Commit-Bot committed Dec 5, 2019
1 parent cc92b27 commit 0483b46
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
13 changes: 10 additions & 3 deletions gm/perspshaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,19 @@ DEF_GM(return new PerspShadersGM(false);)

static SkPath make_path() {
SkRandom rand;
auto rand_pt = [&rand]() { return SkPoint{rand.nextF() * 400, rand.nextF() * 400}; };
auto rand_pt = [&rand]() {
auto x = rand.nextF();
auto y = rand.nextF();
return SkPoint{x * 400, y * 400};
};

SkPath path;
for (int i = 0; i < 4; ++i) {
path.moveTo(rand_pt()).quadTo(rand_pt(), rand_pt())
.quadTo(rand_pt(), rand_pt()).lineTo(rand_pt());
SkPoint pts[6];
for (auto& p : pts) {
p = rand_pt();
}
path.moveTo(pts[0]).quadTo(pts[1], pts[2]).quadTo(pts[3], pts[4]).lineTo(pts[5]);
}
return path;
}
Expand Down
13 changes: 10 additions & 3 deletions samplecode/SampleClip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,19 @@ static void draw_halfplane(SkCanvas* canvas, SkPoint p0, SkPoint p1, SkColor c)

static SkPath make_path() {
SkRandom rand;
auto rand_pt = [&rand]() { return SkPoint{rand.nextF() * 400, rand.nextF() * 400}; };
auto rand_pt = [&rand]() {
auto x = rand.nextF();
auto y = rand.nextF();
return SkPoint{x * 400, y * 400};
};

SkPath path;
for (int i = 0; i < 4; ++i) {
path.moveTo(rand_pt()).quadTo(rand_pt(), rand_pt())
.quadTo(rand_pt(), rand_pt()).lineTo(rand_pt());
SkPoint pts[6];
for (auto& p : pts) {
p = rand_pt();
}
path.moveTo(pts[0]).quadTo(pts[1], pts[2]).quadTo(pts[3], pts[4]).lineTo(pts[5]);
}
return path;
}
Expand Down

0 comments on commit 0483b46

Please sign in to comment.