diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-06 22:03:17 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-06 22:03:17 +0000 |
commit | 70ac79b754aa6416a2bf7995792eaf07801dd76c (patch) | |
tree | 19211a8bbc60885e676709aee79c7322860570b1 /src | |
parent | ace135453db02cfe83d7c7bbeaa679f98d18fbe2 (diff) |
use new instead of createCompatibleDevice, since we know the subclass we want
BUG=skia:
R=bsalomon@google.com
Review URL: https://codereview.chromium.org/141443009
git-svn-id: http://skia.googlecode.com/svn/trunk@13353 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 719b0c0653..5350fe9c07 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -85,10 +85,10 @@ 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())) { - SkGpuDevice* newDevice = static_cast<SkGpuDevice*>( - fDevice->createCompatibleDevice(fDevice->config(), fDevice->width(), - fDevice->height(), fDevice->isOpaque())); - SkAutoTUnref<SkGpuDevice> aurd(newDevice); + SkAutoTUnref<SkGpuDevice> newDevice(SkNEW_ARGS(SkGpuDevice, + (fDevice->context(), fDevice->config(), fDevice->width(), + fDevice->height(), rt->numSamples()))); + if (kRetain_ContentChangeMode == mode) { fDevice->context()->copyTexture(rt->asTexture(), reinterpret_cast<GrRenderTarget*>(newDevice->accessRenderTarget())); @@ -96,7 +96,7 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { SkASSERT(NULL != this->getCachedCanvas()); SkASSERT(this->getCachedCanvas()->getDevice() == fDevice); this->getCachedCanvas()->setDevice(newDevice); - SkRefCnt_SafeAssign(fDevice, newDevice); + SkRefCnt_SafeAssign(fDevice, newDevice.get()); } } |