Chromium Code Reviews| Index: src/image/SkSurface_Gpu.cpp |
| diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp |
| index 746bb066534699ce7639e7a47a90208af63a00ce..fe3198bf4212dac4fd4d22d45b12c90baae76e22 100644 |
| --- a/src/image/SkSurface_Gpu.cpp |
| +++ b/src/image/SkSurface_Gpu.cpp |
| @@ -72,19 +72,17 @@ 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()); |
| - |
| + SkGpuDevice* newDevice = static_cast<SkGpuDevice*>( |
|
reed1
2014/03/04 22:01:05
LEts add a comment that we use createCompatible in
bsalomon
2014/03/04 22:22:13
Done.
|
| + 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); |
| } |
| } |