diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-11-10 11:58:19 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-10 17:42:27 +0000 |
commit | 1706f842086c089ebc496dfc7f45c959e5eda01e (patch) | |
tree | 3221e9f852ec68f995e5668d3ef613ce11f84e5d /src/gpu | |
parent | 5e9dfdbf4209fd6b41b1bc52190dabb32ae77e51 (diff) |
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>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrClipStackClip.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 8 | ||||
-rw-r--r-- | src/gpu/effects/GrBezierEffect.cpp | 26 | ||||
-rw-r--r-- | src/gpu/effects/GrBezierEffect.h | 36 | ||||
-rw-r--r-- | src/gpu/effects/GrCircleEffect.cpp | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrCircleEffect.fp | 16 | ||||
-rw-r--r-- | src/gpu/effects/GrConvexPolyEffect.cpp | 14 | ||||
-rw-r--r-- | src/gpu/effects/GrConvexPolyEffect.h | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrEllipseEffect.cpp | 6 | ||||
-rw-r--r-- | src/gpu/effects/GrEllipseEffect.fp | 14 | ||||
-rw-r--r-- | src/gpu/effects/GrOvalEffect.cpp | 7 | ||||
-rw-r--r-- | src/gpu/effects/GrRRectEffect.cpp | 20 | ||||
-rw-r--r-- | src/gpu/ops/GrAAHairLinePathRenderer.cpp | 4 |
13 files changed, 82 insertions, 81 deletions
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index 99acc533c7..c0fe10678b 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -212,10 +212,10 @@ static bool get_analytic_clip_processor(const ElementList& elements, return false; } edgeType = - invert ? kInverseFillAA_GrClipEdgeType : kFillAA_GrClipEdgeType; + invert ? GrClipEdgeType::kInverseFillAA : GrClipEdgeType::kFillAA; } else { edgeType = - invert ? kInverseFillBW_GrClipEdgeType : kFillBW_GrClipEdgeType; + invert ? GrClipEdgeType::kInverseFillBW : GrClipEdgeType::kFillBW; } switch (iter.get()->getDeviceSpaceType()) { diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index ecb325af27..141b45a530 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -1228,11 +1228,11 @@ bool GrRenderTargetContext::drawFilledDRRect(const GrClip& clip, GrClipEdgeType innerEdgeType, outerEdgeType; if (GrAAType::kCoverage == aaType) { - innerEdgeType = kInverseFillAA_GrClipEdgeType; - outerEdgeType = kFillAA_GrClipEdgeType; + innerEdgeType = GrClipEdgeType::kInverseFillAA; + outerEdgeType = GrClipEdgeType::kFillAA; } else { - innerEdgeType = kInverseFillBW_GrClipEdgeType; - outerEdgeType = kFillBW_GrClipEdgeType; + innerEdgeType = GrClipEdgeType::kInverseFillBW; + outerEdgeType = GrClipEdgeType::kFillBW; } SkTCopyOnFirstWrite<SkRRect> inner(origInner), outer(origOuter); diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index 86469b2856..ffd7b0657f 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -125,7 +125,7 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { 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 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // 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 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // 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 @@ sk_sp<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) { 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 @@ void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { 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 @@ void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // 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 @@ void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // 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> GrQuadEffect::TestCreate(GrProcessorTestData* d) { 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 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { 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 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { 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 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // 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 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // 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 @@ sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) { 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 3aac8870bc..267259e634 100644 --- a/src/gpu/effects/GrBezierEffect.h +++ b/src/gpu/effects/GrBezierEffect.h @@ -65,24 +65,24 @@ public: 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 @@ public: 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 @@ public: } 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 0c998d5ff9..eccf8bf251 100644 --- a/src/gpu/effects/GrCircleEffect.cpp +++ b/src/gpu/effects/GrCircleEffect.cpp @@ -111,9 +111,9 @@ std::unique_ptr<GrFragmentProcessor> GrCircleEffect::TestCreate(GrProcessorTestD 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 04edc5d4d1..95cbeb05fd 100644 --- a/src/gpu/effects/GrCircleEffect.fp +++ b/src/gpu/effects/GrCircleEffect.fp @@ -37,15 +37,15 @@ void main() { // 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 @@ void main() { 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 4da2898ec6..d3954fcef2 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -66,7 +66,7 @@ std::unique_ptr<GrFragmentProcessor> AARectEffect::TestCreate(GrProcessorTestDat 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::onSetData(const GrGLSLProgramDataManager& pdman, 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::onSetData(const GrGLSLProgramDataManager& pdman, 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 @@ void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrShaderCa 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 typ 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> GrConvexPolyEffect::TestCreate(GrProcessorT 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 6202d6056c..d2ab4c94c7 100644 --- a/src/gpu/effects/GrConvexPolyEffect.h +++ b/src/gpu/effects/GrConvexPolyEffect.h @@ -40,7 +40,7 @@ public: */ 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 9556a63f6c..20afa936ec 100644 --- a/src/gpu/effects/GrEllipseEffect.cpp +++ b/src/gpu/effects/GrEllipseEffect.cpp @@ -138,9 +138,9 @@ std::unique_ptr<GrFragmentProcessor> GrEllipseEffect::TestCreate(GrProcessorTest 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 8effaeb561..f3feae17ef 100644 --- a/src/gpu/effects/GrEllipseEffect.fp +++ b/src/gpu/effects/GrEllipseEffect.fp @@ -72,16 +72,16 @@ void main() { 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 @@ void main() { 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 ed90a7bd17..60ea9df26c 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 1247c2f17c..4b56443b0d 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -81,7 +81,7 @@ private: 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> CircularRRectEffect::TestCreate(GrProcessor 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 @@ void GLCircularRRectEffect::emitCode(EmitArgs& args) { break; } - if (kInverseFillAA_GrClipEdgeType == crre.getEdgeType()) { + if (GrClipEdgeType::kInverseFillAA == crre.getEdgeType()) { fragBuilder->codeAppend("alpha = 1.0 - alpha;"); } @@ -287,8 +287,8 @@ void GLCircularRRectEffect::emitCode(EmitArgs& args) { 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 @@ private: 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> EllipticalRRectEffect::TestCreate(GrProcess } 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 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) { 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::emitCode(EmitArgs& args) { 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, diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp index 038272062e..2dcee7a4c5 100644 --- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp +++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp @@ -978,7 +978,7 @@ void AAHairlineOp::onPrepareDraws(Target* target) { if (quadCount || conicCount) { sk_sp<GrGeometryProcessor> quadGP(GrQuadEffect::Make(this->color(), *geometryProcessorViewM, - kHairlineAA_GrClipEdgeType, + GrClipEdgeType::kHairlineAA, target->caps(), *geometryProcessorLocalM, fHelper.usesLocalCoords(), @@ -986,7 +986,7 @@ void AAHairlineOp::onPrepareDraws(Target* target) { sk_sp<GrGeometryProcessor> conicGP(GrConicEffect::Make(this->color(), *geometryProcessorViewM, - kHairlineAA_GrClipEdgeType, + GrClipEdgeType::kHairlineAA, target->caps(), *geometryProcessorLocalM, fHelper.usesLocalCoords(), |