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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 1121813002: new image from backend desc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: set samplecount to 0 (for now) Created 5 years, 7 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 | « src/image/SkImage_Gpu.cpp ('k') | tests/SurfaceTest.cpp » ('j') | 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 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) {
« no previous file with comments | « src/image/SkImage_Gpu.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698