switched GrClipEdge to an enum class
Bug: skia:
Change-Id: Idf41580314a32739c70721530fc3ca48e566b044
Reviewed-on: https://skia-review.googlesource.com/70023
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 86469b2..ffd7b06 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -125,7 +125,7 @@
fragBuilder->declAppend(func);
switch (fEdgeType) {
- case kHairlineAA_GrClipEdgeType: {
+ case GrClipEdgeType::kHairlineAA: {
fragBuilder->codeAppendf("%s = dFdx(%s.xyz);", dklmdx.c_str(), v.fsIn());
fragBuilder->codeAppendf("%s = dFdy(%s.xyz);", dklmdy.c_str(), v.fsIn());
fragBuilder->codeAppendf("%s = 2.0 * %s.x * %s.x - %s.y * %s.z - %s.z * %s.y;",
@@ -153,7 +153,7 @@
// fragBuilder->codeAppend("edgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);");
break;
}
- case kFillAA_GrClipEdgeType: {
+ case GrClipEdgeType::kFillAA: {
fragBuilder->codeAppendf("%s = dFdx(%s.xyz);", dklmdx.c_str(), v.fsIn());
fragBuilder->codeAppendf("%s = dFdy(%s.xyz);", dklmdy.c_str(), v.fsIn());
fragBuilder->codeAppendf("%s ="
@@ -182,7 +182,7 @@
// fragBuilder->codeAppend("edgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);");
break;
}
- case kFillBW_GrClipEdgeType: {
+ case GrClipEdgeType::kFillBW: {
fragBuilder->codeAppendf("%s = %s.x * %s.x - %s.y * %s.z;",
edgeAlpha.c_str(), v.fsIn(), v.fsIn(), v.fsIn(), v.fsIn());
fragBuilder->codeAppendf("%s = float(%s < 0.0);",
@@ -255,7 +255,7 @@
do {
GrClipEdgeType edgeType =
static_cast<GrClipEdgeType>(
- d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
+ d->fRandom->nextULessThan(kGrClipEdgeTypeCnt));
gp = GrConicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
edgeType, *d->caps(), GrTest::TestMatrix(d->fRandom),
d->fRandom->nextBool());
@@ -358,7 +358,7 @@
fragBuilder->codeAppendf("half edgeAlpha;");
switch (fEdgeType) {
- case kHairlineAA_GrClipEdgeType: {
+ case GrClipEdgeType::kHairlineAA: {
fragBuilder->codeAppendf("half2 duvdx = dFdx(%s.xy);", v.fsIn());
fragBuilder->codeAppendf("half2 duvdy = dFdy(%s.xy);", v.fsIn());
fragBuilder->codeAppendf("half2 gF = half2(2.0 * %s.x * duvdx.x - duvdx.y,"
@@ -372,7 +372,7 @@
// fragBuilder->codeAppend("edgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);");
break;
}
- case kFillAA_GrClipEdgeType: {
+ case GrClipEdgeType::kFillAA: {
fragBuilder->codeAppendf("half2 duvdx = dFdx(%s.xy);", v.fsIn());
fragBuilder->codeAppendf("half2 duvdy = dFdy(%s.xy);", v.fsIn());
fragBuilder->codeAppendf("half2 gF = half2(2.0 * %s.x * duvdx.x - duvdx.y,"
@@ -386,7 +386,7 @@
// fragBuilder->codeAppend("edgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);");
break;
}
- case kFillBW_GrClipEdgeType: {
+ case GrClipEdgeType::kFillBW: {
fragBuilder->codeAppendf("edgeAlpha = (%s.x * %s.x - %s.y);",
v.fsIn(), v.fsIn(), v.fsIn());
fragBuilder->codeAppend("edgeAlpha = half(edgeAlpha < 0.0);");
@@ -456,7 +456,7 @@
sk_sp<GrGeometryProcessor> gp;
do {
GrClipEdgeType edgeType = static_cast<GrClipEdgeType>(
- d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
+ d->fRandom->nextULessThan(kGrClipEdgeTypeCnt));
gp = GrQuadEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), edgeType,
*d->caps(), GrTest::TestMatrix(d->fRandom),
d->fRandom->nextBool());
@@ -561,7 +561,7 @@
GrGLSLVertToFrag gradCoeffs(kFloat4_GrSLType);
- if (kFillAA_GrClipEdgeType == fEdgeType || kHairlineAA_GrClipEdgeType == fEdgeType) {
+ if (GrClipEdgeType::kFillAA == fEdgeType || GrClipEdgeType::kHairlineAA == fEdgeType) {
varyingHandler->addVarying("GradCoeffs", &gradCoeffs);
vertBuilder->codeAppendf("float k = %s[0], l = %s[1], m = %s[2];",
v.vsOut(), v.vsOut(), v.vsOut());
@@ -592,7 +592,7 @@
fragBuilder->declAppend(func);
switch (fEdgeType) {
- case kHairlineAA_GrClipEdgeType: {
+ case GrClipEdgeType::kHairlineAA: {
fragBuilder->codeAppendf("%s = %s.x * %s.xy + %s.zw;",
gF.c_str(), v.fsIn(), gradCoeffs.fsIn(), gradCoeffs.fsIn());
fragBuilder->codeAppendf("%s = %s.x * %s.x * %s.x - %s.y * %s.z;",
@@ -609,7 +609,7 @@
// edgeAlpha.c_str());
break;
}
- case kFillAA_GrClipEdgeType: {
+ case GrClipEdgeType::kFillAA: {
fragBuilder->codeAppendf("%s = %s.x * %s.xy + %s.zw;",
gF.c_str(), v.fsIn(), gradCoeffs.fsIn(), gradCoeffs.fsIn());
fragBuilder->codeAppendf("%s = %s.x * %s.x * %s.x - %s.y * %s.z;",
@@ -625,7 +625,7 @@
// edgeAlpha.c_str());
break;
}
- case kFillBW_GrClipEdgeType: {
+ case GrClipEdgeType::kFillBW: {
fragBuilder->codeAppendf("%s = %s.x * %s.x * %s.x - %s.y * %s.z;",
edgeAlpha.c_str(), v.fsIn(), v.fsIn(),
v.fsIn(), v.fsIn(), v.fsIn());
@@ -681,7 +681,7 @@
do {
GrClipEdgeType edgeType =
static_cast<GrClipEdgeType>(
- d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
+ d->fRandom->nextULessThan(kGrClipEdgeTypeCnt));
gp = GrCubicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool(), edgeType,
*d->caps());
diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h
index 3aac887..267259e 100644
--- a/src/gpu/effects/GrBezierEffect.h
+++ b/src/gpu/effects/GrBezierEffect.h
@@ -65,24 +65,24 @@
bool usesLocalCoords,
uint8_t coverage = 0xff) {
switch (edgeType) {
- case kFillAA_GrClipEdgeType:
+ case GrClipEdgeType::kFillAA:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return nullptr;
}
return sk_sp<GrGeometryProcessor>(
- new GrConicEffect(color, viewMatrix, coverage, kFillAA_GrClipEdgeType,
+ new GrConicEffect(color, viewMatrix, coverage, GrClipEdgeType::kFillAA,
localMatrix, usesLocalCoords));
- case kHairlineAA_GrClipEdgeType:
+ case GrClipEdgeType::kHairlineAA:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return nullptr;
}
return sk_sp<GrGeometryProcessor>(
new GrConicEffect(color, viewMatrix, coverage,
- kHairlineAA_GrClipEdgeType, localMatrix,
+ GrClipEdgeType::kHairlineAA, localMatrix,
usesLocalCoords));
- case kFillBW_GrClipEdgeType:
+ case GrClipEdgeType::kFillBW:
return sk_sp<GrGeometryProcessor>(
- new GrConicEffect(color, viewMatrix, coverage, kFillBW_GrClipEdgeType,
+ new GrConicEffect(color, viewMatrix, coverage, GrClipEdgeType::kFillBW,
localMatrix, usesLocalCoords));
default:
return nullptr;
@@ -147,24 +147,24 @@
bool usesLocalCoords,
uint8_t coverage = 0xff) {
switch (edgeType) {
- case kFillAA_GrClipEdgeType:
+ case GrClipEdgeType::kFillAA:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return nullptr;
}
return sk_sp<GrGeometryProcessor>(
- new GrQuadEffect(color, viewMatrix, coverage, kFillAA_GrClipEdgeType,
+ new GrQuadEffect(color, viewMatrix, coverage, GrClipEdgeType::kFillAA,
localMatrix, usesLocalCoords));
- case kHairlineAA_GrClipEdgeType:
+ case GrClipEdgeType::kHairlineAA:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return nullptr;
}
return sk_sp<GrGeometryProcessor>(
new GrQuadEffect(color, viewMatrix, coverage,
- kHairlineAA_GrClipEdgeType, localMatrix,
+ GrClipEdgeType::kHairlineAA, localMatrix,
usesLocalCoords));
- case kFillBW_GrClipEdgeType:
+ case GrClipEdgeType::kFillBW:
return sk_sp<GrGeometryProcessor>(
- new GrQuadEffect(color, viewMatrix, coverage, kFillBW_GrClipEdgeType,
+ new GrQuadEffect(color, viewMatrix, coverage, GrClipEdgeType::kFillBW,
localMatrix, usesLocalCoords));
default:
return nullptr;
@@ -240,15 +240,15 @@
}
switch (edgeType) {
- case kFillAA_GrClipEdgeType:
+ case GrClipEdgeType::kFillAA:
return sk_sp<GrGeometryProcessor>(
- new GrCubicEffect(color, viewMatrix, devKLM, kFillAA_GrClipEdgeType));
- case kHairlineAA_GrClipEdgeType:
+ new GrCubicEffect(color, viewMatrix, devKLM, GrClipEdgeType::kFillAA));
+ case GrClipEdgeType::kHairlineAA:
return sk_sp<GrGeometryProcessor>(
- new GrCubicEffect(color, viewMatrix, devKLM, kHairlineAA_GrClipEdgeType));
- case kFillBW_GrClipEdgeType:
+ new GrCubicEffect(color, viewMatrix, devKLM, GrClipEdgeType::kHairlineAA));
+ case GrClipEdgeType::kFillBW:
return sk_sp<GrGeometryProcessor>(
- new GrCubicEffect(color, viewMatrix, devKLM, kFillBW_GrClipEdgeType));
+ new GrCubicEffect(color, viewMatrix, devKLM, GrClipEdgeType::kFillBW));
default:
return nullptr;
}
diff --git a/src/gpu/effects/GrCircleEffect.cpp b/src/gpu/effects/GrCircleEffect.cpp
index 0c998d5..eccf8bf 100644
--- a/src/gpu/effects/GrCircleEffect.cpp
+++ b/src/gpu/effects/GrCircleEffect.cpp
@@ -111,9 +111,9 @@
SkScalar radius = testData->fRandom->nextRangeF(0.f, 1000.f);
GrClipEdgeType et;
do {
- et = (GrClipEdgeType)testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
- } while (kHairlineAA_GrClipEdgeType == et);
- return GrCircleEffect::Make(et, center, radius);
+ et = (GrClipEdgeType)testData->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
+ } while (GrClipEdgeType::kHairlineAA == et);
+ return GrCircleEffect::Make((int)et, center, radius);
}
#endif
#endif
diff --git a/src/gpu/effects/GrCircleEffect.fp b/src/gpu/effects/GrCircleEffect.fp
index 04edc5d..95cbeb0 100644
--- a/src/gpu/effects/GrCircleEffect.fp
+++ b/src/gpu/effects/GrCircleEffect.fp
@@ -37,15 +37,15 @@
// radius and then denormalized. This is to prevent overflow on devices that have a "real"
// mediump. It'd be nice to only do this on mediump devices.
half d;
- @if (edgeType == 2 /* kInverseFillBW_GrClipEdgeType */ ||
- edgeType == 3 /* kInverseFillAA_GrClipEdgeType */) {
+ @if (edgeType == 2 /* GrClipEdgeType::kInverseFillBW */ ||
+ edgeType == 3 /* GrClipEdgeType::kInverseFillAA */) {
d = (length((circle.xy - sk_FragCoord.xy) * circle.w) - 1.0) * circle.z;
} else {
d = (1.0 - length((circle.xy - sk_FragCoord.xy) * circle.w)) * circle.z;
}
- @if (edgeType == 1 /* kFillAA_GrClipEdgeType */ ||
- edgeType == 3 /* kInverseFillAA_GrClipEdgeType */ ||
- edgeType == 4 /* kHairlineAA_GrClipEdgeType */) {
+ @if (edgeType == 1 /* GrClipEdgeType::kFillAA */ ||
+ edgeType == 3 /* GrClipEdgeType::kInverseFillAA */ ||
+ edgeType == 4 /* GrClipEdgeType::kHairlineAA */) {
d = clamp(d, 0.0, 1.0);
} else {
d = d > 0.5 ? 1.0 : 0.0;
@@ -61,7 +61,7 @@
SkScalar radius = testData->fRandom->nextRangeF(0.f, 1000.f);
GrClipEdgeType et;
do {
- et = (GrClipEdgeType) testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
- } while (kHairlineAA_GrClipEdgeType == et);
- return GrCircleEffect::Make(et, center, radius);
+ et = (GrClipEdgeType) testData->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
+ } while (GrClipEdgeType::kHairlineAA == et);
+ return GrCircleEffect::Make((int) et, center, radius);
}
\ No newline at end of file
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 4da2898..d3954fc 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -66,7 +66,7 @@
std::unique_ptr<GrFragmentProcessor> fp;
do {
GrClipEdgeType edgeType = static_cast<GrClipEdgeType>(
- d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
+ d->fRandom->nextULessThan(kGrClipEdgeTypeCnt));
fp = AARectEffect::Make(edgeType, rect);
} while (nullptr == fp);
@@ -144,7 +144,7 @@
void GLAARectEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
GrProcessorKeyBuilder* b) {
const AARectEffect& aare = processor.cast<AARectEffect>();
- b->add32(aare.getEdgeType());
+ b->add32((int) aare.getEdgeType());
}
void AARectEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
@@ -221,8 +221,8 @@
void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
GrProcessorKeyBuilder* b) {
const GrConvexPolyEffect& cpe = processor.cast<GrConvexPolyEffect>();
- GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8);
- uint32_t key = (cpe.getEdgeCount() << 3) | cpe.getEdgeType();
+ GR_STATIC_ASSERT(kGrClipEdgeTypeCnt <= 8);
+ uint32_t key = (cpe.getEdgeCount() << 3) | (int) cpe.getEdgeType();
b->add32(key);
}
@@ -230,7 +230,7 @@
std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrClipEdgeType type,
const SkPath& path) {
- if (kHairlineAA_GrClipEdgeType == type) {
+ if (GrClipEdgeType::kHairlineAA == type) {
return nullptr;
}
if (path.getSegmentMasks() != SkPath::kLine_SegmentMask ||
@@ -301,7 +301,7 @@
std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrClipEdgeType edgeType,
const SkRect& rect) {
- if (kHairlineAA_GrClipEdgeType == edgeType){
+ if (GrClipEdgeType::kHairlineAA == edgeType){
return nullptr;
}
return AARectEffect::Make(edgeType, rect);
@@ -365,7 +365,7 @@
std::unique_ptr<GrFragmentProcessor> fp;
do {
GrClipEdgeType edgeType = static_cast<GrClipEdgeType>(
- d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
+ d->fRandom->nextULessThan(kGrClipEdgeTypeCnt));
fp = GrConvexPolyEffect::Make(edgeType, count, edges);
} while (nullptr == fp);
return fp;
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index 6202d60..d2ab4c9 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -40,7 +40,7 @@
*/
static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType edgeType, int n,
const SkScalar edges[]) {
- if (n <= 0 || n > kMaxEdges || kHairlineAA_GrClipEdgeType == edgeType) {
+ if (n <= 0 || n > kMaxEdges || GrClipEdgeType::kHairlineAA == edgeType) {
return nullptr;
}
return std::unique_ptr<GrFragmentProcessor>(new GrConvexPolyEffect(edgeType, n, edges));
diff --git a/src/gpu/effects/GrEllipseEffect.cpp b/src/gpu/effects/GrEllipseEffect.cpp
index 9556a63..20afa93 100644
--- a/src/gpu/effects/GrEllipseEffect.cpp
+++ b/src/gpu/effects/GrEllipseEffect.cpp
@@ -138,9 +138,9 @@
SkScalar ry = testData->fRandom->nextRangeF(0.f, 1000.f);
GrClipEdgeType et;
do {
- et = (GrClipEdgeType)testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
- } while (kHairlineAA_GrClipEdgeType == et);
- return GrEllipseEffect::Make(et, center, SkPoint::Make(rx, ry));
+ et = (GrClipEdgeType)testData->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
+ } while (GrClipEdgeType::kHairlineAA == et);
+ return GrEllipseEffect::Make((int)et, center, SkPoint::Make(rx, ry));
}
#endif
#endif
diff --git a/src/gpu/effects/GrEllipseEffect.fp b/src/gpu/effects/GrEllipseEffect.fp
index 8effaeb..f3feae1 100644
--- a/src/gpu/effects/GrEllipseEffect.fp
+++ b/src/gpu/effects/GrEllipseEffect.fp
@@ -72,16 +72,16 @@
half alpha;
@switch (edgeType) {
- case 0 /* kFillBW_GrClipEdgeType */:
+ case 0 /* GrClipEdgeType::kFillBW */:
alpha = approx_dist > 0.0 ? 0.0 : 1.0;
break;
- case 1 /* kFillAA_GrClipEdgeType */:
+ case 1 /* GrClipEdgeType::kFillAA */:
alpha = clamp(0.5 - approx_dist, 0.0, 1.0);
break;
- case 2 /* kInverseFillBW_GrClipEdgeType */:
+ case 2 /* GrClipEdgeType::kInverseFillBW */:
alpha = approx_dist > 0.0 ? 1.0 : 0.0;
break;
- case 3 /* kInverseFillAA_GrClipEdgeType */:
+ case 3 /* GrClipEdgeType::kInverseFillAA */:
alpha = clamp(0.5 + approx_dist, 0.0, 1.0);
break;
default:
@@ -99,7 +99,7 @@
SkScalar ry = testData->fRandom->nextRangeF(0.f, 1000.f);
GrClipEdgeType et;
do {
- et = (GrClipEdgeType) testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
- } while (kHairlineAA_GrClipEdgeType == et);
- return GrEllipseEffect::Make(et, center, SkPoint::Make(rx, ry));
+ et = (GrClipEdgeType) testData->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
+ } while (GrClipEdgeType::kHairlineAA == et);
+ return GrEllipseEffect::Make((int) et, center, SkPoint::Make(rx, ry));
}
\ No newline at end of file
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index ed90a7b..60ea9df 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -13,18 +13,19 @@
std::unique_ptr<GrFragmentProcessor> GrOvalEffect::Make(GrClipEdgeType edgeType,
const SkRect& oval) {
- if (kHairlineAA_GrClipEdgeType == edgeType) {
+ if (GrClipEdgeType::kHairlineAA == edgeType) {
return nullptr;
}
SkScalar w = oval.width();
SkScalar h = oval.height();
if (SkScalarNearlyEqual(w, h)) {
w /= 2;
- return GrCircleEffect::Make(edgeType, SkPoint::Make(oval.fLeft + w, oval.fTop + w), w);
+ return GrCircleEffect::Make((int) edgeType, SkPoint::Make(oval.fLeft + w, oval.fTop + w),
+ w);
} else {
w /= 2;
h /= 2;
- return GrEllipseEffect::Make(edgeType, SkPoint::Make(oval.fLeft + w, oval.fTop + h),
+ return GrEllipseEffect::Make((int) edgeType, SkPoint::Make(oval.fLeft + w, oval.fTop + h),
SkPoint::Make(w, h));
}
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 1247c2f..4b56443 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -81,7 +81,7 @@
std::unique_ptr<GrFragmentProcessor> CircularRRectEffect::Make(GrClipEdgeType edgeType,
uint32_t circularCornerFlags,
const SkRRect& rrect) {
- if (kFillAA_GrClipEdgeType != edgeType && kInverseFillAA_GrClipEdgeType != edgeType) {
+ if (GrClipEdgeType::kFillAA != edgeType && GrClipEdgeType::kInverseFillAA != edgeType) {
return nullptr;
}
return std::unique_ptr<GrFragmentProcessor>(
@@ -121,7 +121,7 @@
std::unique_ptr<GrFragmentProcessor> fp;
do {
GrClipEdgeType et =
- (GrClipEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
+ (GrClipEdgeType)d->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
fp = GrRRectEffect::Make(et, rrect);
} while (nullptr == fp);
return fp;
@@ -277,7 +277,7 @@
break;
}
- if (kInverseFillAA_GrClipEdgeType == crre.getEdgeType()) {
+ if (GrClipEdgeType::kInverseFillAA == crre.getEdgeType()) {
fragBuilder->codeAppend("alpha = 1.0 - alpha;");
}
@@ -287,8 +287,8 @@
void GLCircularRRectEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
GrProcessorKeyBuilder* b) {
const CircularRRectEffect& crre = processor.cast<CircularRRectEffect>();
- GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8);
- b->add32((crre.getCircularCornerFlags() << 3) | crre.getEdgeType());
+ GR_STATIC_ASSERT(kGrClipEdgeTypeCnt <= 8);
+ b->add32((crre.getCircularCornerFlags() << 3) | (int) crre.getEdgeType());
}
void GLCircularRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
@@ -417,7 +417,7 @@
std::unique_ptr<GrFragmentProcessor> EllipticalRRectEffect::Make(GrClipEdgeType edgeType,
const SkRRect& rrect) {
- if (kFillAA_GrClipEdgeType != edgeType && kInverseFillAA_GrClipEdgeType != edgeType) {
+ if (GrClipEdgeType::kFillAA != edgeType && GrClipEdgeType::kInverseFillAA != edgeType) {
return nullptr;
}
return std::unique_ptr<GrFragmentProcessor>(new EllipticalRRectEffect(edgeType, rrect));
@@ -472,7 +472,7 @@
}
std::unique_ptr<GrFragmentProcessor> fp;
do {
- GrClipEdgeType et = (GrClipEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
+ GrClipEdgeType et = (GrClipEdgeType)d->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
fp = GrRRectEffect::Make(et, rrect);
} while (nullptr == fp);
return fp;
@@ -584,7 +584,7 @@
fragBuilder->codeAppendf("approx_dist *= %s.x;", scaleName);
}
- if (kFillAA_GrClipEdgeType == erre.getEdgeType()) {
+ if (GrClipEdgeType::kFillAA == erre.getEdgeType()) {
fragBuilder->codeAppend("half alpha = clamp(0.5 - approx_dist, 0.0, 1.0);");
} else {
fragBuilder->codeAppend("half alpha = clamp(0.5 + approx_dist, 0.0, 1.0);");
@@ -596,8 +596,8 @@
void GLEllipticalRRectEffect::GenKey(const GrProcessor& effect, const GrShaderCaps&,
GrProcessorKeyBuilder* b) {
const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
- GR_STATIC_ASSERT(kLast_GrClipEdgeType < (1 << 3));
- b->add32(erre.getRRect().getType() | erre.getEdgeType() << 3);
+ GR_STATIC_ASSERT((int) GrClipEdgeType::kLast < (1 << 3));
+ b->add32(erre.getRRect().getType() | (int) erre.getEdgeType() << 3);
}
void GLEllipticalRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,