Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: samplecode/SampleHairCurves.cpp

Issue 21036008: Add Loop Blinn hairline conics to GPU (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleHairCurves.cpp
diff --git a/samplecode/SampleHairCurves.cpp b/samplecode/SampleHairCurves.cpp
index 183fc109953c555925edf357f4346fb51cdaad47..2cf0b3c90083a8981e2e36b5efffd414a28a66b4 100644
--- a/samplecode/SampleHairCurves.cpp
+++ b/samplecode/SampleHairCurves.cpp
@@ -35,6 +35,7 @@ protected:
canvas->save();
canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1);
SkRandom rand;
+ SkRandom randW;
SkPath curves;
SkPath hulls;
SkPath ctrlPts;
@@ -82,6 +83,27 @@ protected:
SkScalar pts[] = {
rand.nextUScalar1(), rand.nextUScalar1(),
rand.nextUScalar1(), rand.nextUScalar1(),
+ rand.nextUScalar1(), rand.nextUScalar1(),
+ };
+ SkScalar weight = randW.nextUScalar1() * 2.0f;
+
+ curves.moveTo(pts[0], pts[1]);
+ curves.conicTo(pts[2], pts[3],
+ pts[4], pts[5],
+ weight);
+
+ hulls.moveTo(pts[0], pts[1]);
+ hulls.lineTo(pts[2], pts[3]);
+ hulls.lineTo(pts[4], pts[5]);
+
+ ctrlPts.addCircle(pts[0], pts[1], SK_Scalar1 / 200);
+ ctrlPts.addCircle(pts[2], pts[3], SK_Scalar1 / 200);
+ ctrlPts.addCircle(pts[4], pts[5], SK_Scalar1 / 200);
+ }
+ for (int i = 0; i < 100; ++i) {
+ SkScalar pts[] = {
+ rand.nextUScalar1(), rand.nextUScalar1(),
+ rand.nextUScalar1(), rand.nextUScalar1(),
};
curves.moveTo(pts[0], pts[1]);
curves.lineTo(pts[2], pts[3]);
« no previous file with comments | « no previous file | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698