src/gpu: s/SkAutoTUnref/sk_sp/g

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4527

Change-Id: I23f0548f98e7c355da05e143e8baa330d4bc04cc
Reviewed-on: https://skia-review.googlesource.com/4527
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2016-11-07 17:57:18 -05:00 committed by Skia Commit-Bot
parent ad48a70e99
commit 144caf55ff
62 changed files with 392 additions and 393 deletions

View File

@ -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());

View File

@ -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;
};

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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);
}

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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());
}

View File

@ -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,

View File

@ -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);
}

View File

@ -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));

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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");

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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");

View File

@ -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 {

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -22,7 +22,7 @@ private:
bool onDrawPath(const DrawPathArgs&) override;
SkAutoTUnref<GrGpu> fGpu;
sk_sp<GrGpu> fGpu;
typedef GrPathRenderer INHERITED;
};

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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(

View File

@ -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;
}

View File

@ -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());
}

View File

@ -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;

View File

@ -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() {

View File

@ -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);

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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);
}

View File

@ -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;
};
}

View File

@ -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());
}

View File

@ -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;

View File

@ -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) {

View File

@ -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,

View File

@ -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 =

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -48,8 +48,8 @@ private:
GrVkDescriptorSetManager::Handle fSamplerDSHandle;
VkPipelineLayout fPipelineLayout;
SkAutoTUnref<GrVkVertexBuffer> fVertexBuffer;
GrVkUniformBuffer* fUniformBuffer;
sk_sp<GrVkVertexBuffer> fVertexBuffer;
GrVkUniformBuffer* fUniformBuffer;
};
#endif

View File

@ -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.