renamed GrPrimitiveEdgeType / GrProcessorEdgeType to GrClipEdgeType

Bug: skia:
Change-Id: I4a9af0b9b2cfa47875b2ba098098183e8dca29a7
Reviewed-on: https://skia-review.googlesource.com/69601
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2017-11-09 14:51:17 -05:00 committed by Skia Commit-Bot
parent 4a851ca334
commit 0f3c73220a
20 changed files with 169 additions and 170 deletions

View File

@ -159,9 +159,9 @@ protected:
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)},
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}
};
for(GrPrimitiveEdgeType edgeType : {kFillBW_GrProcessorEdgeType,
kFillAA_GrProcessorEdgeType,
kHairlineAA_GrProcessorEdgeType}) {
for(GrClipEdgeType edgeType : {kFillBW_GrClipEdgeType,
kFillAA_GrClipEdgeType,
kHairlineAA_GrClipEdgeType}) {
SkScalar x = col * w;
SkScalar y = row * h;
SkPoint controlPts[] = {
@ -345,7 +345,7 @@ protected:
SkScalar weight = rand.nextRangeF(0.f, 2.f);
for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) {
sk_sp<GrGeometryProcessor> gp;
GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType;
GrClipEdgeType et = (GrClipEdgeType)edgeType;
gp = GrConicEffect::Make(color, SkMatrix::I(), et,
*context->caps(), SkMatrix::I(), false);
if (!gp) {
@ -553,7 +553,7 @@ protected:
};
for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) {
sk_sp<GrGeometryProcessor> gp;
GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType;
GrClipEdgeType et = (GrClipEdgeType)edgeType;
gp = GrQuadEffect::Make(color, SkMatrix::I(), et,
*context->caps(), SkMatrix::I(), false);
if (!gp) {

View File

@ -60,13 +60,13 @@ protected:
int y = kPad;
int x = kPad;
constexpr GrPrimitiveEdgeType kEdgeTypes[] = {
kFillAA_GrProcessorEdgeType,
kInverseFillAA_GrProcessorEdgeType,
constexpr GrClipEdgeType kEdgeTypes[] = {
kFillAA_GrClipEdgeType,
kInverseFillAA_GrClipEdgeType,
};
SkRect testBounds = SkRect::MakeIWH(fTestWidth, fTestHeight);
for (size_t et = 0; et < SK_ARRAY_COUNT(kEdgeTypes); ++et) {
GrPrimitiveEdgeType edgeType = kEdgeTypes[et];
GrClipEdgeType edgeType = kEdgeTypes[et];
canvas->save();
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));

View File

@ -197,7 +197,7 @@ protected:
SkPath p;
path->transform(m, &p);
GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et;
GrClipEdgeType edgeType = (GrClipEdgeType) et;
std::unique_ptr<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, p));
if (!fp) {
continue;
@ -237,7 +237,7 @@ protected:
for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) {
SkRect rect = *iter.get();
rect.offset(x, y);
GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et;
GrClipEdgeType edgeType = (GrClipEdgeType) et;
std::unique_ptr<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, rect));
if (!fp) {
continue;

View File

@ -83,7 +83,7 @@ protected:
#endif
#if SK_SUPPORT_GPU
int lastEdgeType = (kEffect_Type == fType) ? kLast_GrProcessorEdgeType: 0;
int lastEdgeType = (kEffect_Type == fType) ? kLast_GrClipEdgeType: 0;
#else
int lastEdgeType = 0;
#endif
@ -105,7 +105,7 @@ protected:
#if SK_SUPPORT_GPU
SkRRect rrect = fRRects[curRRect];
rrect.offset(SkIntToScalar(x), SkIntToScalar(y));
GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et;
GrClipEdgeType edgeType = (GrClipEdgeType) et;
auto fp = GrRRectEffect::Make(edgeType, rrect);
if (fp) {
GrPaint grPaint;

View File

@ -649,46 +649,46 @@ enum class GrSLRestrict {
* GrProcessorEdgeType will succeed with all values and it is up to the caller to check for
* a NULL return.
*/
enum GrPrimitiveEdgeType {
kFillBW_GrProcessorEdgeType,
kFillAA_GrProcessorEdgeType,
kInverseFillBW_GrProcessorEdgeType,
kInverseFillAA_GrProcessorEdgeType,
kHairlineAA_GrProcessorEdgeType,
enum GrClipEdgeType {
kFillBW_GrClipEdgeType,
kFillAA_GrClipEdgeType,
kInverseFillBW_GrClipEdgeType,
kInverseFillAA_GrClipEdgeType,
kHairlineAA_GrClipEdgeType,
kLast_GrProcessorEdgeType = kHairlineAA_GrProcessorEdgeType
kLast_GrClipEdgeType = kHairlineAA_GrClipEdgeType
};
static const int kGrProcessorEdgeTypeCnt = kLast_GrProcessorEdgeType + 1;
static const int kGrProcessorEdgeTypeCnt = kLast_GrClipEdgeType + 1;
static inline bool GrProcessorEdgeTypeIsFill(const GrPrimitiveEdgeType edgeType) {
return (kFillAA_GrProcessorEdgeType == edgeType || kFillBW_GrProcessorEdgeType == edgeType);
static inline bool GrProcessorEdgeTypeIsFill(const GrClipEdgeType edgeType) {
return (kFillAA_GrClipEdgeType == edgeType || kFillBW_GrClipEdgeType == edgeType);
}
static inline bool GrProcessorEdgeTypeIsInverseFill(const GrPrimitiveEdgeType edgeType) {
return (kInverseFillAA_GrProcessorEdgeType == edgeType ||
kInverseFillBW_GrProcessorEdgeType == edgeType);
static inline bool GrProcessorEdgeTypeIsInverseFill(const GrClipEdgeType edgeType) {
return (kInverseFillAA_GrClipEdgeType == edgeType ||
kInverseFillBW_GrClipEdgeType == edgeType);
}
static inline bool GrProcessorEdgeTypeIsAA(const GrPrimitiveEdgeType edgeType) {
return (kFillBW_GrProcessorEdgeType != edgeType &&
kInverseFillBW_GrProcessorEdgeType != edgeType);
static inline bool GrProcessorEdgeTypeIsAA(const GrClipEdgeType edgeType) {
return (kFillBW_GrClipEdgeType != edgeType &&
kInverseFillBW_GrClipEdgeType != edgeType);
}
static inline GrPrimitiveEdgeType GrInvertProcessorEdgeType(const GrPrimitiveEdgeType edgeType) {
static inline GrClipEdgeType GrInvertProcessorEdgeType(const GrClipEdgeType edgeType) {
switch (edgeType) {
case kFillBW_GrProcessorEdgeType:
return kInverseFillBW_GrProcessorEdgeType;
case kFillAA_GrProcessorEdgeType:
return kInverseFillAA_GrProcessorEdgeType;
case kInverseFillBW_GrProcessorEdgeType:
return kFillBW_GrProcessorEdgeType;
case kInverseFillAA_GrProcessorEdgeType:
return kFillAA_GrProcessorEdgeType;
case kHairlineAA_GrProcessorEdgeType:
case kFillBW_GrClipEdgeType:
return kInverseFillBW_GrClipEdgeType;
case kFillAA_GrClipEdgeType:
return kInverseFillAA_GrClipEdgeType;
case kInverseFillBW_GrClipEdgeType:
return kFillBW_GrClipEdgeType;
case kInverseFillAA_GrClipEdgeType:
return kFillAA_GrClipEdgeType;
case kHairlineAA_GrClipEdgeType:
SK_ABORT("Hairline fill isn't invertible.");
}
return kFillAA_GrProcessorEdgeType; // suppress warning.
return kFillAA_GrClipEdgeType; // suppress warning.
}
/**

View File

@ -206,16 +206,16 @@ static bool get_analytic_clip_processor(const ElementList& elements,
return false;
}
if (!skip) {
GrPrimitiveEdgeType edgeType;
GrClipEdgeType edgeType;
if (iter.get()->isAA()) {
if (abortIfAA) {
return false;
}
edgeType =
invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_GrProcessorEdgeType;
invert ? kInverseFillAA_GrClipEdgeType : kFillAA_GrClipEdgeType;
} else {
edgeType =
invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProcessorEdgeType;
invert ? kInverseFillBW_GrClipEdgeType : kFillBW_GrClipEdgeType;
}
switch (iter.get()->getDeviceSpaceType()) {

View File

@ -1226,13 +1226,13 @@ bool GrRenderTargetContext::drawFilledDRRect(const GrClip& clip,
GrAAType aaType = this->chooseAAType(aa, GrAllowMixedSamples::kNo);
GrPrimitiveEdgeType innerEdgeType, outerEdgeType;
GrClipEdgeType innerEdgeType, outerEdgeType;
if (GrAAType::kCoverage == aaType) {
innerEdgeType = kInverseFillAA_GrProcessorEdgeType;
outerEdgeType = kFillAA_GrProcessorEdgeType;
innerEdgeType = kInverseFillAA_GrClipEdgeType;
outerEdgeType = kFillAA_GrClipEdgeType;
} else {
innerEdgeType = kInverseFillBW_GrProcessorEdgeType;
outerEdgeType = kFillBW_GrProcessorEdgeType;
innerEdgeType = kInverseFillBW_GrClipEdgeType;
outerEdgeType = kFillBW_GrClipEdgeType;
}
SkTCopyOnFirstWrite<SkRRect> inner(origInner), outer(origOuter);

View File

@ -54,7 +54,7 @@ private:
SkMatrix fViewMatrix;
GrColor fColor;
uint8_t fCoverageScale;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
UniformHandle fColorUniform;
UniformHandle fCoverageScaleUniform;
UniformHandle fViewMatrixUniform;
@ -125,7 +125,7 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
fragBuilder->declAppend(func);
switch (fEdgeType) {
case kHairlineAA_GrProcessorEdgeType: {
case kHairlineAA_GrClipEdgeType: {
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_GrProcessorEdgeType: {
case kFillAA_GrClipEdgeType: {
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_GrProcessorEdgeType: {
case kFillBW_GrClipEdgeType: {
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);",
@ -232,7 +232,7 @@ GrGLSLPrimitiveProcessor* GrConicEffect::createGLSLInstance(const GrShaderCaps&)
}
GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
GrPrimitiveEdgeType edgeType, const SkMatrix& localMatrix,
GrClipEdgeType edgeType, const SkMatrix& localMatrix,
bool usesLocalCoords)
: INHERITED(kGrConicEffect_ClassID)
, fColor(color)
@ -253,8 +253,8 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect);
sk_sp<GrGeometryProcessor> GrConicEffect::TestCreate(GrProcessorTestData* d) {
sk_sp<GrGeometryProcessor> gp;
do {
GrPrimitiveEdgeType edgeType =
static_cast<GrPrimitiveEdgeType>(
GrClipEdgeType edgeType =
static_cast<GrClipEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
gp = GrConicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
edgeType, *d->caps(), GrTest::TestMatrix(d->fRandom),
@ -307,7 +307,7 @@ private:
SkMatrix fViewMatrix;
GrColor fColor;
uint8_t fCoverageScale;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
UniformHandle fColorUniform;
UniformHandle fCoverageScaleUniform;
UniformHandle fViewMatrixUniform;
@ -358,7 +358,7 @@ void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
fragBuilder->codeAppendf("half edgeAlpha;");
switch (fEdgeType) {
case kHairlineAA_GrProcessorEdgeType: {
case kHairlineAA_GrClipEdgeType: {
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_GrProcessorEdgeType: {
case kFillAA_GrClipEdgeType: {
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_GrProcessorEdgeType: {
case kFillBW_GrClipEdgeType: {
fragBuilder->codeAppendf("edgeAlpha = (%s.x * %s.x - %s.y);",
v.fsIn(), v.fsIn(), v.fsIn());
fragBuilder->codeAppend("edgeAlpha = half(edgeAlpha < 0.0);");
@ -434,7 +434,7 @@ GrGLSLPrimitiveProcessor* GrQuadEffect::createGLSLInstance(const GrShaderCaps&)
}
GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
GrPrimitiveEdgeType edgeType, const SkMatrix& localMatrix,
GrClipEdgeType edgeType, const SkMatrix& localMatrix,
bool usesLocalCoords)
: INHERITED(kGrQuadEffect_ClassID)
, fColor(color)
@ -455,7 +455,7 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect);
sk_sp<GrGeometryProcessor> GrQuadEffect::TestCreate(GrProcessorTestData* d) {
sk_sp<GrGeometryProcessor> gp;
do {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
GrClipEdgeType edgeType = static_cast<GrClipEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
gp = GrQuadEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), edgeType,
*d->caps(), GrTest::TestMatrix(d->fRandom),
@ -511,7 +511,7 @@ private:
SkMatrix fViewMatrix;
SkMatrix fDevKLMMatrix;
GrColor fColor;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
UniformHandle fColorUniform;
UniformHandle fViewMatrixUniform;
UniformHandle fDevKLMUniform;
@ -561,7 +561,7 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
GrGLSLVertToFrag gradCoeffs(kFloat4_GrSLType);
if (kFillAA_GrProcessorEdgeType == fEdgeType || kHairlineAA_GrProcessorEdgeType == fEdgeType) {
if (kFillAA_GrClipEdgeType == fEdgeType || kHairlineAA_GrClipEdgeType == 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_GrProcessorEdgeType: {
case kHairlineAA_GrClipEdgeType: {
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_GrProcessorEdgeType: {
case kFillAA_GrClipEdgeType: {
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_GrProcessorEdgeType: {
case kFillBW_GrClipEdgeType: {
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());
@ -662,7 +662,7 @@ GrGLSLPrimitiveProcessor* GrCubicEffect::createGLSLInstance(const GrShaderCaps&)
}
GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, const SkMatrix&
devKLMMatrix, GrPrimitiveEdgeType edgeType)
devKLMMatrix, GrClipEdgeType edgeType)
: INHERITED(kGrCubicEffect_ClassID)
, fColor(color)
, fViewMatrix(viewMatrix)
@ -679,8 +679,8 @@ GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect);
sk_sp<GrGeometryProcessor> GrCubicEffect::TestCreate(GrProcessorTestData* d) {
sk_sp<GrGeometryProcessor> gp;
do {
GrPrimitiveEdgeType edgeType =
static_cast<GrPrimitiveEdgeType>(
GrClipEdgeType edgeType =
static_cast<GrClipEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
gp = GrCubicEffect::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom),
GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool(), edgeType,

View File

@ -59,30 +59,30 @@ class GrConicEffect : public GrGeometryProcessor {
public:
static sk_sp<GrGeometryProcessor> Make(GrColor color,
const SkMatrix& viewMatrix,
const GrPrimitiveEdgeType edgeType,
const GrClipEdgeType edgeType,
const GrCaps& caps,
const SkMatrix& localMatrix,
bool usesLocalCoords,
uint8_t coverage = 0xff) {
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
case kFillAA_GrClipEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return nullptr;
}
return sk_sp<GrGeometryProcessor>(
new GrConicEffect(color, viewMatrix, coverage, kFillAA_GrProcessorEdgeType,
new GrConicEffect(color, viewMatrix, coverage, kFillAA_GrClipEdgeType,
localMatrix, usesLocalCoords));
case kHairlineAA_GrProcessorEdgeType:
case kHairlineAA_GrClipEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return nullptr;
}
return sk_sp<GrGeometryProcessor>(
new GrConicEffect(color, viewMatrix, coverage,
kHairlineAA_GrProcessorEdgeType, localMatrix,
kHairlineAA_GrClipEdgeType, localMatrix,
usesLocalCoords));
case kFillBW_GrProcessorEdgeType:
case kFillBW_GrClipEdgeType:
return sk_sp<GrGeometryProcessor>(
new GrConicEffect(color, viewMatrix, coverage, kFillBW_GrProcessorEdgeType,
new GrConicEffect(color, viewMatrix, coverage, kFillBW_GrClipEdgeType,
localMatrix, usesLocalCoords));
default:
return nullptr;
@ -97,7 +97,7 @@ public:
inline const Attribute* inConicCoeffs() const { return fInConicCoeffs; }
inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); }
inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
inline GrClipEdgeType getEdgeType() const { return fEdgeType; }
GrColor color() const { return fColor; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
const SkMatrix& localMatrix() const { return fLocalMatrix; }
@ -109,7 +109,7 @@ public:
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
private:
GrConicEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType,
GrConicEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrClipEdgeType,
const SkMatrix& localMatrix, bool usesLocalCoords);
GrColor fColor;
@ -117,7 +117,7 @@ private:
SkMatrix fLocalMatrix;
bool fUsesLocalCoords;
uint8_t fCoverageScale;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
const Attribute* fInPosition;
const Attribute* fInConicCoeffs;
@ -141,30 +141,30 @@ class GrQuadEffect : public GrGeometryProcessor {
public:
static sk_sp<GrGeometryProcessor> Make(GrColor color,
const SkMatrix& viewMatrix,
const GrPrimitiveEdgeType edgeType,
const GrClipEdgeType edgeType,
const GrCaps& caps,
const SkMatrix& localMatrix,
bool usesLocalCoords,
uint8_t coverage = 0xff) {
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
case kFillAA_GrClipEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return nullptr;
}
return sk_sp<GrGeometryProcessor>(
new GrQuadEffect(color, viewMatrix, coverage, kFillAA_GrProcessorEdgeType,
new GrQuadEffect(color, viewMatrix, coverage, kFillAA_GrClipEdgeType,
localMatrix, usesLocalCoords));
case kHairlineAA_GrProcessorEdgeType:
case kHairlineAA_GrClipEdgeType:
if (!caps.shaderCaps()->shaderDerivativeSupport()) {
return nullptr;
}
return sk_sp<GrGeometryProcessor>(
new GrQuadEffect(color, viewMatrix, coverage,
kHairlineAA_GrProcessorEdgeType, localMatrix,
kHairlineAA_GrClipEdgeType, localMatrix,
usesLocalCoords));
case kFillBW_GrProcessorEdgeType:
case kFillBW_GrClipEdgeType:
return sk_sp<GrGeometryProcessor>(
new GrQuadEffect(color, viewMatrix, coverage, kFillBW_GrProcessorEdgeType,
new GrQuadEffect(color, viewMatrix, coverage, kFillBW_GrClipEdgeType,
localMatrix, usesLocalCoords));
default:
return nullptr;
@ -179,7 +179,7 @@ public:
inline const Attribute* inHairQuadEdge() const { return fInHairQuadEdge; }
inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); }
inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
inline GrClipEdgeType getEdgeType() const { return fEdgeType; }
GrColor color() const { return fColor; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
const SkMatrix& localMatrix() const { return fLocalMatrix; }
@ -191,7 +191,7 @@ public:
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
private:
GrQuadEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType,
GrQuadEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrClipEdgeType,
const SkMatrix& localMatrix, bool usesLocalCoords);
GrColor fColor;
@ -199,7 +199,7 @@ private:
SkMatrix fLocalMatrix;
bool fUsesLocalCoords;
uint8_t fCoverageScale;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
const Attribute* fInPosition;
const Attribute* fInHairQuadEdge;
@ -227,7 +227,7 @@ public:
const SkMatrix& viewMatrix,
const SkMatrix& klm,
bool flipKL,
const GrPrimitiveEdgeType edgeType,
const GrClipEdgeType edgeType,
const GrCaps& caps) {
// Map KLM to something that operates in device space.
SkMatrix devKLM;
@ -240,15 +240,15 @@ public:
}
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
case kFillAA_GrClipEdgeType:
return sk_sp<GrGeometryProcessor>(
new GrCubicEffect(color, viewMatrix, devKLM, kFillAA_GrProcessorEdgeType));
case kHairlineAA_GrProcessorEdgeType:
new GrCubicEffect(color, viewMatrix, devKLM, kFillAA_GrClipEdgeType));
case kHairlineAA_GrClipEdgeType:
return sk_sp<GrGeometryProcessor>(
new GrCubicEffect(color, viewMatrix, devKLM, kHairlineAA_GrProcessorEdgeType));
case kFillBW_GrProcessorEdgeType:
new GrCubicEffect(color, viewMatrix, devKLM, kHairlineAA_GrClipEdgeType));
case kFillBW_GrClipEdgeType:
return sk_sp<GrGeometryProcessor>(
new GrCubicEffect(color, viewMatrix, devKLM, kFillBW_GrProcessorEdgeType));
new GrCubicEffect(color, viewMatrix, devKLM, kFillBW_GrClipEdgeType));
default:
return nullptr;
}
@ -261,7 +261,7 @@ public:
inline const Attribute* inPosition() const { return fInPosition; }
inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); }
inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
inline GrClipEdgeType getEdgeType() const { return fEdgeType; }
GrColor color() const { return fColor; }
bool colorIgnored() const { return GrColor_ILLEGAL == fColor; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
@ -273,12 +273,12 @@ public:
private:
GrCubicEffect(GrColor, const SkMatrix& viewMatrix, const SkMatrix& devKLMMatrix,
GrPrimitiveEdgeType);
GrClipEdgeType);
GrColor fColor;
SkMatrix fViewMatrix;
SkMatrix fDevKLMMatrix;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
const Attribute* fInPosition;
GR_DECLARE_GEOMETRY_PROCESSOR_TEST

View File

@ -64,7 +64,7 @@ private:
if (radius != prevRadius || center != prevCenter) {
SkScalar effectiveRadius = radius;
if (GrProcessorEdgeTypeIsInverseFill((GrPrimitiveEdgeType)edgeType)) {
if (GrProcessorEdgeTypeIsInverseFill((GrClipEdgeType)edgeType)) {
effectiveRadius -= 0.5f;
} else {
effectiveRadius += 0.5f;
@ -109,10 +109,10 @@ std::unique_ptr<GrFragmentProcessor> GrCircleEffect::TestCreate(GrProcessorTestD
center.fX = testData->fRandom->nextRangeScalar(0.f, 1000.f);
center.fY = testData->fRandom->nextRangeScalar(0.f, 1000.f);
SkScalar radius = testData->fRandom->nextRangeF(0.f, 1000.f);
GrPrimitiveEdgeType et;
GrClipEdgeType et;
do {
et = (GrPrimitiveEdgeType)testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
} while (kHairlineAA_GrProcessorEdgeType == et);
et = (GrClipEdgeType)testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
} while (kHairlineAA_GrClipEdgeType == et);
return GrCircleEffect::Make(et, center, radius);
}
#endif

View File

@ -20,7 +20,7 @@ uniform half4 circle;
@setData(pdman) {
if (radius != prevRadius || center != prevCenter) {
SkScalar effectiveRadius = radius;
if (GrProcessorEdgeTypeIsInverseFill((GrPrimitiveEdgeType) edgeType)) {
if (GrProcessorEdgeTypeIsInverseFill((GrClipEdgeType) edgeType)) {
effectiveRadius -= 0.5f;
} else {
effectiveRadius += 0.5f;
@ -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_GrProcessorEdgeType */ ||
edgeType == 3 /* kInverseFillAA_GrProcessorEdgeType */) {
@if (edgeType == 2 /* kInverseFillBW_GrClipEdgeType */ ||
edgeType == 3 /* kInverseFillAA_GrClipEdgeType */) {
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_GrProcessorEdgeType */ ||
edgeType == 3 /* kInverseFillAA_GrProcessorEdgeType */ ||
edgeType == 4 /* kHairlineAA_GrProcessorEdgeType */) {
@if (edgeType == 1 /* kFillAA_GrClipEdgeType */ ||
edgeType == 3 /* kInverseFillAA_GrClipEdgeType */ ||
edgeType == 4 /* kHairlineAA_GrClipEdgeType */) {
d = clamp(d, 0.0, 1.0);
} else {
d = d > 0.5 ? 1.0 : 0.0;
@ -59,9 +59,9 @@ void main() {
center.fX = testData->fRandom->nextRangeScalar(0.f, 1000.f);
center.fY = testData->fRandom->nextRangeScalar(0.f, 1000.f);
SkScalar radius = testData->fRandom->nextRangeF(0.f, 1000.f);
GrPrimitiveEdgeType et;
GrClipEdgeType et;
do {
et = (GrPrimitiveEdgeType) testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
} while (kHairlineAA_GrProcessorEdgeType == et);
et = (GrClipEdgeType) testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
} while (kHairlineAA_GrClipEdgeType == et);
return GrCircleEffect::Make(et, center, radius);
}

View File

@ -19,12 +19,12 @@ class AARectEffect : public GrFragmentProcessor {
public:
const SkRect& getRect() const { return fRect; }
static std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType edgeType,
static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType edgeType,
const SkRect& rect) {
return std::unique_ptr<GrFragmentProcessor>(new AARectEffect(edgeType, rect));
}
GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
GrClipEdgeType getEdgeType() const { return fEdgeType; }
const char* name() const override { return "AARect"; }
@ -33,7 +33,7 @@ public:
private:
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect)
AARectEffect(GrClipEdgeType edgeType, const SkRect& rect)
: INHERITED(kAARectEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRect(rect)
, fEdgeType(edgeType) {
@ -47,7 +47,7 @@ private:
}
SkRect fRect;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
typedef GrFragmentProcessor INHERITED;
@ -65,7 +65,7 @@ std::unique_ptr<GrFragmentProcessor> AARectEffect::TestCreate(GrProcessorTestDat
d->fRandom->nextSScalar1());
std::unique_ptr<GrFragmentProcessor> fp;
do {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
GrClipEdgeType edgeType = static_cast<GrClipEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
fp = AARectEffect::Make(edgeType, rect);
@ -234,9 +234,9 @@ void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrShaderCa
//////////////////////////////////////////////////////////////////////////////
std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrPrimitiveEdgeType type,
std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrClipEdgeType type,
const SkPath& path) {
if (kHairlineAA_GrProcessorEdgeType == type) {
if (kHairlineAA_GrClipEdgeType == type) {
return nullptr;
}
if (path.getSegmentMasks() != SkPath::kLine_SegmentMask ||
@ -305,9 +305,9 @@ std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrPrimitiveEdgeTyp
return Make(type, n, edges);
}
std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrPrimitiveEdgeType edgeType,
std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrClipEdgeType edgeType,
const SkRect& rect) {
if (kHairlineAA_GrProcessorEdgeType == edgeType){
if (kHairlineAA_GrClipEdgeType == edgeType){
return nullptr;
}
return AARectEffect::Make(edgeType, rect);
@ -324,7 +324,7 @@ GrGLSLFragmentProcessor* GrConvexPolyEffect::onCreateGLSLInstance() const {
return new GrGLConvexPolyEffect;
}
GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, const SkScalar edges[])
GrConvexPolyEffect::GrConvexPolyEffect(GrClipEdgeType edgeType, int n, const SkScalar edges[])
: INHERITED(kGrConvexPolyEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fEdgeType(edgeType)
, fEdgeCount(n) {
@ -370,7 +370,7 @@ std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::TestCreate(GrProcessorT
std::unique_ptr<GrFragmentProcessor> fp;
do {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
GrClipEdgeType edgeType = static_cast<GrClipEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
fp = GrConvexPolyEffect::Make(edgeType, count, edges);
} while (nullptr == fp);

View File

@ -38,9 +38,9 @@ public:
* have to modify the effect/shaderbuilder interface to make it possible (e.g. give access
* to the view matrix or untransformed positions in the fragment shader).
*/
static std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType edgeType, int n,
static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType edgeType, int n,
const SkScalar edges[]) {
if (n <= 0 || n > kMaxEdges || kHairlineAA_GrProcessorEdgeType == edgeType) {
if (n <= 0 || n > kMaxEdges || kHairlineAA_GrClipEdgeType == edgeType) {
return nullptr;
}
return std::unique_ptr<GrFragmentProcessor>(new GrConvexPolyEffect(edgeType, n, edges));
@ -50,12 +50,12 @@ public:
* Creates an effect that clips against the path. If the path is not a convex polygon, is
* inverse filled, or has too many edges, this will return nullptr.
*/
static std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType, const SkPath&);
static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType, const SkPath&);
/**
* Creates an effect that fills inside the rect with AA edges..
*/
static std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType, const SkRect&);
static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType, const SkRect&);
~GrConvexPolyEffect() override;
@ -63,14 +63,14 @@ public:
std::unique_ptr<GrFragmentProcessor> clone() const override;
GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
GrClipEdgeType getEdgeType() const { return fEdgeType; }
int getEdgeCount() const { return fEdgeCount; }
const SkScalar* getEdges() const { return fEdges; }
private:
GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, const SkScalar edges[]);
GrConvexPolyEffect(GrClipEdgeType edgeType, int n, const SkScalar edges[]);
GrConvexPolyEffect(const GrConvexPolyEffect&);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@ -79,9 +79,9 @@ private:
bool onIsEqual(const GrFragmentProcessor& other) const override;
GrPrimitiveEdgeType fEdgeType;
int fEdgeCount;
SkScalar fEdges[3 * kMaxEdges];
GrClipEdgeType fEdgeType;
int fEdgeCount;
SkScalar fEdges[3 * kMaxEdges];
GR_DECLARE_FRAGMENT_PROCESSOR_TEST

View File

@ -136,10 +136,10 @@ std::unique_ptr<GrFragmentProcessor> GrEllipseEffect::TestCreate(GrProcessorTest
center.fY = testData->fRandom->nextRangeScalar(0.f, 1000.f);
SkScalar rx = testData->fRandom->nextRangeF(0.f, 1000.f);
SkScalar ry = testData->fRandom->nextRangeF(0.f, 1000.f);
GrPrimitiveEdgeType et;
GrClipEdgeType et;
do {
et = (GrPrimitiveEdgeType)testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
} while (kHairlineAA_GrProcessorEdgeType == et);
et = (GrClipEdgeType)testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
} while (kHairlineAA_GrClipEdgeType == et);
return GrEllipseEffect::Make(et, center, SkPoint::Make(rx, ry));
}
#endif

View File

@ -72,16 +72,16 @@ void main() {
half alpha;
@switch (edgeType) {
case 0 /* kFillBW_GrProcessorEdgeType */:
case 0 /* kFillBW_GrClipEdgeType */:
alpha = approx_dist > 0.0 ? 0.0 : 1.0;
break;
case 1 /* kFillAA_GrProcessorEdgeType */:
case 1 /* kFillAA_GrClipEdgeType */:
alpha = clamp(0.5 - approx_dist, 0.0, 1.0);
break;
case 2 /* kInverseFillBW_GrProcessorEdgeType */:
case 2 /* kInverseFillBW_GrClipEdgeType */:
alpha = approx_dist > 0.0 ? 1.0 : 0.0;
break;
case 3 /* kInverseFillAA_GrProcessorEdgeType */:
case 3 /* kInverseFillAA_GrClipEdgeType */:
alpha = clamp(0.5 + approx_dist, 0.0, 1.0);
break;
default:
@ -97,9 +97,9 @@ void main() {
center.fY = testData->fRandom->nextRangeScalar(0.f, 1000.f);
SkScalar rx = testData->fRandom->nextRangeF(0.f, 1000.f);
SkScalar ry = testData->fRandom->nextRangeF(0.f, 1000.f);
GrPrimitiveEdgeType et;
GrClipEdgeType et;
do {
et = (GrPrimitiveEdgeType) testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
} while (kHairlineAA_GrProcessorEdgeType == et);
et = (GrClipEdgeType) testData->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
} while (kHairlineAA_GrClipEdgeType == et);
return GrEllipseEffect::Make(et, center, SkPoint::Make(rx, ry));
}

View File

@ -11,9 +11,9 @@
#include "GrEllipseEffect.h"
#include "SkRect.h"
std::unique_ptr<GrFragmentProcessor> GrOvalEffect::Make(GrPrimitiveEdgeType edgeType,
std::unique_ptr<GrFragmentProcessor> GrOvalEffect::Make(GrClipEdgeType edgeType,
const SkRect& oval) {
if (kHairlineAA_GrProcessorEdgeType == edgeType) {
if (kHairlineAA_GrClipEdgeType == edgeType) {
return nullptr;
}
SkScalar w = oval.width();

View File

@ -20,7 +20,7 @@ namespace GrOvalEffect {
/**
* Creates an effect that performs clipping against an oval.
*/
std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType, const SkRect&);
std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType, const SkRect&);
};

View File

@ -45,7 +45,7 @@ public:
// The flags are used to indicate which corners are circluar (unflagged corners are assumed to
// be square).
static std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType,
static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType,
uint32_t circularCornerFlags, const SkRRect&);
~CircularRRectEffect() override {}
@ -58,10 +58,10 @@ public:
uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; }
GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
GrClipEdgeType getEdgeType() const { return fEdgeType; }
private:
CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const SkRRect&);
CircularRRectEffect(GrClipEdgeType, uint32_t circularCornerFlags, const SkRRect&);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@ -70,7 +70,7 @@ private:
bool onIsEqual(const GrFragmentProcessor& other) const override;
SkRRect fRRect;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
uint32_t fCircularCornerFlags;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
@ -78,17 +78,17 @@ private:
typedef GrFragmentProcessor INHERITED;
};
std::unique_ptr<GrFragmentProcessor> CircularRRectEffect::Make(GrPrimitiveEdgeType edgeType,
std::unique_ptr<GrFragmentProcessor> CircularRRectEffect::Make(GrClipEdgeType edgeType,
uint32_t circularCornerFlags,
const SkRRect& rrect) {
if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
if (kFillAA_GrClipEdgeType != edgeType && kInverseFillAA_GrClipEdgeType != edgeType) {
return nullptr;
}
return std::unique_ptr<GrFragmentProcessor>(
new CircularRRectEffect(edgeType, circularCornerFlags, rrect));
}
CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t circularCornerFlags,
CircularRRectEffect::CircularRRectEffect(GrClipEdgeType edgeType, uint32_t circularCornerFlags,
const SkRRect& rrect)
: INHERITED(kCircularRRectEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRRect(rrect)
@ -120,8 +120,8 @@ std::unique_ptr<GrFragmentProcessor> CircularRRectEffect::TestCreate(GrProcessor
rrect.setRectXY(SkRect::MakeWH(w, h), r, r);
std::unique_ptr<GrFragmentProcessor> fp;
do {
GrPrimitiveEdgeType et =
(GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
GrClipEdgeType et =
(GrClipEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
fp = GrRRectEffect::Make(et, rrect);
} while (nullptr == fp);
return fp;
@ -277,7 +277,7 @@ void GLCircularRRectEffect::emitCode(EmitArgs& args) {
break;
}
if (kInverseFillAA_GrProcessorEdgeType == crre.getEdgeType()) {
if (kInverseFillAA_GrClipEdgeType == crre.getEdgeType()) {
fragBuilder->codeAppend("alpha = 1.0 - alpha;");
}
@ -386,7 +386,7 @@ GrGLSLFragmentProcessor* CircularRRectEffect::onCreateGLSLInstance() const {
class EllipticalRRectEffect : public GrFragmentProcessor {
public:
static std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType, const SkRRect&);
static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType, const SkRRect&);
~EllipticalRRectEffect() override {}
@ -396,10 +396,10 @@ public:
const SkRRect& getRRect() const { return fRRect; }
GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
GrClipEdgeType getEdgeType() const { return fEdgeType; }
private:
EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&);
EllipticalRRectEffect(GrClipEdgeType, const SkRRect&);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@ -408,22 +408,22 @@ private:
bool onIsEqual(const GrFragmentProcessor& other) const override;
SkRRect fRRect;
GrPrimitiveEdgeType fEdgeType;
GrClipEdgeType fEdgeType;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
typedef GrFragmentProcessor INHERITED;
};
std::unique_ptr<GrFragmentProcessor> EllipticalRRectEffect::Make(GrPrimitiveEdgeType edgeType,
std::unique_ptr<GrFragmentProcessor> EllipticalRRectEffect::Make(GrClipEdgeType edgeType,
const SkRRect& rrect) {
if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
if (kFillAA_GrClipEdgeType != edgeType && kInverseFillAA_GrClipEdgeType != edgeType) {
return nullptr;
}
return std::unique_ptr<GrFragmentProcessor>(new EllipticalRRectEffect(edgeType, rrect));
}
EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const SkRRect& rrect)
EllipticalRRectEffect::EllipticalRRectEffect(GrClipEdgeType edgeType, const SkRRect& rrect)
: INHERITED(kEllipticalRRectEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRRect(rrect)
, fEdgeType(edgeType) {
@ -472,8 +472,7 @@ std::unique_ptr<GrFragmentProcessor> EllipticalRRectEffect::TestCreate(GrProcess
}
std::unique_ptr<GrFragmentProcessor> fp;
do {
GrPrimitiveEdgeType et =
(GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
GrClipEdgeType et = (GrClipEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
fp = GrRRectEffect::Make(et, rrect);
} while (nullptr == fp);
return fp;
@ -585,7 +584,7 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppendf("approx_dist *= %s.x;", scaleName);
}
if (kFillAA_GrProcessorEdgeType == erre.getEdgeType()) {
if (kFillAA_GrClipEdgeType == 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);");
@ -597,7 +596,7 @@ 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_GrProcessorEdgeType < (1 << 3));
GR_STATIC_ASSERT(kLast_GrClipEdgeType < (1 << 3));
b->add32(erre.getRRect().getType() | erre.getEdgeType() << 3);
}
@ -673,7 +672,7 @@ GrGLSLFragmentProcessor* EllipticalRRectEffect::onCreateGLSLInstance() const {
//////////////////////////////////////////////////////////////////////////////
std::unique_ptr<GrFragmentProcessor> GrRRectEffect::Make(GrPrimitiveEdgeType edgeType,
std::unique_ptr<GrFragmentProcessor> GrRRectEffect::Make(GrClipEdgeType edgeType,
const SkRRect& rrect) {
if (rrect.isRect()) {
return GrConvexPolyEffect::Make(edgeType, rrect.getBounds());

View File

@ -22,7 +22,7 @@ namespace GrRRectEffect {
* Creates an effect that performs anti-aliased clipping against a SkRRect. It doesn't support
* all varieties of SkRRect so the caller must check for a nullptr return.
*/
std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType, const SkRRect&);
std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType, const SkRRect&);
};

View File

@ -978,7 +978,7 @@ void AAHairlineOp::onPrepareDraws(Target* target) {
if (quadCount || conicCount) {
sk_sp<GrGeometryProcessor> quadGP(GrQuadEffect::Make(this->color(),
*geometryProcessorViewM,
kHairlineAA_GrProcessorEdgeType,
kHairlineAA_GrClipEdgeType,
target->caps(),
*geometryProcessorLocalM,
fHelper.usesLocalCoords(),
@ -986,7 +986,7 @@ void AAHairlineOp::onPrepareDraws(Target* target) {
sk_sp<GrGeometryProcessor> conicGP(GrConicEffect::Make(this->color(),
*geometryProcessorViewM,
kHairlineAA_GrProcessorEdgeType,
kHairlineAA_GrClipEdgeType,
target->caps(),
*geometryProcessorLocalM,
fHelper.usesLocalCoords(),