| Index: src/image/SkSurface_Gpu.cpp
|
| diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
|
| index a1c31f31379ad022735e69dd5a64636f6149fca4..b94e4e30bd07f7a097a94a151a06b9558329476b 100644
|
| --- a/src/image/SkSurface_Gpu.cpp
|
| +++ b/src/image/SkSurface_Gpu.cpp
|
| @@ -7,7 +7,6 @@
|
|
|
| #include "SkSurface_Gpu.h"
|
|
|
| -#include "GrGpuResourcePriv.h"
|
| #include "SkCanvas.h"
|
| #include "SkGpuDevice.h"
|
| #include "SkImage_Base.h"
|
| @@ -24,7 +23,7 @@ SkSurface_Gpu::SkSurface_Gpu(SkGpuDevice* device)
|
| }
|
|
|
| SkSurface_Gpu::~SkSurface_Gpu() {
|
| - SkSafeUnref(fDevice);
|
| + fDevice->unref();
|
| }
|
|
|
| SkCanvas* SkSurface_Gpu::onNewCanvas() {
|
| @@ -59,8 +58,8 @@ void SkSurface_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
|
| canvas->drawBitmap(fDevice->accessBitmap(false), x, y, paint);
|
| }
|
|
|
| -// Create a new SkGpuDevice and, if necessary, copy the contents of the old
|
| -// device into it. Note that this flushes the SkGpuDevice but
|
| +// Create a new render target and, if necessary, copy the contents of the old
|
| +// 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();
|
| @@ -69,22 +68,7 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
|
| SkImage* image = this->getCachedImage(kNo_Budgeted);
|
| SkASSERT(image);
|
| if (rt->asTexture() == SkTextureImageGetTexture(image)) {
|
| - GrRenderTarget* oldRT = this->fDevice->accessRenderTarget();
|
| - SkSurface::Budgeted budgeted = oldRT->resourcePriv().isBudgeted() ? kYes_Budgeted :
|
| - kNo_Budgeted;
|
| - SkAutoTUnref<SkGpuDevice> newDevice(
|
| - SkGpuDevice::Create(oldRT->getContext(), budgeted, fDevice->imageInfo(),
|
| - oldRT->numSamples(), &this->props(), 0));
|
| - if (kRetain_ContentChangeMode == mode && !oldRT->wasDestroyed() && newDevice) {
|
| - oldRT->getContext()->copySurface(newDevice->accessRenderTarget(), oldRT);
|
| - }
|
| -
|
| - SkASSERT(this->getCachedCanvas());
|
| - SkASSERT(this->getCachedCanvas()->getDevice() == fDevice);
|
| -
|
| - this->getCachedCanvas()->setRootDevice(newDevice);
|
| - SkRefCnt_SafeAssign(fDevice, newDevice.get());
|
| -
|
| + this->fDevice->replaceRenderTarget(SkSurface::kRetain_ContentChangeMode == mode);
|
| SkTextureImageApplyBudgetedDecision(image);
|
| } else if (kDiscard_ContentChangeMode == mode) {
|
| this->SkSurface_Gpu::onDiscard();
|
|
|