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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 2167723002: Remove SkDevice::accessRenderTarget virtual (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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/image/SkSurface_Gpu.cpp
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 5b4bfafb16fe683b27374ab099f09828406fd584..5d1555f32364a04d3ea6223336dbd1d8bbbd955a 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -40,9 +40,9 @@ static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface,
}
// Grab the render target *after* firing notifications, as it may get switched if CoW kicks in.
- GrRenderTarget* rt = surface->getDevice()->accessRenderTarget();
- rt->prepareForExternalIO();
- return rt;
+ surface->getDevice()->flush();
+ GrDrawContext* dc = surface->getDevice()->accessDrawContext();
+ return dc->accessRenderTarget();
}
GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) {
@@ -76,7 +76,7 @@ sk_sp<SkSurface> SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
}
sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted, ForceCopyMode forceCopyMode) {
- GrRenderTarget* rt = fDevice->accessRenderTarget();
+ GrRenderTarget* rt = fDevice->accessDrawContext()->accessRenderTarget();
SkASSERT(rt);
GrTexture* tex = rt->asTexture();
SkAutoTUnref<GrTexture> copy;
@@ -109,7 +109,7 @@ sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted, ForceCopyM
// render target into it. Note that this flushes the SkGpuDevice but
// doesn't force an OpenGL flush.
void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
- GrRenderTarget* rt = fDevice->accessRenderTarget();
+ GrRenderTarget* rt = fDevice->accessDrawContext()->accessRenderTarget();
// are we sharing our render target with the image? Note this call should never create a new
// image because onCopyOnWrite is only called when there is a cached image.
sk_sp<SkImage> image(this->refCachedImage(SkBudgeted::kNo, kNo_ForceUnique));
@@ -127,7 +127,7 @@ void SkSurface_Gpu::onDiscard() {
}
void SkSurface_Gpu::onPrepareForExternalIO() {
- fDevice->accessRenderTarget()->prepareForExternalIO();
+ fDevice->flush();
}
///////////////////////////////////////////////////////////////////////////////
« include/core/SkDevice.h ('K') | « src/image/SkImage_Gpu.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698