Index: src/image/SkSurface_Gpu.cpp |
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp |
index 8788e08cd4ee649abe53f0ae695a8357a2036549..fa5daec2696b34d6f6ae4b5570ca2c472e8e9f95 100644 |
--- a/src/image/SkSurface_Gpu.cpp |
+++ b/src/image/SkSurface_Gpu.cpp |
@@ -10,6 +10,7 @@ |
#include "SkCanvas.h" |
#include "SkGpuDevice.h" |
#include "SkImage_Base.h" |
+#include "SkImage_Gpu.h" |
#include "SkImagePriv.h" |
#include "SkSurface_Base.h" |
@@ -44,9 +45,15 @@ SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) { |
} |
SkImage* SkSurface_Gpu::onNewImageSnapshot(Budgeted budgeted) { |
+ const SkImageInfo info = fDevice->imageInfo(); |
const int sampleCount = fDevice->accessRenderTarget()->numSamples(); |
- SkImage* image = SkNewImageFromBitmapTexture(fDevice->accessBitmap(false), sampleCount, |
- budgeted); |
+ SkImage* image = NULL; |
+ GrTexture* tex = fDevice->accessRenderTarget()->asTexture(); |
+ if (tex) { |
+ image = SkNEW_ARGS(SkImage_Gpu, |
+ (info.width(), info.height(), info.alphaType(), |
+ tex, sampleCount, budgeted)); |
+ } |
if (image) { |
as_IB(image)->initWithProps(this->props()); |
} |
@@ -67,7 +74,7 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) { |
// image because onCopyOnWrite is only called when there is a cached image. |
SkImage* image = this->getCachedImage(kNo_Budgeted); |
SkASSERT(image); |
- if (rt->asTexture() == SkTextureImageGetTexture(image)) { |
+ if (rt->asTexture() == image->getTexture()) { |
this->fDevice->replaceRenderTarget(SkSurface::kRetain_ContentChangeMode == mode); |
SkTextureImageApplyBudgetedDecision(image); |
} else if (kDiscard_ContentChangeMode == mode) { |