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

Side by Side Diff: src/gpu/GrPathUtils.h

Issue 22900007: Add direct bezier cubic support for GPU shaders (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrPathUtils_DEFINED 8 #ifndef GrPathUtils_DEFINED
9 #define GrPathUtils_DEFINED 9 #define GrPathUtils_DEFINED
10 10
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // control points taken together form a convex polygon. It relies on this 108 // control points taken together form a convex polygon. It relies on this
109 // property and the quadratic approximation of cubics step cannot alter it. 109 // property and the quadratic approximation of cubics step cannot alter it.
110 // Setting constrainWithinTangents to true enforces this property. When this 110 // Setting constrainWithinTangents to true enforces this property. When this
111 // is true the cubic must be simple and dir must specify the orientation of 111 // is true the cubic must be simple and dir must specify the orientation of
112 // the cubic. Otherwise, dir is ignored. 112 // the cubic. Otherwise, dir is ignored.
113 void convertCubicToQuads(const GrPoint p[4], 113 void convertCubicToQuads(const GrPoint p[4],
114 SkScalar tolScale, 114 SkScalar tolScale,
115 bool constrainWithinTangents, 115 bool constrainWithinTangents,
116 SkPath::Direction dir, 116 SkPath::Direction dir,
117 SkTArray<SkPoint, true>* quads); 117 SkTArray<SkPoint, true>* quads);
118
119 // Chops the cubic bezier passed in by src, at the double point (intersectio n point)
120 // if the curve is a cubic loop. If it is a loop, there will be two parametr ic values for
121 // the double point: ls and ms. We chop the cubic at these values if they ar e between 0 and 1.
122 // Return value:
123 // Value of 3: ls and ms are both between (0,1), and dst will contain the th ree cubics,
124 // dst[0..3], dst[3..6], and dst[6..9] if dst is not NULL
125 // Value of 2: Only one of ls and ms are between (0,1), and dst will contain the two cubics,
126 // dst[0..3] and dst[3..6] if dst is not NULL
127 // Value of 1: Neither ls or ms are between (0,1), and dst will contain the one original cubic,
128 // dst[0..3] if dst is not NULL
129 //
130 // Optional KLM Calculation:
131 // The function can also return the KLM linear functionals for the chopped c ubic implicit form
132 // of K^3 - LM.
133 // It will calculate a single set of KLM values that can be shared by all su b cubics, except
134 // for the subsection that is "the loop" the K and L values need to be negat ed.
135 // Input:
136 // Need to send in the device coords for the original src points. The KLM ca lculations will be
137 // done using the points in device space.
138 // Output:
139 // klm: Holds the values for the linear functionals as:
140 // K = (klm[0], klm[1], klm[2])
141 // L = (klm[3], klm[4], klm[5])
142 // M = (klm[6], klm[7], klm[8])
143 // klm_rev: These values are flags for the corresponding sub cubic saying wh ether or not
144 // the K and L values need to be flipped. A value of -1.f means fli p K and L and
145 // a value of 1.f means do nothing
146 int chopCubicAtLoopIntersection(const SkPoint src[4], SkPoint dst[10] = NULL ,
147 SkScalar klm[9] = NULL, SkScalar klm_rev[3] = NULL,
148 const SkPoint devPts[4] = NULL);
149
150 // Input is p which holds the 4 control points of a non-rational cubic Bezie r curve.
151 // Output is the coefficients of the three linear functionals K, L, & M whic h
152 // represent the implicit form of the cubic as f(x,y,w) = K^3 - LM. The w te rm
153 // will always be 1. The output is stored in the array klm, where the values are:
154 // K = (klm[0], klm[1], klm[2])
155 // L = (klm[3], klm[4], klm[5])
156 // M = (klm[6], klm[7], klm[8])
157 void getCubicKLM(const SkPoint p[4], SkScalar klm[9]);
118 }; 158 };
119 #endif 159 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698