Remove GrPathCmd

R=reed@google.com

Review URL: https://codereview.chromium.org/15068008

git-svn-id: http://skia.googlecode.com/svn/trunk@9097 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2013-05-10 17:14:06 +00:00
parent 512c9b65fc
commit 94b284d719
6 changed files with 30 additions and 72 deletions

View File

@ -500,39 +500,6 @@ enum GrClipType {
kPath_ClipType
};
/**
* Commands used to describe a path. Each command
* is accompanied by some number of points.
*/
enum GrPathCmd {
kMove_PathCmd, //!< Starts a new subpath at
// at the returned point
// 1 point
kLine_PathCmd, //!< Adds a line segment
// 2 points
kQuadratic_PathCmd, //!< Adds a quadratic segment
// 3 points
kCubic_PathCmd, //!< Adds a cubic segment
// 4 points
kClose_PathCmd, //!< Closes the current subpath
// by connecting a line to the
// starting point.
// 0 points
kEnd_PathCmd //!< Indicates the end of the last subpath
// when iterating
// 0 points.
};
/**
* Gets the number of points associated with a path command.
*/
static int inline NumPathCmdPoints(GrPathCmd cmd) {
static const int gNumPoints[] = {
1, 2, 3, 4, 0, 0
};
return gNumPoints[cmd];
}
///////////////////////////////////////////////////////////////////////////////
// opaque type for 3D API object handles

View File

@ -45,15 +45,6 @@ GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff);
#define sk_blend_to_grblend(X) ((GrBlendCoeff)(X))
GR_STATIC_ASSERT((int)SkPath::kMove_Verb == (int)kMove_PathCmd);
GR_STATIC_ASSERT((int)SkPath::kLine_Verb == (int)kLine_PathCmd);
GR_STATIC_ASSERT((int)SkPath::kQuad_Verb == (int)kQuadratic_PathCmd);
GR_STATIC_ASSERT((int)SkPath::kCubic_Verb == (int)kCubic_PathCmd);
GR_STATIC_ASSERT((int)SkPath::kClose_Verb == (int)kClose_PathCmd);
GR_STATIC_ASSERT((int)SkPath::kDone_Verb == (int)kEnd_PathCmd);
#define sk_path_verb_to_gr_path_command(X) ((GrPathCmd)(X))
///////////////////////////////////////////////////////////////////////////////
#include "SkColorPriv.h"

View File

@ -243,13 +243,13 @@ bool get_segments(const SkPath& path,
for (;;) {
GrPoint pts[4];
GrPathCmd cmd = (GrPathCmd)iter.next(pts);
switch (cmd) {
case kMove_PathCmd:
SkPath::Verb verb = iter.next(pts);
switch (verb) {
case SkPath::kMove_Verb:
m.mapPoints(pts, 1);
update_degenerate_test(&degenerateData, pts[0]);
break;
case kLine_PathCmd: {
case SkPath::kLine_Verb: {
m.mapPoints(pts + 1, 1);
update_degenerate_test(&degenerateData, pts[1]);
segments->push_back();
@ -257,7 +257,7 @@ bool get_segments(const SkPath& path,
segments->back().fPts[0] = pts[1];
break;
}
case kQuadratic_PathCmd:
case SkPath::kQuad_Verb:
m.mapPoints(pts + 1, 2);
update_degenerate_test(&degenerateData, pts[1]);
update_degenerate_test(&degenerateData, pts[2]);
@ -266,7 +266,7 @@ bool get_segments(const SkPath& path,
segments->back().fPts[0] = pts[1];
segments->back().fPts[1] = pts[2];
break;
case kCubic_PathCmd: {
case SkPath::kCubic_Verb: {
m.mapPoints(pts, 4);
update_degenerate_test(&degenerateData, pts[1]);
update_degenerate_test(&degenerateData, pts[2]);
@ -284,7 +284,7 @@ bool get_segments(const SkPath& path,
}
break;
};
case kEnd_PathCmd:
case SkPath::kDone_Verb:
if (degenerateData.isDegenerate()) {
return false;
} else {

View File

@ -219,11 +219,11 @@ int generate_lines_and_quads(const SkPath& path,
for (;;) {
GrPoint pts[4];
GrPoint devPts[4];
GrPathCmd cmd = (GrPathCmd)iter.next(pts);
switch (cmd) {
case kMove_PathCmd:
SkPath::Verb verb = iter.next(pts);
switch (verb) {
case SkPath::kMove_Verb:
break;
case kLine_PathCmd:
case SkPath::kLine_Verb:
m.mapPoints(devPts, pts, 2);
bounds.setBounds(devPts, 2);
bounds.outset(SK_Scalar1, SK_Scalar1);
@ -234,7 +234,7 @@ int generate_lines_and_quads(const SkPath& path,
pts[1] = devPts[1];
}
break;
case kQuadratic_PathCmd:
case SkPath::kQuad_Verb:
m.mapPoints(devPts, pts, 3);
bounds.setBounds(devPts, 3);
bounds.outset(SK_Scalar1, SK_Scalar1);
@ -260,7 +260,7 @@ int generate_lines_and_quads(const SkPath& path,
}
}
break;
case kCubic_PathCmd:
case SkPath::kCubic_Verb:
m.mapPoints(devPts, pts, 4);
bounds.setBounds(devPts, 4);
bounds.outset(SK_Scalar1, SK_Scalar1);
@ -317,9 +317,9 @@ int generate_lines_and_quads(const SkPath& path,
}
}
break;
case kClose_PathCmd:
case SkPath::kClose_Verb:
break;
case kEnd_PathCmd:
case SkPath::kDone_Verb:
return totalQuadCount;
}
}

View File

@ -253,9 +253,9 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
SkPath::Iter iter(path, false);
for (;;) {
GrPathCmd cmd = (GrPathCmd)iter.next(pts);
switch (cmd) {
case kMove_PathCmd:
SkPath::Verb verb = iter.next(pts);
switch (verb) {
case SkPath::kMove_Verb:
if (!first) {
uint16_t currIdx = (uint16_t) (vert - base);
subpathIdxStart = currIdx;
@ -264,7 +264,7 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
*vert = pts[0];
vert++;
break;
case kLine_PathCmd:
case SkPath::kLine_Verb:
if (indexed) {
uint16_t prevIdx = (uint16_t)(vert - base) - 1;
append_countour_edge_indices(isHairline, subpathIdxStart,
@ -272,7 +272,7 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
}
*(vert++) = pts[1];
break;
case kQuadratic_PathCmd: {
case SkPath::kQuad_Verb: {
// first pt of quad is the pt we ended on in previous step
uint16_t firstQPtIdx = (uint16_t)(vert - base) - 1;
uint16_t numPts = (uint16_t)
@ -288,7 +288,7 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
}
break;
}
case kCubic_PathCmd: {
case SkPath::kCubic_Verb: {
// first pt of cubic is the pt we ended on in previous step
uint16_t firstCPtIdx = (uint16_t)(vert - base) - 1;
uint16_t numPts = (uint16_t) GrPathUtils::generateCubicPoints(
@ -303,9 +303,9 @@ bool GrDefaultPathRenderer::createGeom(const SkPath& path,
}
break;
}
case kClose_PathCmd:
case SkPath::kClose_Verb:
break;
case kEnd_PathCmd:
case SkPath::kDone_Verb:
// uint16_t currIdx = (uint16_t) (vert - base);
goto FINISHED;
}

View File

@ -158,22 +158,22 @@ int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths,
bool first = true;
SkPath::Iter iter(path, false);
GrPathCmd cmd;
SkPath::Verb verb;
GrPoint pts[4];
while ((cmd = (GrPathCmd)iter.next(pts)) != kEnd_PathCmd) {
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
switch (cmd) {
case kLine_PathCmd:
switch (verb) {
case SkPath::kLine_Verb:
pointCount += 1;
break;
case kQuadratic_PathCmd:
case SkPath::kQuad_Verb:
pointCount += quadraticPointCount(pts, tol);
break;
case kCubic_PathCmd:
case SkPath::kCubic_Verb:
pointCount += cubicPointCount(pts, tol);
break;
case kMove_PathCmd:
case SkPath::kMove_Verb:
pointCount += 1;
if (!first) {
++(*subpaths);