sk_sp for Ganesh.
Convert use of GrFragmentProcessor, GrGeometryProcessor, and
GrXPFactory to sk_sp. This clarifies ownership and should
reduce reference count churn by moving ownership.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2041113004
Review-Url: https://codereview.chromium.org/2041113004
diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp
index 32a64c3..3c4b4a5 100644
--- a/src/gpu/batches/GrAtlasTextBatch.cpp
+++ b/src/gpu/batches/GrAtlasTextBatch.cpp
@@ -100,17 +100,16 @@
FlushInfo flushInfo;
if (this->usesDistanceFields()) {
- flushInfo.fGeometryProcessor.reset(
- this->setupDfProcessor(this->viewMatrix(), fFilteredColor, this->color(), texture));
+ flushInfo.fGeometryProcessor =
+ this->setupDfProcessor(this->viewMatrix(), fFilteredColor, this->color(), texture);
} else {
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
- flushInfo.fGeometryProcessor.reset(
- GrBitmapTextGeoProc::Create(this->color(),
- texture,
- params,
- maskFormat,
- localMatrix,
- this->usesLocalCoords()));
+ flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(this->color(),
+ texture,
+ params,
+ maskFormat,
+ localMatrix,
+ this->usesLocalCoords());
}
flushInfo.fGlyphsToFlush = 0;
@@ -178,7 +177,7 @@
flushInfo->fIndexBuffer, flushInfo->fVertexOffset,
kVerticesPerGlyph, kIndicesPerGlyph, flushInfo->fGlyphsToFlush,
maxGlyphsPerDraw);
- target->draw(flushInfo->fGeometryProcessor, mesh);
+ target->draw(flushInfo->fGeometryProcessor.get(), mesh);
flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlush;
flushInfo->fGlyphsToFlush = 0;
}
@@ -246,9 +245,10 @@
// TODO just use class params
// TODO trying to figure out why lcd is so whack
-GrGeometryProcessor* GrAtlasTextBatch::setupDfProcessor(const SkMatrix& viewMatrix,
- SkColor filteredColor,
- GrColor color, GrTexture* texture) const {
+sk_sp<GrGeometryProcessor> GrAtlasTextBatch::setupDfProcessor(const SkMatrix& viewMatrix,
+ SkColor filteredColor,
+ GrColor color,
+ GrTexture* texture) const {
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
bool isLCD = this->isLCD();
// set up any flags
@@ -277,32 +277,32 @@
greenCorrection,
blueCorrection);
- return GrDistanceFieldLCDTextGeoProc::Create(color,
- viewMatrix,
- texture,
- params,
- widthAdjust,
- flags,
- this->usesLocalCoords());
+ return GrDistanceFieldLCDTextGeoProc::Make(color,
+ viewMatrix,
+ texture,
+ params,
+ widthAdjust,
+ flags,
+ this->usesLocalCoords());
} else {
#ifdef SK_GAMMA_APPLY_TO_A8
U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONENT, filteredColor);
float correction = fDistanceAdjustTable->getAdjustment(
lum >> kDistanceAdjustLumShift, fUseGammaCorrectDistanceTable);
- return GrDistanceFieldA8TextGeoProc::Create(color,
- viewMatrix,
- texture,
- params,
- correction,
- flags,
- this->usesLocalCoords());
+ return GrDistanceFieldA8TextGeoProc::Make(color,
+ viewMatrix,
+ texture,
+ params,
+ correction,
+ flags,
+ this->usesLocalCoords());
#else
- return GrDistanceFieldA8TextGeoProc::Create(color,
- viewMatrix,
- texture,
- params,
- flags,
- this->usesLocalCoords());
+ return GrDistanceFieldA8TextGeoProc::Make(color,
+ viewMatrix,
+ texture,
+ params,
+ flags,
+ this->usesLocalCoords());
#endif
}