Remove unused color from all distance field GPs and GrAtlasTextOp
Bug: skia: Change-Id: I7f2bd68cc4f6ad65660a4415a08777bc71d34ab6 Reviewed-on: https://skia-review.googlesource.com/90522 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
b9bfb7b275
commit
09068256d6
@ -206,7 +206,6 @@ private:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(
|
||||
GrColor color,
|
||||
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params,
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
@ -215,7 +214,6 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(
|
||||
uint32_t flags,
|
||||
const SkMatrix& localMatrix)
|
||||
: INHERITED(kGrDistanceFieldA8TextGeoProc_ClassID)
|
||||
, fColor(color)
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
, fDistanceAdjust(distanceAdjust)
|
||||
#endif
|
||||
@ -285,12 +283,10 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorT
|
||||
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
|
||||
}
|
||||
SkMatrix localMatrix = GrTest::TestMatrix(d->fRandom);
|
||||
GrColor color = GrRandomColor(d->fRandom);
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float lum = d->fRandom->nextF();
|
||||
#endif
|
||||
return GrDistanceFieldA8TextGeoProc::Make(color,
|
||||
proxies,
|
||||
return GrDistanceFieldA8TextGeoProc::Make(proxies,
|
||||
samplerState,
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
lum,
|
||||
@ -494,13 +490,11 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
|
||||
GrColor color,
|
||||
const SkMatrix& matrix,
|
||||
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params,
|
||||
uint32_t flags)
|
||||
: INHERITED(kGrDistanceFieldPathGeoProc_ClassID)
|
||||
, fColor(color)
|
||||
, fMatrix(matrix)
|
||||
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
|
||||
, fInColor(nullptr) {
|
||||
@ -563,8 +557,7 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTes
|
||||
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
|
||||
}
|
||||
|
||||
return GrDistanceFieldPathGeoProc::Make(GrRandomColor(d->fRandom),
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
return GrDistanceFieldPathGeoProc::Make(GrTest::TestMatrix(d->fRandom),
|
||||
proxies,
|
||||
samplerState,
|
||||
flags);
|
||||
@ -791,14 +784,12 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
|
||||
GrColor color,
|
||||
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params,
|
||||
DistanceAdjust distanceAdjust,
|
||||
uint32_t flags,
|
||||
const SkMatrix& localMatrix)
|
||||
: INHERITED(kGrDistanceFieldLCDTextGeoProc_ClassID)
|
||||
, fColor(color)
|
||||
, fDistanceAdjust(distanceAdjust)
|
||||
, fFlags(flags & kLCD_DistanceFieldEffectMask)
|
||||
, fLocalMatrix(localMatrix) {
|
||||
@ -864,9 +855,7 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessor
|
||||
flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0;
|
||||
}
|
||||
flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0;
|
||||
GrColor color = GrRandomColor(d->fRandom);
|
||||
SkMatrix localMatrix = GrTest::TestMatrix(d->fRandom);
|
||||
return GrDistanceFieldLCDTextGeoProc::Make(color, proxies, samplerState, wa, flags,
|
||||
localMatrix);
|
||||
return GrDistanceFieldLCDTextGeoProc::Make(proxies, samplerState, wa, flags, localMatrix);
|
||||
}
|
||||
#endif
|
||||
|
@ -57,20 +57,18 @@ public:
|
||||
|
||||
/** The local matrix should be identity if local coords are not required by the GrPipeline. */
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
static sk_sp<GrGeometryProcessor> Make(GrColor color,
|
||||
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
static sk_sp<GrGeometryProcessor> Make(const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params, float lum, uint32_t flags,
|
||||
const SkMatrix& localMatrixIfUsesLocalCoords) {
|
||||
return sk_sp<GrGeometryProcessor>(new GrDistanceFieldA8TextGeoProc(
|
||||
color, proxies, params, lum, flags, localMatrixIfUsesLocalCoords));
|
||||
proxies, params, lum, flags, localMatrixIfUsesLocalCoords));
|
||||
}
|
||||
#else
|
||||
static sk_sp<GrGeometryProcessor> Make(GrColor color,
|
||||
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
static sk_sp<GrGeometryProcessor> Make(const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params, uint32_t flags,
|
||||
const SkMatrix& localMatrixIfUsesLocalCoords) {
|
||||
return sk_sp<GrGeometryProcessor>(new GrDistanceFieldA8TextGeoProc(
|
||||
color, proxies, params, flags, localMatrixIfUsesLocalCoords));
|
||||
proxies, params, flags, localMatrixIfUsesLocalCoords));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -81,7 +79,6 @@ public:
|
||||
const Attribute* inPosition() const { return fInPosition; }
|
||||
const Attribute* inColor() const { return fInColor; }
|
||||
const Attribute* inTextureCoords() const { return fInTextureCoords; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& localMatrix() const { return fLocalMatrix; }
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float getDistanceAdjust() const { return fDistanceAdjust; }
|
||||
@ -95,14 +92,13 @@ public:
|
||||
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldA8TextGeoProc(GrColor, const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
GrDistanceFieldA8TextGeoProc(const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params,
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float distanceAdjust,
|
||||
#endif
|
||||
uint32_t flags, const SkMatrix& localMatrix);
|
||||
|
||||
GrColor fColor;
|
||||
TextureSampler fTextureSamplers[kMaxTextures];
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float fDistanceAdjust;
|
||||
@ -129,11 +125,11 @@ public:
|
||||
static constexpr int kMaxTextures = 4;
|
||||
|
||||
/** The local matrix should be identity if local coords are not required by the GrPipeline. */
|
||||
static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& matrix,
|
||||
static sk_sp<GrGeometryProcessor> Make(const SkMatrix& matrix,
|
||||
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params, uint32_t flags) {
|
||||
return sk_sp<GrGeometryProcessor>(
|
||||
new GrDistanceFieldPathGeoProc(color, matrix, proxies, params, flags));
|
||||
new GrDistanceFieldPathGeoProc(matrix, proxies, params, flags));
|
||||
}
|
||||
|
||||
~GrDistanceFieldPathGeoProc() override {}
|
||||
@ -143,7 +139,6 @@ public:
|
||||
const Attribute* inPosition() const { return fInPosition; }
|
||||
const Attribute* inColor() const { return fInColor; }
|
||||
const Attribute* inTextureCoords() const { return fInTextureCoords; }
|
||||
GrColor color() const { return fColor; }
|
||||
const SkMatrix& matrix() const { return fMatrix; }
|
||||
uint32_t getFlags() const { return fFlags; }
|
||||
|
||||
@ -154,11 +149,10 @@ public:
|
||||
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& matrix,
|
||||
GrDistanceFieldPathGeoProc(const SkMatrix& matrix,
|
||||
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState&, uint32_t flags);
|
||||
|
||||
GrColor fColor;
|
||||
SkMatrix fMatrix; // view matrix if perspective, local matrix otherwise
|
||||
TextureSampler fTextureSamplers[kMaxTextures];
|
||||
uint32_t fFlags;
|
||||
@ -196,14 +190,13 @@ public:
|
||||
|
||||
static constexpr int kMaxTextures = 4;
|
||||
|
||||
static sk_sp<GrGeometryProcessor> Make(GrColor color,
|
||||
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
static sk_sp<GrGeometryProcessor> Make(const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params,
|
||||
DistanceAdjust distanceAdjust,
|
||||
uint32_t flags,
|
||||
const SkMatrix& localMatrixIfUsesLocalCoords) {
|
||||
return sk_sp<GrGeometryProcessor>(new GrDistanceFieldLCDTextGeoProc(
|
||||
color, proxies, params, distanceAdjust, flags, localMatrixIfUsesLocalCoords));
|
||||
proxies, params, distanceAdjust, flags, localMatrixIfUsesLocalCoords));
|
||||
}
|
||||
|
||||
~GrDistanceFieldLCDTextGeoProc() override {}
|
||||
@ -214,7 +207,6 @@ public:
|
||||
const Attribute* inColor() const { return fInColor; }
|
||||
const Attribute* inTextureCoords() const { return fInTextureCoords; }
|
||||
DistanceAdjust getDistanceAdjust() const { return fDistanceAdjust; }
|
||||
GrColor color() const { return fColor; }
|
||||
uint32_t getFlags() const { return fFlags; }
|
||||
const SkMatrix& localMatrix() const { return fLocalMatrix; }
|
||||
|
||||
@ -225,11 +217,10 @@ public:
|
||||
GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override;
|
||||
|
||||
private:
|
||||
GrDistanceFieldLCDTextGeoProc(GrColor, const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
GrDistanceFieldLCDTextGeoProc(const sk_sp<GrTextureProxy> proxies[kMaxTextures],
|
||||
const GrSamplerState& params, DistanceAdjust wa, uint32_t flags,
|
||||
const SkMatrix& localMatrix);
|
||||
|
||||
GrColor fColor;
|
||||
TextureSampler fTextureSamplers[kMaxTextures];
|
||||
DistanceAdjust fDistanceAdjust;
|
||||
uint32_t fFlags;
|
||||
|
@ -23,7 +23,6 @@ static const int kDistanceAdjustLumShift = 5;
|
||||
|
||||
void GrAtlasTextOp::init() {
|
||||
const Geometry& geo = fGeoData[0];
|
||||
fColor = geo.fColor;
|
||||
SkRect bounds;
|
||||
geo.fBlob->computeSubRunBounds(&bounds, geo.fRun, geo.fSubRun, geo.fViewMatrix, geo.fX, geo.fY);
|
||||
// We don't have tight bounds on the glyph paths in device space. For the purposes of bounds
|
||||
@ -79,7 +78,7 @@ GrDrawOp::RequiresDstTexture GrAtlasTextOp::finalize(const GrCaps& caps,
|
||||
if (kColorBitmapMask_MaskType == fMaskType) {
|
||||
color.setToUnknown();
|
||||
} else {
|
||||
color.setToConstant(fColor);
|
||||
color.setToConstant(this->color());
|
||||
}
|
||||
switch (fMaskType) {
|
||||
case kGrayscaleCoverageMask_MaskType:
|
||||
@ -96,9 +95,8 @@ GrDrawOp::RequiresDstTexture GrAtlasTextOp::finalize(const GrCaps& caps,
|
||||
coverage = GrProcessorAnalysisCoverage::kNone;
|
||||
break;
|
||||
}
|
||||
auto analysis = fProcessors.finalize(color, coverage, clip, false, caps, dstIsClamped, &fColor);
|
||||
// We need to update the per-geo color after analysis, too. This one is sent per-vertex.
|
||||
fGeoData[0].fColor = fColor;
|
||||
auto analysis = fProcessors.finalize(color, coverage, clip, false, caps, dstIsClamped,
|
||||
&fGeoData[0].fColor);
|
||||
fUsesLocalCoords = analysis.usesLocalCoords();
|
||||
fCanCombineOnTouchOrOverlap =
|
||||
!analysis.requiresDstTexture() &&
|
||||
@ -433,8 +431,8 @@ sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor() const {
|
||||
GrDistanceFieldLCDTextGeoProc::DistanceAdjust widthAdjust =
|
||||
GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(
|
||||
redCorrection, greenCorrection, blueCorrection);
|
||||
return GrDistanceFieldLCDTextGeoProc::Make(this->color(), p, GrSamplerState::ClampBilerp(),
|
||||
widthAdjust, fDFGPFlags, localMatrix);
|
||||
return GrDistanceFieldLCDTextGeoProc::Make(p, GrSamplerState::ClampBilerp(), widthAdjust,
|
||||
fDFGPFlags, localMatrix);
|
||||
} else {
|
||||
#ifdef SK_GAMMA_APPLY_TO_A8
|
||||
float correction = 0;
|
||||
@ -444,10 +442,10 @@ sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor() const {
|
||||
correction = fDistanceAdjustTable->getAdjustment(lum >> kDistanceAdjustLumShift,
|
||||
fUseGammaCorrectDistanceTable);
|
||||
}
|
||||
return GrDistanceFieldA8TextGeoProc::Make(this->color(), p, GrSamplerState::ClampBilerp(),
|
||||
return GrDistanceFieldA8TextGeoProc::Make(p, GrSamplerState::ClampBilerp(),
|
||||
correction, fDFGPFlags, localMatrix);
|
||||
#else
|
||||
return GrDistanceFieldA8TextGeoProc::Make(this->color(), p, GrSamplerState::ClampBilerp(),
|
||||
return GrDistanceFieldA8TextGeoProc::Make(p, GrSamplerState::ClampBilerp(),
|
||||
fDFGPFlags, localMatrix);
|
||||
#endif
|
||||
}
|
||||
|
@ -132,7 +132,6 @@ private:
|
||||
GrAtlasTextOp(GrPaint&& paint)
|
||||
: INHERITED(ClassID())
|
||||
, fGeoDataAllocSize(kMinGeometryAllocated)
|
||||
, fColor(paint.getColor())
|
||||
, fSRGBFlags(GrPipeline::SRGBFlagsFromPaint(paint))
|
||||
, fProcessors(std::move(paint)) {}
|
||||
|
||||
@ -178,7 +177,7 @@ private:
|
||||
|
||||
inline void flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const;
|
||||
|
||||
GrColor color() const { return fColor; }
|
||||
GrColor color() const { SkASSERT(fGeoCount > 0); return fGeoData[0].fColor; }
|
||||
bool usesLocalCoords() const { return fUsesLocalCoords; }
|
||||
int numGlyphs() const { return fNumGlyphs; }
|
||||
|
||||
@ -190,7 +189,6 @@ private:
|
||||
|
||||
SkAutoSTMalloc<kMinGeometryAllocated, Geometry> fGeoData;
|
||||
int fGeoDataAllocSize;
|
||||
GrColor fColor;
|
||||
uint32_t fSRGBFlags;
|
||||
GrProcessorSet fProcessors;
|
||||
bool fUsesLocalCoords;
|
||||
|
@ -249,8 +249,7 @@ private:
|
||||
matrix = &SkMatrix::I();
|
||||
}
|
||||
flushInfo.fGeometryProcessor = GrDistanceFieldPathGeoProc::Make(
|
||||
this->color(), *matrix, atlas->getProxies(),
|
||||
GrSamplerState::ClampBilerp(), flags);
|
||||
*matrix, atlas->getProxies(), GrSamplerState::ClampBilerp(), flags);
|
||||
} else {
|
||||
SkMatrix invert;
|
||||
if (fHelper.usesLocalCoords()) {
|
||||
|
Loading…
Reference in New Issue
Block a user