Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: src/gpu/GrContext.cpp

Issue 1918003003: Bring sk_sp to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index c223a602132743d9a7baffcdb98c94e6cd39cee2..5ebb2e95fbf62c478db804e0e1254827a37e5689 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -362,7 +362,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
}
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top));
- SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(renderTarget));
+ sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(renderTarget)));
if (!drawContext) {
return false;
}
@@ -484,7 +484,8 @@ bool GrContext::readSurfacePixels(GrSurface* src,
paint.addColorFragmentProcessor(fp);
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
- SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(temp->asRenderTarget()));
+ sk_sp<GrDrawContext> drawContext(
+ this->drawContext(sk_ref_sp(temp->asRenderTarget())));
drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect, nullptr);
surfaceToRead.reset(SkRef(temp.get()));
left = 0;
@@ -569,7 +570,7 @@ bool GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
src->flushWrites();
return fGpu->copySurface(dst, src, clippedSrcRect, clippedDstPoint);
}
- SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(dst->asRenderTarget()));
+ sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst->asRenderTarget())));
if (!drawContext) {
return false;
}
@@ -608,9 +609,10 @@ int GrContext::getRecommendedSampleCount(GrPixelConfig config,
}
-GrDrawContext* GrContext::drawContext(GrRenderTarget* rt, const SkSurfaceProps* surfaceProps) {
+sk_sp<GrDrawContext> GrContext::drawContext(sk_sp<GrRenderTarget> rt,
+ const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER
- return fDrawingManager->drawContext(rt, surfaceProps);
+ return fDrawingManager->drawContext(std::move(rt), surfaceProps);
}
bool GrContext::abandoned() const {

Powered by Google App Engine
This is Rietveld 408576698