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

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
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrPathUtils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Output:
136 // klm: Holds the values for the linear functionals as:
137 // K = (klm[0], klm[1], klm[2])
138 // L = (klm[3], klm[4], klm[5])
139 // M = (klm[6], klm[7], klm[8])
140 // klm_rev: These values are flags for the corresponding sub cubic saying wh ether or not
141 // the K and L values need to be flipped. A value of -1.f means fli p K and L and
142 // a value of 1.f means do nothing.
143 // *****DO NOT FLIP M, JUST K AND L*****
144 //
145 // Notice that the klm lines are calculated in the same space as the input c ontrol points.
146 // If you transform the points the lines will also need to be transformed. T his can be done
147 // by mapping the lines with the inverse-transpose of the matrix used to map the points.
148 int chopCubicAtLoopIntersection(const SkPoint src[4], SkPoint dst[10] = NULL ,
149 SkScalar klm[9] = NULL, SkScalar klm_rev[3] = NULL);
150
151 // Input is p which holds the 4 control points of a non-rational cubic Bezie r curve.
152 // Output is the coefficients of the three linear functionals K, L, & M whic h
153 // represent the implicit form of the cubic as f(x,y,w) = K^3 - LM. The w te rm
154 // will always be 1. The output is stored in the array klm, where the values are:
155 // K = (klm[0], klm[1], klm[2])
156 // L = (klm[3], klm[4], klm[5])
157 // M = (klm[6], klm[7], klm[8])
158 //
159 // Notice that the klm lines are calculated in the same space as the input c ontrol points.
160 // If you transform the points the lines will also need to be transformed. T his can be done
161 // by mapping the lines with the inverse-transpose of the matrix used to map the points.
162 void getCubicKLM(const SkPoint p[4], SkScalar klm[9]);
118 }; 163 };
119 #endif 164 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrPathUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698