aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrBatchAtlas.cpp6
-rw-r--r--src/gpu/GrBatchAtlas.h6
-rw-r--r--src/gpu/GrBlurUtils.cpp6
-rw-r--r--src/gpu/GrClipStackClip.h4
-rw-r--r--src/gpu/GrContext.cpp16
-rw-r--r--src/gpu/GrGpu.h2
-rw-r--r--src/gpu/GrOvalRenderer.cpp32
-rw-r--r--src/gpu/GrPathRange.h2
-rw-r--r--src/gpu/GrPathRendering.cpp8
-rw-r--r--src/gpu/GrPipeline.cpp4
-rw-r--r--src/gpu/GrRenderTargetContext.cpp153
-rw-r--r--src/gpu/GrSWMaskHelper.cpp8
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp8
-rw-r--r--src/gpu/GrTextureParamsAdjuster.cpp14
-rw-r--r--src/gpu/GrYUVProvider.cpp10
-rw-r--r--src/gpu/SkGpuDevice.cpp82
-rw-r--r--src/gpu/SkGpuDevice.h14
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp20
-rw-r--r--src/gpu/batches/GrAAConvexPathRenderer.cpp4
-rw-r--r--src/gpu/batches/GrAADistanceFieldPathRenderer.cpp20
-rw-r--r--src/gpu/batches/GrAAFillRectBatch.cpp4
-rw-r--r--src/gpu/batches/GrAAHairLinePathRenderer.cpp18
-rw-r--r--src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp12
-rw-r--r--src/gpu/batches/GrAAStrokeRectBatch.cpp4
-rw-r--r--src/gpu/batches/GrAnalyticRectBatch.cpp4
-rw-r--r--src/gpu/batches/GrAtlasTextBatch.cpp4
-rw-r--r--src/gpu/batches/GrAtlasTextBatch.h12
-rw-r--r--src/gpu/batches/GrDashLinePathRenderer.cpp12
-rw-r--r--src/gpu/batches/GrDashLinePathRenderer.h2
-rw-r--r--src/gpu/batches/GrDefaultPathRenderer.cpp14
-rw-r--r--src/gpu/batches/GrDrawPathBatch.cpp14
-rw-r--r--src/gpu/batches/GrDrawPathBatch.h4
-rw-r--r--src/gpu/batches/GrMSAAPathRenderer.cpp14
-rw-r--r--src/gpu/batches/GrNinePatch.cpp5
-rw-r--r--src/gpu/batches/GrNonAAFillRectBatch.cpp4
-rw-r--r--src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp4
-rw-r--r--src/gpu/batches/GrPLSPathRenderer.cpp18
-rw-r--r--src/gpu/batches/GrRegionBatch.cpp5
-rw-r--r--src/gpu/batches/GrStencilAndCoverPathRenderer.cpp19
-rw-r--r--src/gpu/batches/GrTessellatingPathRenderer.cpp16
-rw-r--r--src/gpu/batches/GrVertexBatch.cpp5
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp4
-rw-r--r--src/gpu/gl/GrGLBuffer.cpp2
-rw-r--r--src/gpu/gl/GrGLContext.cpp2
-rw-r--r--src/gpu/gl/GrGLContext.h20
-rw-r--r--src/gpu/gl/GrGLCreateNullInterface.cpp8
-rw-r--r--src/gpu/gl/GrGLGpu.cpp22
-rw-r--r--src/gpu/gl/GrGLGpu.h10
-rw-r--r--src/gpu/gl/GrGLGpuProgramCache.cpp4
-rw-r--r--src/gpu/instanced/GLInstancedRendering.h4
-rw-r--r--src/gpu/instanced/InstancedRendering.cpp6
-rw-r--r--src/gpu/instanced/InstancedRendering.h14
-rw-r--r--src/gpu/text/GrAtlasTextBlob.cpp18
-rw-r--r--src/gpu/text/GrAtlasTextBlob.h4
-rw-r--r--src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp2
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp26
-rw-r--r--src/gpu/text/GrAtlasTextContext.h4
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.cpp10
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.h2
-rw-r--r--src/gpu/vk/GrVkCopyManager.cpp2
-rw-r--r--src/gpu/vk/GrVkCopyManager.h4
-rw-r--r--src/gpu/vk/GrVkGpu.h4
62 files changed, 392 insertions, 393 deletions
diff --git a/src/gpu/GrBatchAtlas.cpp b/src/gpu/GrBatchAtlas.cpp
index e478ca1c7d..72808c9143 100644
--- a/src/gpu/GrBatchAtlas.cpp
+++ b/src/gpu/GrBatchAtlas.cpp
@@ -136,9 +136,9 @@ GrBatchAtlas::GrBatchAtlas(GrTexture* texture, int numPlotsX, int numPlotsY)
SkASSERT(!GrPixelConfigIsCompressed(texture->desc().fConfig));
// set up allocated plots
- fPlotArray = new SkAutoTUnref<BatchPlot>[numPlotsX * numPlotsY];
+ fPlotArray = new sk_sp<BatchPlot>[numPlotsX * numPlotsY];
- SkAutoTUnref<BatchPlot>* currPlot = fPlotArray;
+ sk_sp<BatchPlot>* currPlot = fPlotArray;
for (int y = numPlotsY - 1, r = 0; y >= 0; --y, ++r) {
for (int x = numPlotsX - 1, c = 0; x >= 0; --x, ++c) {
uint32_t index = r * numPlotsX + c;
@@ -230,7 +230,7 @@ bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawBatch::Target* target,
this->processEviction(plot->id());
fPlotList.remove(plot);
- SkAutoTUnref<BatchPlot>& newPlot = fPlotArray[plot->index()];
+ sk_sp<BatchPlot>& newPlot = fPlotArray[plot->index()];
newPlot.reset(plot->clone());
fPlotList.addToHead(newPlot.get());
diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h
index 827106fdf9..d8856e8ef1 100644
--- a/src/gpu/GrBatchAtlas.h
+++ b/src/gpu/GrBatchAtlas.h
@@ -69,7 +69,7 @@ public:
SkASSERT(this->hasID(id));
uint32_t index = GetIndexFromID(id);
SkASSERT(index < fNumPlots);
- this->makeMRU(fPlotArray[index]);
+ this->makeMRU(fPlotArray[index].get());
fPlotArray[index]->setLastUseToken(batchToken);
}
@@ -127,7 +127,7 @@ public:
void setLastUseTokenBulk(const BulkUseTokenUpdater& updater, GrBatchDrawToken batchToken) {
int count = updater.fPlotsToUpdate.count();
for (int i = 0; i < count; i++) {
- BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]];
+ BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]].get();
this->makeMRU(plot);
plot->setLastUseToken(batchToken);
}
@@ -254,7 +254,7 @@ private:
SkTDArray<EvictionData> fEvictionCallbacks;
// allocated array of GrBatchPlots
- SkAutoTUnref<BatchPlot>* fPlotArray;
+ sk_sp<BatchPlot>* fPlotArray;
// LRU list of GrPlots (MRU at head - LRU at tail)
GrBatchPlotList fPlotList;
};
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 1c278c35f1..58d12af178 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -81,14 +81,14 @@ static bool sw_draw_with_mask_filter(GrRenderTargetContext* renderTargetContext,
desc.fHeight = dstM.fBounds.height();
desc.fConfig = kAlpha_8_GrPixelConfig;
- SkAutoTUnref<GrTexture> texture(textureProvider->createApproxTexture(desc));
+ sk_sp<GrTexture> texture(textureProvider->createApproxTexture(desc));
if (!texture) {
return false;
}
texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
dstM.fImage, dstM.fRowBytes);
- return draw_mask(renderTargetContext, clipData, viewMatrix, dstM.fBounds, grp, texture);
+ return draw_mask(renderTargetContext, clipData, viewMatrix, dstM.fBounds, grp, texture.get());
}
// Create a mask of 'devPath' and place the result in 'mask'.
@@ -215,7 +215,7 @@ static void draw_path_with_mask_filter(GrContext* context,
if (maskFilter->filterMaskGPU(mask.get(), viewMatrix, finalIRect, &filtered)) {
// filterMaskGPU gives us ownership of a ref to the result
- SkAutoTUnref<GrTexture> atu(filtered);
+ sk_sp<GrTexture> atu(filtered);
if (draw_mask(renderTargetContext, clip, viewMatrix, finalIRect, paint, filtered)) {
// This path is completely drawn
return;
diff --git a/src/gpu/GrClipStackClip.h b/src/gpu/GrClipStackClip.h
index 4e99955a09..afda3eb43c 100644
--- a/src/gpu/GrClipStackClip.h
+++ b/src/gpu/GrClipStackClip.h
@@ -64,8 +64,8 @@ private:
static GrTexture* CreateCachedMask(int width, int height, const GrUniqueKey& key,
bool renderTarget);
- SkIPoint fOrigin;
- SkAutoTUnref<const SkClipStack> fStack;
+ SkIPoint fOrigin;
+ sk_sp<const SkClipStack> fStack;
};
#endif // GrClipStackClip_DEFINED
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index aabe8fb329..13d1f3d119 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -289,7 +289,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
this->flush();
}
- SkAutoTUnref<GrTexture> tempTexture;
+ sk_sp<GrTexture> tempTexture;
if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
tempTexture.reset(
this->textureProvider()->createApproxTexture(tempDrawInfo.fTempSurfaceDesc));
@@ -305,7 +305,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
SkMatrix textureMatrix;
textureMatrix.setIDiv(tempTexture->width(), tempTexture->height());
if (applyPremulToSrc) {
- fp = this->createUPMToPMEffect(tempTexture, tempDrawInfo.fSwizzle, textureMatrix);
+ fp = this->createUPMToPMEffect(tempTexture.get(), tempDrawInfo.fSwizzle, textureMatrix);
// If premultiplying was the only reason for the draw, fall back to a straight write.
if (!fp) {
if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference) {
@@ -317,7 +317,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
}
if (tempTexture) {
if (!fp) {
- fp = GrConfigConversionEffect::Make(tempTexture, tempDrawInfo.fSwizzle,
+ fp = GrConfigConversionEffect::Make(tempTexture.get(), tempDrawInfo.fSwizzle,
GrConfigConversionEffect::kNone_PMConversion,
textureMatrix);
if (!fp) {
@@ -340,7 +340,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
buffer = tmpPixels.get();
applyPremulToSrc = false;
}
- if (!fGpu->writePixels(tempTexture, 0, 0, width, height,
+ if (!fGpu->writePixels(tempTexture.get(), 0, 0, width, height,
tempDrawInfo.fWriteConfig, buffer,
rowBytes)) {
return false;
@@ -429,7 +429,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
return false;
}
- SkAutoTUnref<GrSurface> surfaceToRead(SkRef(src));
+ sk_sp<GrSurface> surfaceToRead(SkRef(src));
bool didTempDraw = false;
if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
if (SkBackingFit::kExact == tempDrawInfo.fTempSurfaceFit) {
@@ -491,11 +491,11 @@ bool GrContext::readSurfacePixels(GrSurface* src,
}
GrPixelConfig configToRead = dstConfig;
if (didTempDraw) {
- this->flushSurfaceWrites(surfaceToRead);
+ this->flushSurfaceWrites(surfaceToRead.get());
configToRead = tempDrawInfo.fReadConfig;
}
- if (!fGpu->readPixels(surfaceToRead, left, top, width, height, configToRead, buffer,
- rowBytes)) {
+ if (!fGpu->readPixels(surfaceToRead.get(), left, top, width, height, configToRead, buffer,
+ rowBytes)) {
return false;
}
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 9a7456012c..686820e13f 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -516,7 +516,7 @@ protected:
Stats fStats;
std::unique_ptr<GrPathRendering> fPathRendering;
// Subclass must initialize this in its constructor.
- SkAutoTUnref<const GrCaps> fCaps;
+ sk_sp<const GrCaps> fCaps;
typedef SkTArray<SkPoint, true> SamplePattern;
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index d04502ecec..e7a89007ef 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -819,10 +819,10 @@ private:
}
// Setup geometry processor
- SkAutoTUnref<GrGeometryProcessor> gp(new CircleGeometryProcessor(!fAllFill, fClipPlane,
- fClipPlaneIsect,
- fClipPlaneUnion,
- localMatrix));
+ sk_sp<GrGeometryProcessor> gp(new CircleGeometryProcessor(!fAllFill, fClipPlane,
+ fClipPlaneIsect,
+ fClipPlaneUnion,
+ localMatrix));
struct CircleVertex {
SkPoint fPos;
@@ -1258,7 +1258,7 @@ private:
}
// Setup geometry processor
- SkAutoTUnref<GrGeometryProcessor> gp(new EllipseGeometryProcessor(fStroked, localMatrix));
+ sk_sp<GrGeometryProcessor> gp(new EllipseGeometryProcessor(fStroked, localMatrix));
int instanceCount = fGeoData.count();
QuadHelper helper;
@@ -1316,7 +1316,7 @@ private:
verts += kVerticesPerQuad;
}
- helper.recordDraw(target, gp);
+ helper.recordDraw(target, gp.get());
}
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
@@ -1462,8 +1462,8 @@ private:
void onPrepareDraws(Target* target) const override {
// Setup geometry processor
- SkAutoTUnref<GrGeometryProcessor> gp(new DIEllipseGeometryProcessor(this->viewMatrix(),
- this->style()));
+ sk_sp<GrGeometryProcessor> gp(new DIEllipseGeometryProcessor(this->viewMatrix(),
+ this->style()));
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
@@ -1513,7 +1513,7 @@ private:
verts += kVerticesPerQuad;
}
- helper.recordDraw(target, gp);
+ helper.recordDraw(target, gp.get());
}
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
@@ -1857,9 +1857,9 @@ private:
}
// Setup geometry processor
- SkAutoTUnref<GrGeometryProcessor> gp(new CircleGeometryProcessor(!fAllFill,
- false, false,
- false, localMatrix));
+ sk_sp<GrGeometryProcessor> gp(new CircleGeometryProcessor(!fAllFill,
+ false, false,
+ false, localMatrix));
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
@@ -2129,7 +2129,7 @@ private:
}
// Setup geometry processor
- SkAutoTUnref<GrGeometryProcessor> gp(new EllipseGeometryProcessor(fStroked, localMatrix));
+ sk_sp<GrGeometryProcessor> gp(new EllipseGeometryProcessor(fStroked, localMatrix));
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
@@ -2137,13 +2137,13 @@ private:
// drop out the middle quad if we're stroked
int indicesPerInstance = fStroked ? kIndicesPerStrokeRRect : kIndicesPerFillRRect;
- SkAutoTUnref<const GrBuffer> indexBuffer(
+ sk_sp<const GrBuffer> indexBuffer(
ref_rrect_index_buffer(fStroked ? kStroke_RRectType : kFill_RRectType,
target->resourceProvider()));
InstancedHelper helper;
EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(
- helper.init(target, kTriangles_GrPrimitiveType, vertexStride, indexBuffer,
+ helper.init(target, kTriangles_GrPrimitiveType, vertexStride, indexBuffer.get(),
kVertsPerStandardRRect, indicesPerInstance, instanceCount));
if (!verts || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
@@ -2210,7 +2210,7 @@ private:
verts++;
}
}
- helper.recordDraw(target, gp);
+ helper.recordDraw(target, gp.get());
}
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
diff --git a/src/gpu/GrPathRange.h b/src/gpu/GrPathRange.h
index 7bca17f260..39779a7008 100644
--- a/src/gpu/GrPathRange.h
+++ b/src/gpu/GrPathRange.h
@@ -143,7 +143,7 @@ private:
kPathsPerGroup = 16 // Paths get tracked in groups of 16 for lazy loading.
};
- mutable SkAutoTUnref<PathGenerator> fPathGenerator;
+ mutable sk_sp<PathGenerator> fPathGenerator;
mutable SkTArray<uint8_t, true /*MEM_COPY*/> fGeneratedPaths;
const int fNumPaths;
diff --git a/src/gpu/GrPathRendering.cpp b/src/gpu/GrPathRendering.cpp
index 933f0fba9f..a859d1063d 100644
--- a/src/gpu/GrPathRendering.cpp
+++ b/src/gpu/GrPathRendering.cpp
@@ -84,8 +84,8 @@ GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface,
}
if (desc) {
- SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, effects, *desc));
- return this->createPathRange(generator, style);
+ sk_sp<GlyphGenerator> generator(new GlyphGenerator(*typeface, effects, *desc));
+ return this->createPathRange(generator.get(), style);
}
SkScalerContextRec rec;
@@ -105,6 +105,6 @@ GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface,
// No effects, so we make a dummy struct
SkScalerContextEffects noEffects;
- SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, noEffects, *genericDesc));
- return this->createPathRange(generator, style);
+ sk_sp<GlyphGenerator> generator(new GlyphGenerator(*typeface, noEffects, *genericDesc));
+ return this->createPathRange(generator.get(), style);
}
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 0ac17e7a9d..875c50e88c 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -59,7 +59,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
bool hasMixedSamples = args.fRenderTargetContext->hasMixedSamples() &&
(builder.isHWAntialias() || pipeline->isStencilEnabled());
const GrXPFactory* xpFactory = builder.getXPFactory();
- SkAutoTUnref<GrXferProcessor> xferProcessor;
+ sk_sp<GrXferProcessor> xferProcessor;
if (xpFactory) {
xferProcessor.reset(xpFactory->createXferProcessor(args.fOpts,
hasMixedSamples,
@@ -104,7 +104,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
overrideColor = GrColor_ILLEGAL;
}
- pipeline->fXferProcessor.reset(xferProcessor);
+ pipeline->fXferProcessor.reset(xferProcessor.get());
int firstColorProcessorIdx = args.fOpts.fColorPOI.firstEffectiveProcessorIndex();
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index ad8adb097d..f1f17b03ea 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -403,7 +403,7 @@ bool GrRenderTargetContext::drawFilledRect(const GrClip& clip,
return true;
}
- SkAutoTUnref<GrDrawBatch> batch;
+ sk_sp<GrDrawBatch> batch;
bool useHWAA;
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
@@ -416,7 +416,7 @@ bool GrRenderTargetContext::drawFilledRect(const GrClip& clip,
if (ss) {
pipelineBuilder.setUserStencil(ss);
}
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return true;
}
}
@@ -434,7 +434,7 @@ bool GrRenderTargetContext::drawFilledRect(const GrClip& clip,
if (ss) {
pipelineBuilder.setUserStencil(ss);
}
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return true;
}
}
@@ -534,7 +534,7 @@ void GrRenderTargetContext::drawRect(const GrClip& clip,
bool useHWAA;
bool snapToPixelCenters = false;
- SkAutoTUnref<GrDrawBatch> batch;
+ sk_sp<GrDrawBatch> batch;
GrColor color = paint.getColor();
if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) {
@@ -560,7 +560,7 @@ void GrRenderTargetContext::drawRect(const GrClip& clip,
snapToPixelCenters);
}
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -663,12 +663,12 @@ void GrRenderTargetContext::fillRectToRect(const GrClip& clip,
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- SkAutoTUnref<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix, paint.getColor(),
- croppedLocalRect, paint.isAntiAlias(),
- fInstancedPipelineInfo, &useHWAA));
+ sk_sp<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix, paint.getColor(),
+ croppedLocalRect, paint.isAntiAlias(),
+ fInstancedPipelineInfo, &useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -680,12 +680,12 @@ void GrRenderTargetContext::fillRectToRect(const GrClip& clip,
}
if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
- SkAutoTUnref<GrDrawBatch> batch(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(),
- viewMatrix,
- croppedRect,
- croppedLocalRect));
+ sk_sp<GrDrawBatch> batch(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(),
+ viewMatrix,
+ croppedRect,
+ croppedLocalRect));
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->drawBatch(pipelineBuilder, clip, batch);
+ this->drawBatch(pipelineBuilder, clip, batch.get());
return;
}
@@ -722,12 +722,12 @@ void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip,
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- SkAutoTUnref<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix, paint.getColor(),
+ sk_sp<GrDrawBatch> batch(ir->recordRect(croppedRect, viewMatrix, paint.getColor(),
localMatrix, paint.isAntiAlias(),
fInstancedPipelineInfo, &useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -739,10 +739,10 @@ void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip,
}
if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
- SkAutoTUnref<GrDrawBatch> batch(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix,
- localMatrix, croppedRect));
+ sk_sp<GrDrawBatch> batch(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix,
+ localMatrix, croppedRect));
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return;
}
@@ -786,13 +786,13 @@ void GrRenderTargetContext::drawVertices(const GrClip& clip,
viewMatrix.mapRect(&bounds);
- SkAutoTUnref<GrDrawBatch> batch(new GrDrawVerticesBatch(paint.getColor(),
- primitiveType, viewMatrix, positions,
- vertexCount, indices, indexCount,
- colors, texCoords, bounds));
+ sk_sp<GrDrawBatch> batch(new GrDrawVerticesBatch(paint.getColor(),
+ primitiveType, viewMatrix, positions,
+ vertexCount, indices, indexCount,
+ colors, texCoords, bounds));
GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
}
///////////////////////////////////////////////////////////////////////////////
@@ -811,11 +811,11 @@ void GrRenderTargetContext::drawAtlas(const GrClip& clip,
AutoCheckFlush acf(fDrawingManager);
- SkAutoTUnref<GrDrawBatch> batch(new GrDrawAtlasBatch(paint.getColor(), viewMatrix, spriteCount,
+ sk_sp<GrDrawBatch> batch(new GrDrawAtlasBatch(paint.getColor(), viewMatrix, spriteCount,
xform, texRect, colors));
GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
}
///////////////////////////////////////////////////////////////////////////////
@@ -855,28 +855,27 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip,
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport() &&
stroke.isFillStyle()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- SkAutoTUnref<GrDrawBatch> batch(ir->recordRRect(rrect, viewMatrix, paint.getColor(),
- paint.isAntiAlias(), fInstancedPipelineInfo,
- &useHWAA));
+ sk_sp<GrDrawBatch> batch(ir->recordRRect(rrect, viewMatrix, paint.getColor(),
+ paint.isAntiAlias(), fInstancedPipelineInfo,
+ &useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch.get());
return;
}
}
if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) {
GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateRRectBatch(
- paint.getColor(),
- paint.usesDistanceVectorField(),
- viewMatrix,
- rrect,
- stroke,
- shaderCaps));
+ sk_sp<GrDrawBatch> batch(GrOvalRenderer::CreateRRectBatch(paint.getColor(),
+ paint.usesDistanceVectorField(),
+ viewMatrix,
+ rrect,
+ stroke,
+ shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch.get());
return;
}
}
@@ -898,12 +897,12 @@ bool GrRenderTargetContext::drawFilledDRRect(const GrClip& clip,
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
bool useHWAA;
InstancedRendering* ir = this->getOpList()->instancedRendering();
- SkAutoTUnref<GrDrawBatch> batch(ir->recordDRRect(origOuter, origInner, viewMatrix,
- paintIn.getColor(), paintIn.isAntiAlias(),
- fInstancedPipelineInfo, &useHWAA));
+ sk_sp<GrDrawBatch> batch(ir->recordDRRect(origOuter, origInner, viewMatrix,
+ paintIn.getColor(), paintIn.isAntiAlias(),
+ fInstancedPipelineInfo, &useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paintIn, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return true;
}
}
@@ -1011,9 +1010,9 @@ void GrRenderTargetContext::drawRegion(const GrClip& clip,
return this->drawPath(clip, paint, viewMatrix, path, style);
}
- SkAutoTUnref<GrDrawBatch> batch(GrRegionBatch::Create(paint.getColor(), viewMatrix, region));
+ sk_sp<GrDrawBatch> batch(GrRegionBatch::Create(paint.getColor(), viewMatrix, region));
GrPipelineBuilder pipelineBuilder(paint, false);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
}
void GrRenderTargetContext::drawOval(const GrClip& clip,
@@ -1039,26 +1038,26 @@ void GrRenderTargetContext::drawOval(const GrClip& clip,
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport() &&
stroke.isFillStyle()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- SkAutoTUnref<GrDrawBatch> batch(ir->recordOval(oval, viewMatrix, paint.getColor(),
- paint.isAntiAlias(), fInstancedPipelineInfo,
- &useHWAA));
+ sk_sp<GrDrawBatch> batch(ir->recordOval(oval, viewMatrix, paint.getColor(),
+ paint.isAntiAlias(), fInstancedPipelineInfo,
+ &useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return;
}
}
if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) {
GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(),
- viewMatrix,
- oval,
- stroke,
- shaderCaps));
+ sk_sp<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(),
+ viewMatrix,
+ oval,
+ stroke,
+ shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -1080,17 +1079,17 @@ void GrRenderTargetContext::drawArc(const GrClip& clip,
bool useHWAA;
if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) {
GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateArcBatch(paint.getColor(),
- viewMatrix,
- oval,
- startAngle,
- sweepAngle,
- useCenter,
- style,
- shaderCaps));
+ sk_sp<GrDrawBatch> batch(GrOvalRenderer::CreateArcBatch(paint.getColor(),
+ viewMatrix,
+ oval,
+ startAngle,
+ sweepAngle,
+ useCenter,
+ style,
+ shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -1115,12 +1114,12 @@ void GrRenderTargetContext::drawImageLattice(const GrClip& clip,
AutoCheckFlush acf(fDrawingManager);
- SkAutoTUnref<GrDrawBatch> batch(GrNinePatch::CreateNonAA(paint.getColor(), viewMatrix,
- imageWidth, imageHeight,
- std::move(iter), dst));
+ sk_sp<GrDrawBatch> batch(GrNinePatch::CreateNonAA(paint.getColor(), viewMatrix,
+ imageWidth, imageHeight,
+ std::move(iter), dst));
GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
}
void GrRenderTargetContext::prepareForExternalIO() {
@@ -1147,14 +1146,14 @@ void GrRenderTargetContext::drawNonAAFilledRect(const GrClip& clip,
const GrUserStencilSettings* ss,
bool useHWAA) {
SkASSERT(!useHWAA || this->isStencilBufferMultisampled());
- SkAutoTUnref<GrDrawBatch> batch(
+ sk_sp<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rect, localRect,
localMatrix));
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
if (ss) {
pipelineBuilder.setUserStencil(ss);
}
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
}
bool GrRenderTargetContext::readPixels(const SkImageInfo& dstInfo, void* dstBuffer,
@@ -1271,11 +1270,11 @@ void GrRenderTargetContext::drawPath(const GrClip& clip,
SkRect rects[2];
if (fills_as_nested_rects(viewMatrix, path, rects)) {
- SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFillNestedRects(
+ sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateAAFillNestedRects(
paint.getColor(), viewMatrix, rects));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
}
return;
}
@@ -1285,14 +1284,14 @@ void GrRenderTargetContext::drawPath(const GrClip& clip,
if (isOval && !path.isInverseFillType()) {
GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- SkAutoTUnref<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(),
- viewMatrix,
- ovalRect,
- style.strokeRec(),
- shaderCaps));
+ sk_sp<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(),
+ viewMatrix,
+ ovalRect,
+ style.strokeRec(),
+ shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
return;
}
}
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 267163035e..9430efb3f2 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -194,8 +194,8 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
maskMatrix,
GrTextureParams::kNone_FilterMode));
- SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(),
- SkMatrix::I(),
- dstRect, nullptr, &invert));
- renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
+ sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(),
+ SkMatrix::I(),
+ dstRect, nullptr, &invert));
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get());
}
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index ec4bfe0c6a..55aae87fa3 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -67,14 +67,14 @@ void GrSoftwarePathRenderer::DrawNonAARect(GrRenderTargetContext* renderTargetCo
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix) {
- SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(),
- viewMatrix, rect,
- nullptr, &localMatrix));
+ sk_sp<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(),
+ viewMatrix, rect,
+ nullptr, &localMatrix));
GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(&userStencilSettings);
- renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get());
}
void GrSoftwarePathRenderer::DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index b4f5e686d9..43bfec8463 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -388,13 +388,13 @@ sk_sp<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor(
if (filterOrNullForBicubic) {
params.setFilterMode(*filterOrNullForBicubic);
}
- SkAutoTUnref<GrTexture> texture(this->refTextureSafeForParams(params, gammaTreatment, nullptr));
+ sk_sp<GrTexture> texture(this->refTextureSafeForParams(params, gammaTreatment, nullptr));
if (!texture) {
return nullptr;
}
// If we made a copy then we only copied the contentArea, in which case the new texture is all
// content.
- if (texture != this->originalTexture()) {
+ if (texture.get() != this->originalTexture()) {
contentArea = nullptr;
}
@@ -423,7 +423,7 @@ sk_sp<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor(
textureMatrix.postIDiv(texture->width(), texture->height());
sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->getColorSpace(),
dstColorSpace);
- return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform), textureMatrix,
+ return create_fp_for_domain_and_filter(texture.get(), std::move(colorSpaceXform), textureMatrix,
domainMode, domain, filterOrNullForBicubic);
}
@@ -491,7 +491,7 @@ sk_sp<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor(
// Bicubic doesn't use filtering for it's texture accesses.
params.reset(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode);
}
- SkAutoTUnref<GrTexture> texture(this->refTextureForParams(params, gammaTreatment));
+ sk_sp<GrTexture> texture(this->refTextureForParams(params, gammaTreatment));
if (!texture) {
return nullptr;
}
@@ -505,16 +505,16 @@ sk_sp<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor(
normalizedTextureMatrix.postIDiv(texture->width(), texture->height());
sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(this->getColorSpace(),
dstColorSpace);
- return create_fp_for_domain_and_filter(texture, std::move(colorSpaceXform),
+ return create_fp_for_domain_and_filter(texture.get(), std::move(colorSpaceXform),
normalizedTextureMatrix, domainMode, domain,
filterOrNullForBicubic);
}
GrTexture* GrTextureMaker::generateTextureForParams(const CopyParams& copyParams, bool willBeMipped,
SkSourceGammaTreatment gammaTreatment) {
- SkAutoTUnref<GrTexture> original(this->refOriginalTexture(willBeMipped, gammaTreatment));
+ sk_sp<GrTexture> original(this->refOriginalTexture(willBeMipped, gammaTreatment));
if (!original) {
return nullptr;
}
- return copy_on_gpu(original, nullptr, copyParams);
+ return copy_on_gpu(original.get(), nullptr, copyParams);
}
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index e12e26872c..13e84dad75 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -28,8 +28,8 @@ public:
private:
// we only use one or the other of these
- SkAutoTUnref<SkCachedData> fCachedData;
- SkAutoMalloc fStorage;
+ sk_sp<SkCachedData> fCachedData;
+ SkAutoMalloc fStorage;
};
}
@@ -75,7 +75,7 @@ bool YUVScoper::init(GrYUVProvider* provider, SkYUVPlanesCache::Info* yuvInfo, v
if (useCache) {
// Decoding is done, cache the resulting YUV planes
- SkYUVPlanesCache::Add(provider->onGetID(), fCachedData, yuvInfo);
+ SkYUVPlanesCache::Add(provider->onGetID(), fCachedData.get(), yuvInfo);
}
}
return true;
@@ -93,7 +93,7 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
GrSurfaceDesc yuvDesc;
yuvDesc.fConfig = kAlpha_8_GrPixelConfig;
- SkAutoTUnref<GrTexture> yuvTextures[3];
+ sk_sp<GrTexture> yuvTextures[3];
for (int i = 0; i < 3; i++) {
yuvDesc.fWidth = yuvInfo.fSizeInfo.fSizes[i].fWidth;
yuvDesc.fHeight = yuvInfo.fSizeInfo.fSizes[i].fHeight;
@@ -125,7 +125,7 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
GrPaint paint;
sk_sp<GrFragmentProcessor> yuvToRgbProcessor(
- GrYUVEffect::MakeYUVToRGB(yuvTextures[0], yuvTextures[1], yuvTextures[2],
+ GrYUVEffect::MakeYUVToRGB(yuvTextures[0].get(), yuvTextures[1].get(), yuvTextures[2].get(),
yuvInfo.fSizeInfo.fSizes, yuvInfo.fColorSpace, false));
paint.addColorFragmentProcessor(std::move(yuvToRgbProcessor));
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index b8a520fe2c..19c637735c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -191,7 +191,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw,
SkMatrix matrix = *draw.fMatrix;
matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-left, -top);
- SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache());
+ sk_sp<SkImageFilterCache> cache(this->getImageFilterCache());
SkImageFilter::OutputProperties outputProperties(fRenderTargetContext->getColorSpace());
SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), outputProperties);
@@ -235,7 +235,7 @@ GrRenderTargetContext* SkGpuDevice::accessRenderTargetContext() {
void SkGpuDevice::clearAll() {
ASSERT_SINGLE_OWNER
GrColor color = 0;
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "clearAll", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "clearAll", fContext.get());
SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
fRenderTargetContext->clear(&rect, color, true);
}
@@ -273,7 +273,7 @@ void SkGpuDevice::replaceRenderTargetContext(bool shouldRetainContent) {
void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
CHECK_SHOULD_DRAW(draw);
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPaint", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPaint", fContext.get());
GrPaint grPaint;
if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
@@ -316,7 +316,7 @@ static bool needs_antialiasing(SkCanvas::PointMode mode, size_t count, const SkP
void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
size_t count, const SkPoint pts[], const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPoints", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPoints", fContext.get());
CHECK_SHOULD_DRAW(draw);
SkScalar width = paint.getStrokeWidth();
@@ -388,7 +388,7 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRect", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRect", fContext.get());
CHECK_SHOULD_DRAW(draw);
@@ -397,7 +397,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint
SkPath path;
path.setIsVolatile(true);
path.addRect(rect);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fRenderTargetContext.get(),
+ GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -419,7 +419,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint
void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRRect", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawRRect", fContext.get());
CHECK_SHOULD_DRAW(draw);
GrPaint grPaint;
@@ -449,9 +449,9 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
// clipped out
return;
}
- if (mf->directFilterRRectMaskGPU(fContext, fRenderTargetContext.get(), &grPaint,
- fClip, *draw.fMatrix, style.strokeRec(), rrect,
- devRRect)) {
+ if (mf->directFilterRRectMaskGPU(fContext.get(), fRenderTargetContext.get(),
+ &grPaint, fClip, *draw.fMatrix,
+ style.strokeRec(), rrect, devRRect)) {
return;
}
}
@@ -467,7 +467,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
SkPath path;
path.setIsVolatile(true);
path.addRRect(rrect);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fRenderTargetContext.get(),
+ GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -483,7 +483,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
const SkRRect& inner, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDRRect", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDRRect", fContext.get());
CHECK_SHOULD_DRAW(draw);
if (outer.isEmpty()) {
@@ -513,7 +513,7 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
path.addRRect(inner);
path.setFillType(SkPath::kEvenOdd_FillType);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fRenderTargetContext.get(),
+ GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -540,7 +540,7 @@ void SkGpuDevice::drawRegion(const SkDraw& draw, const SkRegion& region, const S
void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext.get());
CHECK_SHOULD_DRAW(draw);
// Presumably the path effect warps this to something other than an oval
@@ -570,7 +570,7 @@ void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint
void SkGpuDevice::drawArc(const SkDraw& draw, const SkRect& oval, SkScalar startAngle,
SkScalar sweepAngle, bool useCenter, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawArc", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawArc", fContext.get());
CHECK_SHOULD_DRAW(draw);
if (paint.getMaskFilter()) {
@@ -594,7 +594,7 @@ void SkGpuDevice::drawStrokedLine(const SkPoint points[2],
const SkDraw& draw,
const SkPaint& origPaint) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawStrokedLine", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawStrokedLine", fContext.get());
CHECK_SHOULD_DRAW(draw);
// Adding support for round capping would require a
@@ -679,9 +679,9 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
}
CHECK_SHOULD_DRAW(draw);
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext.get());
- GrBlurUtils::drawPathWithMaskFilter(fContext, fRenderTargetContext.get(),
+ GrBlurUtils::drawPathWithMaskFilter(fContext.get(), fRenderTargetContext.get(),
fClip, origSrcPath, paint,
*draw.fMatrix, prePathMatrix,
draw.fRC->getBounds(), pathIsMutable);
@@ -881,7 +881,7 @@ void SkGpuDevice::drawBitmap(const SkDraw& origDraw,
return;
}
}
- GrBitmapTextureMaker maker(fContext, bitmap);
+ GrBitmapTextureMaker maker(fContext.get(), bitmap);
this->drawTextureProducer(&maker, nullptr, nullptr, SkCanvas::kStrict_SrcRectConstraint,
viewMatrix, fClip, paint);
}
@@ -1033,7 +1033,7 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
bitmap.height() <= fContext->caps()->maxTileSize());
sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(
- fContext, bitmap, params, fRenderTargetContext->sourceGammaTreatment());
+ fContext.get(), bitmap, params, fRenderTargetContext->sourceGammaTreatment());
if (nullptr == texture) {
return;
}
@@ -1097,7 +1097,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
int left, int top, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
CHECK_SHOULD_DRAW(draw);
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSprite", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSprite", fContext.get());
if (fContext->abandoned()) {
return;
@@ -1111,7 +1111,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
}
// draw sprite neither filters nor tiles.
- texture.reset(GrRefCachedBitmapTexture(fContext, bitmap,
+ texture.reset(GrRefCachedBitmapTexture(fContext.get(), bitmap,
GrTextureParams::ClampNoFilter(),
SkSourceGammaTreatment::kRespect));
if (!texture) {
@@ -1140,7 +1140,7 @@ void SkGpuDevice::drawSpecial(const SkDraw& draw,
const SkPaint& paint) {
ASSERT_SINGLE_OWNER
CHECK_SHOULD_DRAW(draw);
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSpecial", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawSpecial", fContext.get());
SkIPoint offset = { 0, 0 };
@@ -1157,7 +1157,7 @@ void SkGpuDevice::drawSpecial(const SkDraw& draw,
}
SkASSERT(result->isTextureBacked());
- sk_sp<GrTexture> texture = result->asTextureRef(fContext);
+ sk_sp<GrTexture> texture = result->asTextureRef(fContext.get());
SkPaint tmpUnfiltered(paint);
tmpUnfiltered.setImageFilter(nullptr);
@@ -1269,7 +1269,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
return;
}
}
- GrBitmapTextureMaker maker(fContext, bitmap);
+ GrBitmapTextureMaker maker(fContext.get(), bitmap);
this->drawTextureProducer(&maker, src, dst, constraint, *draw.fMatrix, fClip, paint);
}
@@ -1279,7 +1279,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkBitmap& bitmap) {
return nullptr;
}
- sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(fContext, bitmap,
+ sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(fContext.get(), bitmap,
GrTextureParams::ClampNoFilter(),
SkSourceGammaTreatment::kRespect);
if (!texture) {
@@ -1347,7 +1347,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
ASSERT_SINGLE_OWNER
// clear of the source device must occur before CHECK_SHOULD_DRAW
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDevice", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawDevice", fContext.get());
// drawDevice is defined to be in device coords.
CHECK_SHOULD_DRAW(draw);
@@ -1385,7 +1385,7 @@ void SkGpuDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar x
this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint);
} else if (SkImageCacherator* cacher = as_IB(image)->peekCacherator()) {
CHECK_SHOULD_DRAW(draw);
- GrImageTextureMaker maker(fContext, cacher, image, SkImage::kAllow_CachingHint);
+ GrImageTextureMaker maker(fContext.get(), cacher, image, SkImage::kAllow_CachingHint);
this->drawTextureProducer(&maker, nullptr, nullptr, SkCanvas::kFast_SrcRectConstraint,
viewMatrix, fClip, paint);
} else if (as_IB(image)->getROPixels(&bm)) {
@@ -1419,7 +1419,7 @@ void SkGpuDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const
this->drawBitmapRect(draw, bm, src, dst, paint, constraint);
} else if (SkImageCacherator* cacher = as_IB(image)->peekCacherator()) {
CHECK_SHOULD_DRAW(draw);
- GrImageTextureMaker maker(fContext, cacher, image, SkImage::kAllow_CachingHint);
+ GrImageTextureMaker maker(fContext.get(), cacher, image, SkImage::kAllow_CachingHint);
this->drawTextureProducer(&maker, src, &dst, constraint, *draw.fMatrix, fClip, paint);
} else if (as_IB(image)->getROPixels(&bm)) {
this->drawBitmapRect(draw, bm, src, dst, paint, constraint);
@@ -1428,7 +1428,7 @@ void SkGpuDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const
void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* producer,
const SkIRect& center, const SkRect& dst, const SkPaint& paint) {
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawProducerNine", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawProducerNine", fContext.get());
CHECK_SHOULD_DRAW(draw);
@@ -1481,7 +1481,7 @@ void SkGpuDevice::drawImageNine(const SkDraw& draw, const SkImage* image,
} else {
SkBitmap bm;
if (SkImageCacherator* cacher = as_IB(image)->peekCacherator()) {
- GrImageTextureMaker maker(fContext, cacher, image, SkImage::kAllow_CachingHint);
+ GrImageTextureMaker maker(fContext.get(), cacher, image, SkImage::kAllow_CachingHint);
this->drawProducerNine(draw, &maker, center, dst, paint);
} else if (as_IB(image)->getROPixels(&bm)) {
this->drawBitmapNine(draw, bm, center, dst, paint);
@@ -1492,14 +1492,14 @@ void SkGpuDevice::drawImageNine(const SkDraw& draw, const SkImage* image,
void SkGpuDevice::drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, const SkIRect& center,
const SkRect& dst, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GrBitmapTextureMaker maker(fContext, bitmap);
+ GrBitmapTextureMaker maker(fContext.get(), bitmap);
this->drawProducerNine(draw, &maker, center, dst, paint);
}
void SkGpuDevice::drawProducerLattice(const SkDraw& draw, GrTextureProducer* producer,
const SkCanvas::Lattice& lattice, const SkRect& dst,
const SkPaint& paint) {
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawProducerLattice", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawProducerLattice", fContext.get());
CHECK_SHOULD_DRAW(draw);
@@ -1536,7 +1536,7 @@ void SkGpuDevice::drawImageLattice(const SkDraw& draw, const SkImage* image,
} else {
SkBitmap bm;
if (SkImageCacherator* cacher = as_IB(image)->peekCacherator()) {
- GrImageTextureMaker maker(fContext, cacher, image, SkImage::kAllow_CachingHint);
+ GrImageTextureMaker maker(fContext.get(), cacher, image, SkImage::kAllow_CachingHint);
this->drawProducerLattice(draw, &maker, lattice, dst, paint);
} else if (as_IB(image)->getROPixels(&bm)) {
this->drawBitmapLattice(draw, bm, lattice, dst, paint);
@@ -1548,7 +1548,7 @@ void SkGpuDevice::drawBitmapLattice(const SkDraw& draw, const SkBitmap& bitmap,
const SkCanvas::Lattice& lattice, const SkRect& dst,
const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GrBitmapTextureMaker maker(fContext, bitmap);
+ GrBitmapTextureMaker maker(fContext.get(), bitmap);
this->drawProducerLattice(draw, &maker, lattice, dst, paint);
}
@@ -1569,7 +1569,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
const SkPaint& paint) {
ASSERT_SINGLE_OWNER
CHECK_SHOULD_DRAW(draw);
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawVertices", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawVertices", fContext.get());
// If both textures and vertex-colors are nullptr, strokes hairlines with the paint's color.
if ((nullptr == texs || nullptr == paint.getShader()) && nullptr == colors) {
@@ -1697,7 +1697,7 @@ void SkGpuDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRS
}
CHECK_SHOULD_DRAW(draw);
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext.get());
SkPaint p(paint);
p.setShader(atlas->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode));
@@ -1726,7 +1726,7 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
const SkPaint& paint) {
ASSERT_SINGLE_OWNER
CHECK_SHOULD_DRAW(draw);
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext.get());
GrPaint grPaint;
if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
@@ -1744,7 +1744,7 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL
const SkScalar pos[], int scalarsPerPos,
const SkPoint& offset, const SkPaint& paint) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPosText", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPosText", fContext.get());
CHECK_SHOULD_DRAW(draw);
GrPaint grPaint;
@@ -1763,7 +1763,7 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL
void SkGpuDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint, SkDrawFilter* drawFilter) {
ASSERT_SINGLE_OWNER
- GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawTextBlob", fContext);
+ GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawTextBlob", fContext.get());
CHECK_SHOULD_DRAW(draw);
SkDEBUGCODE(this->validate();)
@@ -1820,7 +1820,7 @@ sk_sp<SkSurface> SkGpuDevice::makeSurface(const SkImageInfo& info, const SkSurfa
ASSERT_SINGLE_OWNER
// TODO: Change the signature of newSurface to take a budgeted parameter.
static const SkBudgeted kBudgeted = SkBudgeted::kNo;
- return SkSurface::MakeRenderTarget(fContext, kBudgeted, info,
+ return SkSurface::MakeRenderTarget(fContext.get(), kBudgeted, info,
fRenderTargetContext->desc().fSampleCnt,
fRenderTargetContext->origin(), &props);
}
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index bed8d896c4..ca5be45ff6 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -57,7 +57,7 @@ public:
~SkGpuDevice() override {}
- GrContext* context() const override { return fContext; }
+ GrContext* context() const override { return fContext.get(); }
// set all pixels to 0
void clearAll();
@@ -132,13 +132,13 @@ protected:
private:
// We want these unreffed in RenderTargetContext, GrContext order.
- SkAutoTUnref<GrContext> fContext;
- sk_sp<GrRenderTargetContext> fRenderTargetContext;
+ sk_sp<GrContext> fContext;
+ sk_sp<GrRenderTargetContext> fRenderTargetContext;
- SkIPoint fClipOrigin;
- GrClipStackClip fClip;
- SkISize fSize;
- bool fOpaque;
+ SkIPoint fClipOrigin;
+ GrClipStackClip fClip;
+ SkISize fSize;
+ bool fOpaque;
enum Flags {
kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index a0574260b5..d50b05032e 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -209,8 +209,8 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
}
GrPaint grPaint;
- if (!SkPaintToGrPaintWithTexture(fContext, fRenderTargetContext.get(), paint, viewMatrix, fp,
- producer->isAlphaOnly(), &grPaint)) {
+ if (!SkPaintToGrPaintWithTexture(fContext.get(), fRenderTargetContext.get(), paint, viewMatrix,
+ fp, producer->isAlphaOnly(), &grPaint)) {
return;
}
@@ -231,14 +231,14 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
viewMatrix.mapRectScaleTranslate(&devClippedDstRect, clippedDstRect);
SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
- if (mf->directFilterRRectMaskGPU(fContext,
- fRenderTargetContext.get(),
- &grPaint,
- clip,
- viewMatrix,
- rec,
- SkRRect::MakeRect(clippedDstRect),
- SkRRect::MakeRect(devClippedDstRect))) {
+ if (mf->directFilterRRectMaskGPU(fContext.get(),
+ fRenderTargetContext.get(),
+ &grPaint,
+ clip,
+ viewMatrix,
+ rec,
+ SkRRect::MakeRect(clippedDstRect),
+ SkRRect::MakeRect(devClippedDstRect))) {
return;
}
}
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index c761e4e211..4683aa1484 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -990,13 +990,13 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPath path;
args.fShape->asPath(&path);
- SkAutoTUnref<GrDrawBatch> batch(new AAConvexPathBatch(args.fPaint->getColor(),
+ sk_sp<GrDrawBatch> batch(new AAConvexPathBatch(args.fPaint->getColor(),
*args.fViewMatrix, path));
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch.get());
return true;
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index c009b8f6a5..2572ab821d 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -172,8 +172,8 @@ private:
}
struct FlushInfo {
- SkAutoTUnref<const GrBuffer> fVertexBuffer;
- SkAutoTUnref<const GrBuffer> fIndexBuffer;
+ sk_sp<const GrBuffer> fVertexBuffer;
+ sk_sp<const GrBuffer> fIndexBuffer;
sk_sp<GrGeometryProcessor> fGeometryProcessor;
int fVertexOffset;
int fInstancesToFlush;
@@ -453,8 +453,8 @@ private:
GrMesh mesh;
int maxInstancesPerDraw =
static_cast<int>(flushInfo->fIndexBuffer->gpuMemorySize() / sizeof(uint16_t) / 6);
- mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer,
- flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad,
+ mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer.get(),
+ flushInfo->fIndexBuffer.get(), flushInfo->fVertexOffset, kVerticesPerQuad,
kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw);
target->draw(flushInfo->fGeometryProcessor.get(), mesh);
flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFlush;
@@ -526,16 +526,16 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
}
- SkAutoTUnref<GrDrawBatch> batch(new AADistanceFieldPathBatch(args.fPaint->getColor(),
- *args.fShape,
- args.fAntiAlias, *args.fViewMatrix,
- fAtlas, &fShapeCache, &fShapeList,
- args.fGammaCorrect));
+ sk_sp<GrDrawBatch> batch(new AADistanceFieldPathBatch(args.fPaint->getColor(),
+ *args.fShape,
+ args.fAntiAlias, *args.fViewMatrix,
+ fAtlas, &fShapeCache, &fShapeList,
+ args.fGammaCorrect));
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch.get());
return true;
}
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp
index 4f93adf074..fd2a4c4843 100644
--- a/src/gpu/batches/GrAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrAAFillRectBatch.cpp
@@ -235,10 +235,10 @@ private:
size_t vertexStride = gp->getVertexStride();
- SkAutoTUnref<const GrBuffer> indexBuffer(get_index_buffer(target->resourceProvider()));
+ sk_sp<const GrBuffer> indexBuffer(get_index_buffer(target->resourceProvider()));
InstancedHelper helper;
void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexStride,
- indexBuffer, kVertsPerAAFillRect,
+ indexBuffer.get(), kVertsPerAAFillRect,
kIndicesPerAAFillRect, fRectCnt);
if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
diff --git a/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
index d026906744..eb1be15b74 100644
--- a/src/gpu/batches/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
@@ -844,7 +844,7 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const {
*geometryProcessorViewM);
}
- SkAutoTUnref<const GrBuffer> linesIndexBuffer(
+ sk_sp<const GrBuffer> linesIndexBuffer(
ref_lines_index_buffer(target->resourceProvider()));
const GrBuffer* vertexBuffer;
@@ -867,7 +867,7 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const {
}
GrMesh mesh;
- mesh.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, linesIndexBuffer,
+ mesh.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, linesIndexBuffer.get(),
firstVertex, kLineSegNumVertices, kIdxsPerLineSeg, lineCount,
kLineSegsNumInIdxBuffer);
target->draw(lineGP.get(), mesh);
@@ -895,7 +895,7 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const {
const GrBuffer* vertexBuffer;
int firstVertex;
- SkAutoTUnref<const GrBuffer> quadsIndexBuffer(
+ sk_sp<const GrBuffer> quadsIndexBuffer(
ref_quads_index_buffer(target->resourceProvider()));
size_t vertexStride = sizeof(BezierVertex);
@@ -924,7 +924,7 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const {
if (quadCount > 0) {
GrMesh mesh;
- mesh.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
+ mesh.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer.get(),
firstVertex, kQuadNumVertices, kIdxsPerQuad, quadCount,
kQuadsNumInIdxBuffer);
target->draw(quadGP.get(), mesh);
@@ -933,7 +933,7 @@ void AAHairlineBatch::onPrepareDraws(Target* target) const {
if (conicCount > 0) {
GrMesh mesh;
- mesh.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
+ mesh.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer.get(),
firstVertex, kQuadNumVertices, kIdxsPerQuad, conicCount,
kQuadsNumInIdxBuffer);
target->draw(conicGP.get(), mesh);
@@ -967,13 +967,13 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPath path;
args.fShape->asPath(&path);
- SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fPaint->getColor(),
- *args.fViewMatrix, path,
- args.fShape->style(), devClipBounds));
+ sk_sp<GrDrawBatch> batch(create_hairline_batch(args.fPaint->getColor(),
+ *args.fViewMatrix, path,
+ args.fShape->style(), devClipBounds));
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch.get());
return true;
}
diff --git a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
index 4d870389c1..d53fe9c6cd 100644
--- a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
@@ -343,16 +343,16 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPaint::Join join = fill ? SkPaint::Join::kMiter_Join : stroke.getJoin();
SkScalar miterLimit = stroke.getMiter();
- SkAutoTUnref<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fPaint->getColor(),
- *args.fViewMatrix,
- path, strokeWidth,
- stroke.getStyle(),
- join, miterLimit));
+ sk_sp<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fPaint->getColor(),
+ *args.fViewMatrix,
+ path, strokeWidth,
+ stroke.getStyle(),
+ join, miterLimit));
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch.get());
return true;
}
diff --git a/src/gpu/batches/GrAAStrokeRectBatch.cpp b/src/gpu/batches/GrAAStrokeRectBatch.cpp
index bbee3f878a..f3c512dcca 100644
--- a/src/gpu/batches/GrAAStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrAAStrokeRectBatch.cpp
@@ -262,11 +262,11 @@ void AAStrokeRectBatch::onPrepareDraws(Target* target) const {
int indicesPerInstance = this->miterStroke() ? kMiterIndexCnt : kBevelIndexCnt;
int instanceCount = fGeoData.count();
- const SkAutoTUnref<const GrBuffer> indexBuffer(
+ const sk_sp<const GrBuffer> indexBuffer(
GetIndexBuffer(target->resourceProvider(), this->miterStroke()));
InstancedHelper helper;
void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexStride,
- indexBuffer, verticesPerInstance, indicesPerInstance,
+ indexBuffer.get(), verticesPerInstance, indicesPerInstance,
instanceCount);
if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
diff --git a/src/gpu/batches/GrAnalyticRectBatch.cpp b/src/gpu/batches/GrAnalyticRectBatch.cpp
index 311c652137..1ddcbdbef7 100644
--- a/src/gpu/batches/GrAnalyticRectBatch.cpp
+++ b/src/gpu/batches/GrAnalyticRectBatch.cpp
@@ -298,7 +298,7 @@ private:
}
// Setup geometry processor
- SkAutoTUnref<GrGeometryProcessor> gp(new RectGeometryProcessor(localMatrix));
+ sk_sp<GrGeometryProcessor> gp(new RectGeometryProcessor(localMatrix));
int instanceCount = fGeoData.count();
size_t vertexStride = gp->getVertexStride();
@@ -353,7 +353,7 @@ private:
verts += kVerticesPerQuad;
}
- helper.recordDraw(target, gp);
+ helper.recordDraw(target, gp.get());
}
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp
index 6427bc0844..e9bb7f4db4 100644
--- a/src/gpu/batches/GrAtlasTextBatch.cpp
+++ b/src/gpu/batches/GrAtlasTextBatch.cpp
@@ -173,8 +173,8 @@ void GrAtlasTextBatch::flush(GrVertexBatch::Target* target, FlushInfo* flushInfo
GrMesh mesh;
int maxGlyphsPerDraw =
static_cast<int>(flushInfo->fIndexBuffer->gpuMemorySize() / sizeof(uint16_t) / 6);
- mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer,
- flushInfo->fIndexBuffer, flushInfo->fVertexOffset,
+ mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer.get(),
+ flushInfo->fIndexBuffer.get(), flushInfo->fVertexOffset,
kVerticesPerGlyph, kIndicesPerGlyph, flushInfo->fGlyphsToFlush,
maxGlyphsPerDraw);
target->draw(flushInfo->fGeometryProcessor.get(), mesh);
diff --git a/src/gpu/batches/GrAtlasTextBatch.h b/src/gpu/batches/GrAtlasTextBatch.h
index 32771832aa..b3b88dfc23 100644
--- a/src/gpu/batches/GrAtlasTextBatch.h
+++ b/src/gpu/batches/GrAtlasTextBatch.h
@@ -104,11 +104,11 @@ private:
void initBatchTracker(const GrXPOverridesForBatch& overrides) override;
struct FlushInfo {
- SkAutoTUnref<const GrBuffer> fVertexBuffer;
- SkAutoTUnref<const GrBuffer> fIndexBuffer;
- sk_sp<GrGeometryProcessor> fGeometryProcessor;
- int fGlyphsToFlush;
- int fVertexOffset;
+ sk_sp<const GrBuffer> fVertexBuffer;
+ sk_sp<const GrBuffer> fIndexBuffer;
+ sk_sp<GrGeometryProcessor> fGeometryProcessor;
+ int fGlyphsToFlush;
+ int fVertexOffset;
};
void onPrepareDraws(Target* target) const override;
@@ -185,7 +185,7 @@ private:
GrBatchFontCache* fFontCache;
// Distance field properties
- SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
+ sk_sp<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
SkColor fFilteredColor;
bool fUseGammaCorrectDistanceTable;
diff --git a/src/gpu/batches/GrDashLinePathRenderer.cpp b/src/gpu/batches/GrDashLinePathRenderer.cpp
index ec4a51ede7..d1833d7192 100644
--- a/src/gpu/batches/GrDashLinePathRenderer.cpp
+++ b/src/gpu/batches/GrDashLinePathRenderer.cpp
@@ -39,11 +39,11 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
}
SkPoint pts[2];
SkAssertResult(args.fShape->asLine(pts, nullptr));
- SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fPaint->getColor(),
- *args.fViewMatrix,
- pts,
- aaMode,
- args.fShape->style()));
+ sk_sp<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fPaint->getColor(),
+ *args.fViewMatrix,
+ pts,
+ aaMode,
+ args.fShape->style()));
if (!batch) {
return false;
}
@@ -51,6 +51,6 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder pipelineBuilder(*args.fPaint, useHWAA);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch.get());
return true;
}
diff --git a/src/gpu/batches/GrDashLinePathRenderer.h b/src/gpu/batches/GrDashLinePathRenderer.h
index db2f87fdc3..482c1a024e 100644
--- a/src/gpu/batches/GrDashLinePathRenderer.h
+++ b/src/gpu/batches/GrDashLinePathRenderer.h
@@ -22,7 +22,7 @@ private:
bool onDrawPath(const DrawPathArgs&) override;
- SkAutoTUnref<GrGpu> fGpu;
+ sk_sp<GrGpu> fGpu;
typedef GrPathRenderer INHERITED;
};
diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp
index 6c677e7e00..2fbc90b102 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.cpp
+++ b/src/gpu/batches/GrDefaultPathRenderer.cpp
@@ -552,7 +552,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
}
const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
viewMatrix;
- SkAutoTUnref<GrDrawBatch> batch(
+ sk_sp<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
&localMatrix));
@@ -561,12 +561,12 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
pipelineBuilder.setDrawFace(drawFace[p]);
pipelineBuilder.setUserStencil(passes[p]);
- renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get());
} else {
- SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(), path,
- srcSpaceTol,
- newCoverage, viewMatrix,
- isHairline, devBounds));
+ sk_sp<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(), path,
+ srcSpaceTol,
+ newCoverage, viewMatrix,
+ isHairline, devBounds));
GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setDrawFace(drawFace[p]);
@@ -575,7 +575,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
pipelineBuilder.setDisableColorXPFactory();
}
- renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get());
}
}
return true;
diff --git a/src/gpu/batches/GrDrawPathBatch.cpp b/src/gpu/batches/GrDrawPathBatch.cpp
index 4080d2f0a1..6522fb5da0 100644
--- a/src/gpu/batches/GrDrawPathBatch.cpp
+++ b/src/gpu/batches/GrDrawPathBatch.cpp
@@ -29,9 +29,9 @@ SkString GrDrawPathBatch::dumpInfo() const {
void GrDrawPathBatch::onDraw(GrBatchFlushState* state, const SkRect& bounds) {
GrProgramDesc desc;
- SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(),
- this->overrides(),
- this->viewMatrix()));
+ sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(),
+ this->overrides(),
+ this->viewMatrix()));
state->gpu()->pathRendering()->drawPath(*this->pipeline(), *pathProc,
this->stencilPassSettings(), fPath.get());
}
@@ -127,10 +127,10 @@ void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state, const SkRect& bounds
localMatrix.setScale(fScale, fScale);
localMatrix.preTranslate(head.fX, head.fY);
- SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(),
- this->overrides(),
- drawMatrix,
- localMatrix));
+ sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(),
+ this->overrides(),
+ drawMatrix,
+ localMatrix));
if (fDraws.count() == 1) {
const InstanceData& instances = *head.fInstanceData;
diff --git a/src/gpu/batches/GrDrawPathBatch.h b/src/gpu/batches/GrDrawPathBatch.h
index 79b8b57549..3a46f46b2d 100644
--- a/src/gpu/batches/GrDrawPathBatch.h
+++ b/src/gpu/batches/GrDrawPathBatch.h
@@ -184,8 +184,8 @@ private:
fY = y;
}
- SkAutoTUnref<const InstanceData> fInstanceData;
- SkScalar fX, fY;
+ sk_sp<const InstanceData> fInstanceData;
+ SkScalar fX, fY;
};
typedef GrPendingIOResource<const GrPathRange, kRead_GrIOType> PendingPathRange;
diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp
index 85970825d5..0945c63faa 100644
--- a/src/gpu/batches/GrMSAAPathRenderer.cpp
+++ b/src/gpu/batches/GrMSAAPathRenderer.cpp
@@ -408,7 +408,7 @@ private:
}
if (quadVertexOffset) {
- SkAutoTUnref<const GrGeometryProcessor> quadGP(MSAAQuadProcessor::Create(fViewMatrix));
+ sk_sp<const GrGeometryProcessor> quadGP(MSAAQuadProcessor::Create(fViewMatrix));
SkASSERT(quadVertexStride == quadGP->getVertexStride());
const GrBuffer* quadVertexBuffer;
@@ -432,7 +432,7 @@ private:
quadMeshes.init(kTriangles_GrPrimitiveType, quadVertexBuffer, firstQuadVertex,
quadVertexOffset);
}
- target->draw(quadGP, quadMeshes);
+ target->draw(quadGP.get(), quadMeshes);
}
}
@@ -647,17 +647,17 @@ bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetCon
}
const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
viewMatrix;
- SkAutoTUnref<GrDrawBatch> batch(
+ sk_sp<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
&localMatrix));
GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(passes[p]);
- renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get());
} else {
- SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor(), path,
- viewMatrix, devBounds));
+ sk_sp<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor(), path,
+ viewMatrix, devBounds));
if (!batch->isValid()) {
return false;
}
@@ -668,7 +668,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetCon
pipelineBuilder.setDisableColorXPFactory();
}
- renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch.get());
}
}
return true;
diff --git a/src/gpu/batches/GrNinePatch.cpp b/src/gpu/batches/GrNinePatch.cpp
index 522e775c33..5e0be737ae 100644
--- a/src/gpu/batches/GrNinePatch.cpp
+++ b/src/gpu/batches/GrNinePatch.cpp
@@ -85,11 +85,10 @@ private:
numRects += fPatches[i].fIter->numRectsToDraw();
}
- SkAutoTUnref<const GrBuffer> indexBuffer(
- target->resourceProvider()->refQuadIndexBuffer());
+ sk_sp<const GrBuffer> indexBuffer(target->resourceProvider()->refQuadIndexBuffer());
InstancedHelper helper;
void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexStride,
- indexBuffer, kVertsPerRect,
+ indexBuffer.get(), kVertsPerRect,
kIndicesPerRect, numRects);
if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
diff --git a/src/gpu/batches/GrNonAAFillRectBatch.cpp b/src/gpu/batches/GrNonAAFillRectBatch.cpp
index 1422951d24..cc89d03870 100644
--- a/src/gpu/batches/GrNonAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrNonAAFillRectBatch.cpp
@@ -139,10 +139,10 @@ private:
size_t vertexStride = gp->getVertexStride();
int instanceCount = fRects.count();
- SkAutoTUnref<const GrBuffer> indexBuffer(target->resourceProvider()->refQuadIndexBuffer());
+ sk_sp<const GrBuffer> indexBuffer(target->resourceProvider()->refQuadIndexBuffer());
InstancedHelper helper;
void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexStride,
- indexBuffer, kVertsPerInstance,
+ indexBuffer.get(), kVertsPerInstance,
kIndicesPerInstance, instanceCount);
if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
diff --git a/src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp b/src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp
index aa5a4203cf..0652580aa2 100644
--- a/src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp
+++ b/src/gpu/batches/GrNonAAFillRectPerspectiveBatch.cpp
@@ -162,10 +162,10 @@ private:
size_t vertexStride = gp->getVertexStride();
int instanceCount = fRects.count();
- SkAutoTUnref<const GrBuffer> indexBuffer(target->resourceProvider()->refQuadIndexBuffer());
+ sk_sp<const GrBuffer> indexBuffer(target->resourceProvider()->refQuadIndexBuffer());
InstancedHelper helper;
void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexStride,
- indexBuffer, kVertsPerInstance,
+ indexBuffer.get(), kVertsPerInstance,
kIndicesPerInstance, instanceCount);
if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
diff --git a/src/gpu/batches/GrPLSPathRenderer.cpp b/src/gpu/batches/GrPLSPathRenderer.cpp
index 1c98f6ada2..e73f7f5722 100644
--- a/src/gpu/batches/GrPLSPathRenderer.cpp
+++ b/src/gpu/batches/GrPLSPathRenderer.cpp
@@ -807,9 +807,9 @@ public:
}
// Setup GrGeometryProcessors
- SkAutoTUnref<GrPLSGeometryProcessor> triangleProcessor(
+ sk_sp<GrPLSGeometryProcessor> triangleProcessor(
PLSAATriangleEffect::Create(invert, fUsesLocalCoords));
- SkAutoTUnref<GrPLSGeometryProcessor> quadProcessor(
+ sk_sp<GrPLSGeometryProcessor> quadProcessor(
PLSQuadEdgeEffect::Create(invert, fUsesLocalCoords));
GrResourceProvider* rp = target->resourceProvider();
@@ -857,7 +857,7 @@ public:
}
mesh.init(kTriangles_GrPrimitiveType, triVertexBuffer, firstTriVertex,
triVertices.count());
- target->draw(triangleProcessor, mesh);
+ target->draw(triangleProcessor.get(), mesh);
}
if (quadVertices.count()) {
@@ -875,10 +875,10 @@ public:
}
mesh.init(kTriangles_GrPrimitiveType, quadVertexBuffer, firstQuadVertex,
quadVertices.count());
- target->draw(quadProcessor, mesh);
+ target->draw(quadProcessor.get(), mesh);
}
- SkAutoTUnref<GrGeometryProcessor> finishProcessor(
+ sk_sp<GrGeometryProcessor> finishProcessor(
PLSFinishEffect::Create(fColor,
pathPtr->getFillType() ==
SkPath::FillType::kEvenOdd_FillType,
@@ -903,7 +903,7 @@ public:
mesh.init(kTriangles_GrPrimitiveType, rectVertexBuffer, firstRectVertex,
kRectVertexCount);
- target->draw(finishProcessor, mesh);
+ target->draw(finishProcessor.get(), mesh);
}
private:
@@ -927,14 +927,14 @@ bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPath path;
args.fShape->asPath(&path);
- SkAutoTUnref<GrDrawBatch> batch(new PLSPathBatch(args.fPaint->getColor(),
- path, *args.fViewMatrix));
+ sk_sp<GrDrawBatch> batch(new PLSPathBatch(args.fPaint->getColor(),
+ path, *args.fViewMatrix));
GrPipelineBuilder pipelineBuilder(*args.fPaint,
args.fRenderTargetContext->mustUseHWAA(*args.fPaint));
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch.get());
SkDEBUGCODE(inPLSDraw = false;)
return true;
diff --git a/src/gpu/batches/GrRegionBatch.cpp b/src/gpu/batches/GrRegionBatch.cpp
index 058baf0ef8..47b6f6777d 100644
--- a/src/gpu/batches/GrRegionBatch.cpp
+++ b/src/gpu/batches/GrRegionBatch.cpp
@@ -110,10 +110,11 @@ private:
}
size_t vertexStride = gp->getVertexStride();
- SkAutoTUnref<const GrBuffer> indexBuffer(target->resourceProvider()->refQuadIndexBuffer());
+ sk_sp<const GrBuffer> indexBuffer(target->resourceProvider()->refQuadIndexBuffer());
InstancedHelper helper;
void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexStride,
- indexBuffer, kVertsPerInstance, kIndicesPerInstance, numRects);
+ indexBuffer.get(), kVertsPerInstance, kIndicesPerInstance,
+ numRects);
if (!vertices || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
return;
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index b6bf940824..d660ab952d 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -82,8 +82,9 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
"GrStencilAndCoverPathRenderer::onStencilPath");
SkASSERT(!args.fIsAA || args.fRenderTargetContext->isStencilBufferMultisampled());
- SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
- args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fIsAA, *args.fViewMatrix, p);
+ sk_sp<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
+ args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fIsAA,
+ *args.fViewMatrix, p.get());
}
bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
@@ -96,7 +97,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
const SkMatrix& viewMatrix = *args.fViewMatrix;
- SkAutoTUnref<GrPath> path(get_gr_path(fResourceProvider, *args.fShape));
+ sk_sp<GrPath> path(get_gr_path(fResourceProvider, *args.fShape));
if (args.fShape->inverseFilled()) {
SkMatrix invert = SkMatrix::I();
@@ -119,13 +120,13 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix;
- SkAutoTUnref<GrDrawBatch> coverBatch(
+ sk_sp<GrDrawBatch> coverBatch(
GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), viewM, bounds,
nullptr, &invert));
// fake inverse with a stencil and cover
args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fPaint->isAntiAlias(),
- viewMatrix, path);
+ viewMatrix, path.get());
{
static constexpr GrUserStencilSettings kInvertedCoverPass(
@@ -146,7 +147,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
!args.fRenderTargetContext->hasMixedSamples());
pipelineBuilder.setUserStencil(&kInvertedCoverPass);
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, coverBatch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, coverBatch.get());
}
} else {
static constexpr GrUserStencilSettings kCoverPass(
@@ -159,8 +160,8 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
0xffff>()
);
- SkAutoTUnref<GrDrawBatch> batch(GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(),
- path));
+ sk_sp<GrDrawBatch> batch(GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(),
+ path.get()));
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);
@@ -169,7 +170,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag);
}
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch.get());
}
return true;
diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp
index b50cdb08bf..5260368890 100644
--- a/src/gpu/batches/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp
@@ -95,7 +95,7 @@ public:
}
GrBuffer* vertexBuffer() { return fVertexBuffer.get(); }
private:
- SkAutoTUnref<GrBuffer> fVertexBuffer;
+ sk_sp<GrBuffer> fVertexBuffer;
GrResourceProvider* fResourceProvider;
bool fCanMapVB;
void* fVertices;
@@ -217,7 +217,7 @@ private:
memset(&builder[shapeKeyDataCnt], 0, sizeof(fDevClipBounds));
}
builder.finish();
- SkAutoTUnref<GrBuffer> cachedVertexBuffer(rp->findAndRefTByUniqueKey<GrBuffer>(key));
+ sk_sp<GrBuffer> cachedVertexBuffer(rp->findAndRefTByUniqueKey<GrBuffer>(key));
int actualCount;
SkScalar tol = GrPathUtils::kDefaultTolerance;
tol = GrPathUtils::scaleToleranceToSrc(tol, fViewMatrix, fShape.bounds());
@@ -356,17 +356,17 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
args.fClip->getConservativeBounds(args.fRenderTargetContext->width(),
args.fRenderTargetContext->height(),
&clipBoundsI);
- SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fPaint->getColor(),
- *args.fShape,
- *args.fViewMatrix,
- clipBoundsI,
- args.fAntiAlias));
+ sk_sp<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fPaint->getColor(),
+ *args.fShape,
+ *args.fViewMatrix,
+ clipBoundsI,
+ args.fAntiAlias));
GrPipelineBuilder pipelineBuilder(*args.fPaint,
args.fRenderTargetContext->mustUseHWAA(*args.fPaint));
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch.get());
return true;
}
diff --git a/src/gpu/batches/GrVertexBatch.cpp b/src/gpu/batches/GrVertexBatch.cpp
index 2286342a94..14403bfe46 100644
--- a/src/gpu/batches/GrVertexBatch.cpp
+++ b/src/gpu/batches/GrVertexBatch.cpp
@@ -52,14 +52,15 @@ void GrVertexBatch::InstancedHelper::recordDraw(Target* target, const GrGeometry
void* GrVertexBatch::QuadHelper::init(Target* target, size_t vertexStride,
int quadsToDraw) {
- SkAutoTUnref<const GrBuffer> quadIndexBuffer(
+ sk_sp<const GrBuffer> quadIndexBuffer(
target->resourceProvider()->refQuadIndexBuffer());
if (!quadIndexBuffer) {
SkDebugf("Could not get quad index buffer.");
return nullptr;
}
return this->INHERITED::init(target, kTriangles_GrPrimitiveType, vertexStride,
- quadIndexBuffer, kVerticesPerQuad, kIndicesPerQuad, quadsToDraw);
+ quadIndexBuffer.get(), kVerticesPerQuad, kIndicesPerQuad,
+ quadsToDraw);
}
void GrVertexBatch::onDraw(GrBatchFlushState* state, const SkRect& bounds) {
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 8a112491f2..db70017586 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -197,7 +197,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
desc.fWidth = kSize;
desc.fHeight = kSize;
desc.fConfig = kConfig;
- SkAutoTUnref<GrTexture> dataTex(context->textureProvider()->createTexture(
+ sk_sp<GrTexture> dataTex(context->textureProvider()->createTexture(
desc, SkBudgeted::kYes, data, 0));
if (!dataTex.get()) {
return;
@@ -224,7 +224,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
GrPaint paint2;
GrPaint paint3;
sk_sp<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect(
- dataTex, GrSwizzle::RGBA(), *pmToUPMRule, SkMatrix::I()));
+ dataTex.get(), GrSwizzle::RGBA(), *pmToUPMRule, SkMatrix::I()));
sk_sp<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(
readRTC->asTexture().get(), GrSwizzle::RGBA(), *upmToPMRule, SkMatrix::I()));
sk_sp<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect(
diff --git a/src/gpu/gl/GrGLBuffer.cpp b/src/gpu/gl/GrGLBuffer.cpp
index 96226b9121..250c7119a9 100644
--- a/src/gpu/gl/GrGLBuffer.cpp
+++ b/src/gpu/gl/GrGLBuffer.cpp
@@ -30,7 +30,7 @@
GrGLBuffer* GrGLBuffer::Create(GrGLGpu* gpu, size_t size, GrBufferType intendedType,
GrAccessPattern accessPattern, const void* data) {
- SkAutoTUnref<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, accessPattern, data));
+ sk_sp<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, accessPattern, data));
if (0 == buffer->bufferID()) {
return nullptr;
}
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index 2126314a7b..5adba5a0f1 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -84,5 +84,5 @@ GrGLContextInfo::GrGLContextInfo(const ConstructorArgs& args) {
fDriver = args.fDriver;
fDriverVersion = args.fDriverVersion;
- fGLCaps.reset(new GrGLCaps(*args.fContextOptions, *this, fInterface));
+ fGLCaps = sk_make_sp<GrGLCaps>(*args.fContextOptions, *this, fInterface.get());
}
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index 8207ac89b0..0bf045a7db 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -35,7 +35,7 @@ public:
GrGLDriver driver() const { return fDriver; }
GrGLDriverVersion driverVersion() const { return fDriverVersion; }
const GrGLCaps* caps() const { return fGLCaps.get(); }
- GrGLCaps* caps() { return fGLCaps; }
+ GrGLCaps* caps() { return fGLCaps.get(); }
bool hasExtension(const char* ext) const {
return fInterface->hasExtension(ext);
}
@@ -58,14 +58,14 @@ protected:
GrGLContextInfo(const ConstructorArgs& args);
- SkAutoTUnref<const GrGLInterface> fInterface;
- GrGLVersion fGLVersion;
- GrGLSLGeneration fGLSLGeneration;
- GrGLVendor fVendor;
- GrGLRenderer fRenderer;
- GrGLDriver fDriver;
- GrGLDriverVersion fDriverVersion;
- SkAutoTUnref<GrGLCaps> fGLCaps;
+ sk_sp<const GrGLInterface> fInterface;
+ GrGLVersion fGLVersion;
+ GrGLSLGeneration fGLSLGeneration;
+ GrGLVendor fVendor;
+ GrGLRenderer fRenderer;
+ GrGLDriver fDriver;
+ GrGLDriverVersion fDriverVersion;
+ sk_sp<GrGLCaps> fGLCaps;
};
/**
@@ -79,7 +79,7 @@ public:
*/
static GrGLContext* Create(const GrGLInterface* interface, const GrContextOptions& options);
- const GrGLInterface* interface() const { return fInterface; }
+ const GrGLInterface* interface() const { return fInterface.get(); }
SkSL::Compiler* compiler() const;
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index 61f638b682..b41f826dfb 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -176,7 +176,7 @@ public:
void notifyAttachmentDeleteWhileBound(const FramebufferAttachment* deleted) {
for (auto& attachment : fAttachments) {
- if (attachment == deleted) {
+ if (attachment.get() == deleted) {
attachment.reset(nullptr);
}
}
@@ -206,7 +206,7 @@ private:
};
constexpr int static kNumAttachmentPoints = 1 + (int)AttachmentPoint::kColor;
- SkAutoTUnref<const FramebufferAttachment> fAttachments[kNumAttachmentPoints];
+ sk_sp<const FramebufferAttachment> fAttachments[kNumAttachmentPoints];
typedef GLObject INHERITED;
};
@@ -710,7 +710,7 @@ private:
GrGLuint fCurrGenericID;
GrGLuint fCurrUniformLocation;
GrGLuint fCurrPathID;
- SkAutoTUnref<const Texture> fSingleTextureObject;
+ sk_sp<const Texture> fSingleTextureObject;
SkTArray<const char*> fExtensions;
// the OpenGLES 2.0 spec says this must be >= 128
@@ -746,7 +746,7 @@ private:
if (!fSingleTextureObject) {
fSingleTextureObject.reset(new Texture);
}
- return fSingleTextureObject;
+ return fSingleTextureObject.get();
}
const GrGLubyte* CombinedExtensionString() {
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 9af3acc474..838ad5881f 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -173,7 +173,7 @@ bool GrGLGpu::BlendCoeffReferencesConstant(GrBlendCoeff coeff) {
GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions& options,
GrContext* context) {
- SkAutoTUnref<const GrGLInterface> glInterface(
+ sk_sp<const GrGLInterface> glInterface(
reinterpret_cast<const GrGLInterface*>(backendContext));
if (!glInterface) {
glInterface.reset(GrGLDefaultInterface());
@@ -183,7 +183,7 @@ GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions&
if (!glInterface) {
return nullptr;
}
- GrGLContext* glContext = GrGLContext::Create(glInterface, options);
+ GrGLContext* glContext = GrGLContext::Create(glInterface.get(), options);
if (glContext) {
return new GrGLGpu(glContext, context);
}
@@ -2022,8 +2022,7 @@ void GrGLGpu::flushMinSampleShading(float minSampleShading) {
bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcessor& primProc,
bool willDrawPoints) {
- SkAutoTUnref<GrGLProgram> program(fProgramCache->refProgram(this, pipeline, primProc,
- willDrawPoints));
+ sk_sp<GrGLProgram> program(fProgramCache->refProgram(this, pipeline, primProc, willDrawPoints));
if (!program) {
GrCapsDebugf(this->caps(), "Failed to create program!\n");
return false;
@@ -2307,8 +2306,7 @@ bool GrGLGpu::readPixelsSupported(GrPixelConfig rtConfig, GrPixelConfig readConf
desc.fConfig = rtConfig;
desc.fWidth = desc.fHeight = 16;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- SkAutoTUnref<GrTexture> temp(this->createTexture(desc,
- SkBudgeted::kNo));
+ sk_sp<GrTexture> temp(this->createTexture(desc, SkBudgeted::kNo));
if (!temp) {
return false;
}
@@ -2828,7 +2826,7 @@ void GrGLGpu::stampPLSSetupRect(const SkRect& bounds) {
this->fHWVertexArrayState.setVertexArrayID(this, 0);
GrGLAttribArrayState* attribs = this->fHWVertexArrayState.bindInternalVertexArray(this);
- attribs->set(this, 0, fPLSSetupProgram.fArrayBuffer, kVec2f_GrVertexAttribType,
+ attribs->set(this, 0, fPLSSetupProgram.fArrayBuffer.get(), kVec2f_GrVertexAttribType,
2 * sizeof(GrGLfloat), 0);
attribs->disableUnusedArrays(this, 0x1);
@@ -4125,8 +4123,8 @@ void GrGLGpu::drawDebugWireRect(GrRenderTarget* rt, const SkIRect& rect, GrColor
fHWVertexArrayState.setVertexArrayID(this, 0);
GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
- attribs->set(this, 0, fWireRectArrayBuffer, kVec2f_GrVertexAttribType, 2 * sizeof(GrGLfloat),
- 0);
+ attribs->set(this, 0, fWireRectArrayBuffer.get(), kVec2f_GrVertexAttribType,
+ 2 * sizeof(GrGLfloat), 0);
attribs->disableUnusedArrays(this, 0x1);
GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges));
@@ -4179,8 +4177,8 @@ bool GrGLGpu::copySurfaceAsDraw(GrSurface* dst,
fHWVertexArrayState.setVertexArrayID(this, 0);
GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
- attribs->set(this, 0, fCopyProgramArrayBuffer, kVec2f_GrVertexAttribType, 2 * sizeof(GrGLfloat),
- 0);
+ attribs->set(this, 0, fCopyProgramArrayBuffer.get(), kVec2f_GrVertexAttribType,
+ 2 * sizeof(GrGLfloat), 0);
attribs->disableUnusedArrays(this, 0x1);
// dst rect edges in NDC (-1 to 1)
@@ -4422,7 +4420,7 @@ bool GrGLGpu::generateMipmap(GrGLTexture* texture, bool gammaCorrect) {
fHWVertexArrayState.setVertexArrayID(this, 0);
GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
- attribs->set(this, 0, fMipmapProgramArrayBuffer, kVec2f_GrVertexAttribType,
+ attribs->set(this, 0, fMipmapProgramArrayBuffer.get(), kVec2f_GrVertexAttribType,
2 * sizeof(GrGLfloat), 0);
attribs->disableUnusedArrays(this, 0x1);
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 1b871186b6..32ce979c96 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -393,7 +393,7 @@ private:
// Must be called if bindSurfaceFBOForPixelOps was used to bind a surface for copying.
void unbindTextureFBOForPixelOps(GrGLenum fboTarget, GrSurface* surface);
- SkAutoTUnref<GrGLContext> fGLContext;
+ sk_sp<GrGLContext> fGLContext;
bool createCopyProgram(int progIdx);
bool createMipmapProgram(int progIdx);
@@ -596,7 +596,7 @@ private:
GrGLint fTexCoordXformUniform;
GrGLint fPosXformUniform;
} fCopyPrograms[3];
- SkAutoTUnref<GrGLBuffer> fCopyProgramArrayBuffer;
+ sk_sp<GrGLBuffer> fCopyProgramArrayBuffer;
/** IDs for texture mipmap program. (4 filter configurations) */
struct {
@@ -604,14 +604,14 @@ private:
GrGLint fTextureUniform;
GrGLint fTexCoordXformUniform;
} fMipmapPrograms[4];
- SkAutoTUnref<GrGLBuffer> fMipmapProgramArrayBuffer;
+ sk_sp<GrGLBuffer> fMipmapProgramArrayBuffer;
struct {
GrGLuint fProgram;
GrGLint fColorUniform;
GrGLint fRectUniform;
} fWireRectProgram;
- SkAutoTUnref<GrGLBuffer> fWireRectArrayBuffer;
+ sk_sp<GrGLBuffer> fWireRectArrayBuffer;
static int TextureTargetToCopyProgramIdx(GrGLenum target) {
switch (target) {
@@ -636,7 +636,7 @@ private:
struct {
GrGLuint fProgram;
GrGLint fPosXformUniform;
- SkAutoTUnref<GrGLBuffer> fArrayBuffer;
+ sk_sp<GrGLBuffer> fArrayBuffer;
} fPLSSetupProgram;
bool fHWPLSEnabled;
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index 260e256dbe..9bca80c1ec 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -26,8 +26,8 @@ struct GrGLGpu::ProgramCache::Entry {
Entry() : fProgram(nullptr), fLRUStamp(0) {}
- SkAutoTUnref<GrGLProgram> fProgram;
- unsigned int fLRUStamp;
+ sk_sp<GrGLProgram> fProgram;
+ unsigned int fLRUStamp;
};
struct GrGLGpu::ProgramCache::ProgDescLess {
diff --git a/src/gpu/instanced/GLInstancedRendering.h b/src/gpu/instanced/GLInstancedRendering.h
index ce1638c7fc..9ac2bfef3b 100644
--- a/src/gpu/instanced/GLInstancedRendering.h
+++ b/src/gpu/instanced/GLInstancedRendering.h
@@ -48,8 +48,8 @@ private:
};
GrGLuint fVertexArrayID;
- SkAutoTUnref<GrBuffer> fInstanceBuffer;
- SkAutoTUnref<GrBuffer> fDrawIndirectBuffer;
+ sk_sp<GrBuffer> fInstanceBuffer;
+ sk_sp<GrBuffer> fDrawIndirectBuffer;
SkAutoSTMalloc<1024, GLDrawCmdInfo> fGLDrawCmdsInfo;
uint32_t fInstanceAttribsBufferUniqueId;
int fInstanceAttribsBaseInstance;
diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp
index 5564c63d8d..30ec5ce0d2 100644
--- a/src/gpu/instanced/InstancedRendering.cpp
+++ b/src/gpu/instanced/InstancedRendering.cpp
@@ -435,14 +435,14 @@ void InstancedRendering::beginFlush(GrResourceProvider* rp) {
}
if (!fVertexBuffer) {
- fVertexBuffer.reset(InstanceProcessor::FindOrCreateVertexBuffer(fGpu));
+ fVertexBuffer.reset(InstanceProcessor::FindOrCreateVertexBuffer(fGpu.get()));
if (!fVertexBuffer) {
return;
}
}
if (!fIndexBuffer) {
- fIndexBuffer.reset(InstanceProcessor::FindOrCreateIndex8Buffer(fGpu));
+ fIndexBuffer.reset(InstanceProcessor::FindOrCreateIndex8Buffer(fGpu.get()));
if (!fIndexBuffer) {
return;
}
@@ -471,7 +471,7 @@ void InstancedRendering::Batch::onDraw(GrBatchFlushState* state, const SkRect& b
state->gpu()->xferBarrier(this->pipeline()->getRenderTarget(), barrierType);
}
- InstanceProcessor instProc(fInfo, fInstancedRendering->fParamsBuffer);
+ InstanceProcessor instProc(fInfo, fInstancedRendering->fParamsBuffer.get());
fInstancedRendering->onDraw(*this->pipeline(), instProc, this);
}
diff --git a/src/gpu/instanced/InstancedRendering.h b/src/gpu/instanced/InstancedRendering.h
index b71ca80c39..1325370a28 100644
--- a/src/gpu/instanced/InstancedRendering.h
+++ b/src/gpu/instanced/InstancedRendering.h
@@ -36,7 +36,7 @@ class InstancedRendering : public SkNoncopyable {
public:
virtual ~InstancedRendering() { SkASSERT(State::kRecordingDraws == fState); }
- GrGpu* gpu() const { return fGpu; }
+ GrGpu* gpu() const { return fGpu.get(); }
/**
* These methods make a new record internally for an instanced draw, and return a batch that is
@@ -147,8 +147,8 @@ protected:
InstancedRendering(GrGpu* gpu);
const BatchList& trackedBatches() const { return fTrackedBatches; }
- const GrBuffer* vertexBuffer() const { SkASSERT(fVertexBuffer); return fVertexBuffer; }
- const GrBuffer* indexBuffer() const { SkASSERT(fIndexBuffer); return fIndexBuffer; }
+ const GrBuffer* vertexBuffer() const { SkASSERT(fVertexBuffer); return fVertexBuffer.get(); }
+ const GrBuffer* indexBuffer() const { SkASSERT(fIndexBuffer); return fIndexBuffer.get(); }
virtual void onBeginFlush(GrResourceProvider*) = 0;
virtual void onDraw(const GrPipeline&, const InstanceProcessor&, const Batch*) = 0;
@@ -171,14 +171,14 @@ private:
virtual Batch* createBatch() = 0;
- const SkAutoTUnref<GrGpu> fGpu;
+ const sk_sp<GrGpu> fGpu;
State fState;
GrMemoryPool fDrawPool;
SkSTArray<1024, ParamsTexel, true> fParams;
BatchList fTrackedBatches;
- SkAutoTUnref<const GrBuffer> fVertexBuffer;
- SkAutoTUnref<const GrBuffer> fIndexBuffer;
- SkAutoTUnref<GrBuffer> fParamsBuffer;
+ sk_sp<const GrBuffer> fVertexBuffer;
+ sk_sp<const GrBuffer> fIndexBuffer;
+ sk_sp<GrBuffer> fParamsBuffer;
};
}
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index a28f638a2c..9c6fdf3581 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -65,7 +65,7 @@ SkGlyphCache* GrAtlasTextBlob::setupCache(int runIndex,
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 @@ void GrAtlasTextBlob::flushRun(GrRenderTargetContext* rtc, const GrPaint& grPain
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 @@ void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo
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 c8e200829a..f24147f8fd 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -452,7 +452,7 @@ private:
private:
GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken;
- SkAutoTUnref<GrBatchTextStrike> fStrike;
+ sk_sp<GrBatchTextStrike> fStrike;
SkMatrix fCurrentViewMatrix;
SkRect fVertexBounds;
uint64_t fAtlasGeneration;
@@ -477,7 +477,7 @@ private:
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 59df1fa81d..f0ccfc66df 100644
--- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
+++ b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
@@ -162,7 +162,7 @@ void GrAtlasTextBlob::regenInBatch(GrDrawBatch::Target* target,
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 1d6cef0bbf..76bdfc83cb 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -87,7 +87,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrRenderTargetContext*
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 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrRenderTargetContext*
// 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 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrRenderTargetContext*
} 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 @@ void GrAtlasTextContext::drawText(GrContext* context,
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 @@ void GrAtlasTextContext::drawPosText(GrContext* context,
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 @@ void GrAtlasTextContext::drawPosText(GrContext* context,
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 @@ DRAW_BATCH_TEST_DEFINE(TextBlobBatch) {
// 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 20da8be1d1..61af211a59 100644
--- a/src/gpu/text/GrAtlasTextContext.h
+++ b/src/gpu/text/GrAtlasTextContext.h
@@ -84,9 +84,9 @@ private:
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 b3a7eefccc..2022e456e6 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -619,7 +619,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
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 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
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 470e1e49c3..3cf4374e3a 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.h
+++ b/src/gpu/text/GrStencilAndCoverTextContext.h
@@ -104,7 +104,7 @@ private:
bool fUsingRawGlyphPaths;
GrUniqueKey fGlyphPathsKey;
int fTotalGlyphCount;
- SkAutoTUnref<InstanceData> fInstanceData;
+ sk_sp<InstanceData> fInstanceData;
int fFallbackGlyphCount;
sk_sp<SkTextBlob> fFallbackTextBlob;
mutable SkGlyphCache* fDetachedGlyphCache;
diff --git a/src/gpu/vk/GrVkCopyManager.cpp b/src/gpu/vk/GrVkCopyManager.cpp
index 68f7c317d1..636b650478 100644
--- a/src/gpu/vk/GrVkCopyManager.cpp
+++ b/src/gpu/vk/GrVkCopyManager.cpp
@@ -354,7 +354,7 @@ bool GrVkCopyManager::copySurfaceAsDraw(GrVkGpu* gpu,
scissor.offset.y = 0;
cmdBuffer->setScissor(gpu, 0, 1, &scissor);
- cmdBuffer->bindVertexBuffer(gpu, fVertexBuffer);
+ cmdBuffer->bindVertexBuffer(gpu, fVertexBuffer.get());
cmdBuffer->draw(gpu, 4, 1, 0, 0);
cmdBuffer->endRenderPass(gpu);
diff --git a/src/gpu/vk/GrVkCopyManager.h b/src/gpu/vk/GrVkCopyManager.h
index e19a14402d..3a92d58bda 100644
--- a/src/gpu/vk/GrVkCopyManager.h
+++ b/src/gpu/vk/GrVkCopyManager.h
@@ -48,8 +48,8 @@ private:
GrVkDescriptorSetManager::Handle fSamplerDSHandle;
VkPipelineLayout fPipelineLayout;
- SkAutoTUnref<GrVkVertexBuffer> fVertexBuffer;
- GrVkUniformBuffer* fUniformBuffer;
+ sk_sp<GrVkVertexBuffer> fVertexBuffer;
+ GrVkUniformBuffer* fUniformBuffer;
};
#endif
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 50f7471fe6..dd1eaa15a7 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -255,8 +255,8 @@ private:
const SkIRect& srcRect,
const SkIPoint& dstPoint);
- SkAutoTUnref<const GrVkBackendContext> fBackendContext;
- SkAutoTUnref<GrVkCaps> fVkCaps;
+ sk_sp<const GrVkBackendContext> fBackendContext;
+ sk_sp<GrVkCaps> fVkCaps;
// These Vulkan objects are provided by the client, and also stored in fBackendContext.
// They're copied here for convenient access.