src/gpu: s/SkAutoTUnref/sk_sp/g
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4527
Change-Id: I23f0548f98e7c355da05e143e8baa330d4bc04cc
Reviewed-on: https://skia-review.googlesource.com/4527
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index a28f638..9c6fdf3 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -65,7 +65,7 @@
run->fPathEffect = sk_ref_sp(effects.fPathEffect);
run->fRasterizer = sk_ref_sp(effects.fRasterizer);
run->fMaskFilter = sk_ref_sp(effects.fMaskFilter);
- return SkGlyphCache::DetachCache(run->fTypeface, effects, desc->getDesc());
+ return SkGlyphCache::DetachCache(run->fTypeface.get(), effects, desc->getDesc());
}
void GrAtlasTextBlob::appendGlyph(int runIndex,
@@ -318,16 +318,16 @@
GrColor color = grPaint.getColor();
- SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run,
- subRun, viewMatrix, x, y, color,
- skPaint, props,
- distanceAdjustTable,
- rtc->isGammaCorrect(),
- cache));
+ sk_sp<GrDrawBatch> batch(this->createBatch(info, glyphCount, run,
+ subRun, viewMatrix, x, y, color,
+ skPaint, props,
+ distanceAdjustTable,
+ rtc->isGammaCorrect(),
+ cache));
GrPipelineBuilder pipelineBuilder(grPaint, rtc->mustUseHWAA(grPaint));
- rtc->drawBatch(pipelineBuilder, clip, batch);
+ rtc->drawBatch(pipelineBuilder, clip, batch.get());
}
}
@@ -506,7 +506,7 @@
if (lRun.fTypeface.get()) {
SkASSERT_RELEASE(rRun.fTypeface.get());
- SkASSERT_RELEASE(SkTypeface::Equal(lRun.fTypeface, rRun.fTypeface));
+ SkASSERT_RELEASE(SkTypeface::Equal(lRun.fTypeface.get(), rRun.fTypeface.get()));
} else {
SkASSERT_RELEASE(!rRun.fTypeface.get());
}
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index c8e2008..f24147f 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -452,7 +452,7 @@
private:
GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken;
- SkAutoTUnref<GrBatchTextStrike> fStrike;
+ sk_sp<GrBatchTextStrike> fStrike;
SkMatrix fCurrentViewMatrix;
SkRect fVertexBounds;
uint64_t fAtlasGeneration;
@@ -477,7 +477,7 @@
return newSubRun;
}
static const int kMinSubRuns = 1;
- SkAutoTUnref<SkTypeface> fTypeface;
+ sk_sp<SkTypeface> fTypeface;
SkSTArray<kMinSubRuns, SubRunInfo> fSubRunInfo;
SkAutoDescriptor fDescriptor;
diff --git a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
index 59df1fa..f0ccfc6 100644
--- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
+++ b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
@@ -162,7 +162,7 @@
effects.fPathEffect = run->fPathEffect.get();
effects.fRasterizer = run->fRasterizer.get();
effects.fMaskFilter = run->fMaskFilter.get();
- lazyCache->reset(SkGlyphCache::DetachCache(run->fTypeface, effects, desc));
+ lazyCache->reset(SkGlyphCache::DetachCache(run->fTypeface.get(), effects, desc));
}
if (regenGlyphs) {
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 1d6cef0..76bdfc8 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -87,7 +87,7 @@
return;
}
- SkAutoTUnref<GrAtlasTextBlob> cacheBlob;
+ sk_sp<GrAtlasTextBlob> cacheBlob;
SkMaskFilter::BlurRec blurRec;
GrAtlasTextBlob::Key key;
// It might be worth caching these things, but its not clear at this time
@@ -133,22 +133,22 @@
// We have to remake the blob because changes may invalidate our masks.
// TODO we could probably get away reuse most of the time if the pointer is unique,
// but we'd have to clear the subrun information
- cache->remove(cacheBlob);
+ cache->remove(cacheBlob.get());
cacheBlob.reset(SkRef(cache->createCachedBlob(blob, key, blurRec, skPaint)));
- RegenerateTextBlob(cacheBlob, context->getBatchFontCache(),
+ RegenerateTextBlob(cacheBlob.get(), context->getBatchFontCache(),
*context->caps()->shaderCaps(), skPaint, grPaint.getColor(),
scalerContextFlags, viewMatrix, props,
blob, x, y, drawFilter);
} else {
- cache->makeMRU(cacheBlob);
+ cache->makeMRU(cacheBlob.get());
if (CACHE_SANITY_CHECK) {
int glyphCount = 0;
int runCount = 0;
GrTextBlobCache::BlobGlyphCount(&glyphCount, &runCount, blob);
- SkAutoTUnref<GrAtlasTextBlob> sanityBlob(cache->createBlob(glyphCount, runCount));
+ sk_sp<GrAtlasTextBlob> sanityBlob(cache->createBlob(glyphCount, runCount));
sanityBlob->setupKey(key, blurRec, skPaint);
- RegenerateTextBlob(sanityBlob, context->getBatchFontCache(),
+ RegenerateTextBlob(sanityBlob.get(), context->getBatchFontCache(),
*context->caps()->shaderCaps(), skPaint,
grPaint.getColor(), scalerContextFlags, viewMatrix, props,
blob, x, y, drawFilter);
@@ -161,13 +161,13 @@
} else {
cacheBlob.reset(cache->createBlob(blob));
}
- RegenerateTextBlob(cacheBlob, context->getBatchFontCache(),
+ RegenerateTextBlob(cacheBlob.get(), context->getBatchFontCache(),
*context->caps()->shaderCaps(), skPaint, grPaint.getColor(),
scalerContextFlags, viewMatrix, props,
blob, x, y, drawFilter);
}
- cacheBlob->flushCached(context, rtc, blob, props, fDistanceAdjustTable, skPaint,
+ cacheBlob->flushCached(context, rtc, blob, props, fDistanceAdjustTable.get(), skPaint,
grPaint, drawFilter, clip, viewMatrix, clipBounds, x, y);
}
@@ -323,14 +323,14 @@
if (context->abandoned()) {
return;
} else if (this->canDraw(skPaint, viewMatrix, props, *context->caps()->shaderCaps())) {
- SkAutoTUnref<GrAtlasTextBlob> blob(
+ sk_sp<GrAtlasTextBlob> blob(
CreateDrawTextBlob(context->getTextBlobCache(), context->getBatchFontCache(),
*context->caps()->shaderCaps(),
paint, skPaint,
ComputeScalerContextFlags(rtc),
viewMatrix, props,
text, byteLength, x, y));
- blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable, skPaint, paint,
+ blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable.get(), skPaint, paint,
clip, viewMatrix, regionClipBounds, x, y);
return;
}
@@ -352,7 +352,7 @@
if (context->abandoned()) {
return;
} else if (this->canDraw(skPaint, viewMatrix, props, *context->caps()->shaderCaps())) {
- SkAutoTUnref<GrAtlasTextBlob> blob(
+ sk_sp<GrAtlasTextBlob> blob(
CreateDrawPosTextBlob(context->getTextBlobCache(),
context->getBatchFontCache(),
*context->caps()->shaderCaps(),
@@ -362,7 +362,7 @@
text, byteLength,
pos, scalarsPerPosition,
offset));
- blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable, skPaint, paint,
+ blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable.get(), skPaint, paint,
clip, viewMatrix, regionClipBounds, offset.fX, offset.fY);
return;
}
@@ -419,7 +419,7 @@
// right now we don't handle textblobs, nor do we handle drawPosText. Since we only
// intend to test the batch with this unit test, that is okay.
- SkAutoTUnref<GrAtlasTextBlob> blob(
+ sk_sp<GrAtlasTextBlob> blob(
GrAtlasTextContext::CreateDrawTextBlob(context->getTextBlobCache(),
context->getBatchFontCache(),
*context->caps()->shaderCaps(), grPaint, skPaint,
diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h
index 20da8be..61af211 100644
--- a/src/gpu/text/GrAtlasTextContext.h
+++ b/src/gpu/text/GrAtlasTextContext.h
@@ -84,9 +84,9 @@
const SkScalar pos[],
int scalarsPerPosition,
const SkPoint& offset);
- const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAdjustTable; }
+ const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAdjustTable.get(); }
- SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
+ sk_sp<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
#ifdef GR_TEST_UTILS
static const uint32_t kTextBlobBatchScalerContextFlags =
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index b3a7eef..2022e45 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -619,7 +619,7 @@
0xffff>()
);
- SkAutoTUnref<GrPathRange> glyphs(this->createGlyphs(ctx));
+ sk_sp<GrPathRange> glyphs(this->createGlyphs(ctx));
if (fLastDrawnGlyphsID != glyphs->uniqueID()) {
// Either this is the first draw or the glyphs object was purged since last draw.
glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->count());
@@ -634,17 +634,17 @@
const SkRect bounds = SkRect::MakeIWH(renderTargetContext->width(),
renderTargetContext->height());
- SkAutoTUnref<GrDrawBatch> batch(
+ sk_sp<GrDrawBatch> batch(
GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRatio * x,
fTextInverseRatio * y, grPaint.getColor(),
- GrPathRendering::kWinding_FillType, glyphs, fInstanceData,
- bounds));
+ GrPathRendering::kWinding_FillType, glyphs.get(),
+ fInstanceData.get(), bounds));
GrPipelineBuilder pipelineBuilder(grPaint);
pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, grPaint.isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);
- renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get());
}
if (fFallbackTextBlob) {
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.h b/src/gpu/text/GrStencilAndCoverTextContext.h
index 470e1e4..3cf4374 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.h
+++ b/src/gpu/text/GrStencilAndCoverTextContext.h
@@ -104,7 +104,7 @@
bool fUsingRawGlyphPaths;
GrUniqueKey fGlyphPathsKey;
int fTotalGlyphCount;
- SkAutoTUnref<InstanceData> fInstanceData;
+ sk_sp<InstanceData> fInstanceData;
int fFallbackGlyphCount;
sk_sp<SkTextBlob> fFallbackTextBlob;
mutable SkGlyphCache* fDetachedGlyphCache;