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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 1276713002: SkSurface copy-on-write can yield stale GPU render targets. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: comment type Created 5 years, 4 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
« no previous file with comments | « no previous file | tests/SurfaceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface_Gpu.cpp
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index dbe82f8c9f1110f890aca581922417f86c43fc3b..f0719d895a03b1e9a675b2820094a81e7af6178d 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -28,7 +28,6 @@ SkSurface_Gpu::~SkSurface_Gpu() {
static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface,
SkSurface::BackendHandleAccess access) {
- GrRenderTarget* rt = surface->getDevice()->accessRenderTarget();
switch (access) {
case SkSurface::kFlushRead_BackendHandleAccess:
break;
@@ -40,6 +39,9 @@ static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface,
surface->getDevice()->accessBitmap(false).notifyPixelsChanged();
break;
}
+
+ // 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;
}
« no previous file with comments | « no previous file | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698