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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 187023002: Manual revert of https://code.google.com/p/skia/source/detail?r=13353 due to perf regression. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add comment Created 6 years, 10 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 | no next file » | 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 746bb066534699ce7639e7a47a90208af63a00ce..ae05ea8c04609369fcef5279b53fe4c4c630319f 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -72,19 +72,20 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
// are we sharing our render target with the image?
SkASSERT(NULL != this->getCachedImage());
if (rt->asTexture() == SkTextureImageGetTexture(this->getCachedImage())) {
- SkAutoTUnref<SkGpuDevice> newDevice(SkGpuDevice::Create(fDevice->context(),
- fDevice->imageInfo(),
- rt->numSamples()));
- SkASSERT(newDevice.get());
-
+ // We call createCompatibleDevice because it uses the texture cache. This isn't
+ // necessarily correct (http://skbug.com/2252), but never using the cache causes
+ // a Chromium regression. (http://crbug.com/344020)
+ SkGpuDevice* newDevice = static_cast<SkGpuDevice*>(
+ fDevice->createCompatibleDevice(fDevice->imageInfo()));
+ SkAutoTUnref<SkGpuDevice> aurd(newDevice);
if (kRetain_ContentChangeMode == mode) {
- fDevice->context()->copyTexture(rt->asTexture(),
- reinterpret_cast<GrRenderTarget*>(newDevice->accessRenderTarget()));
+ fDevice->context()->copyTexture(rt->asTexture(), newDevice->accessRenderTarget());
}
SkASSERT(NULL != this->getCachedCanvas());
SkASSERT(this->getCachedCanvas()->getDevice() == fDevice);
+
this->getCachedCanvas()->setRootDevice(newDevice);
- SkRefCnt_SafeAssign(fDevice, newDevice.get());
+ SkRefCnt_SafeAssign(fDevice, newDevice);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698