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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 741763002: add SkImage::newSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another warning fix Created 6 years, 1 month 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/SkSurface.cpp ('k') | src/image/SkSurface_Raster.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 d777e3a99120c431cebb18decfa9bb090ac5970b..9ac6d553404e06d3032356571ff3837f50af192c 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -7,6 +7,7 @@
#include "SkSurface_Base.h"
#include "SkImagePriv.h"
+#include "SkImage_Base.h"
#include "SkCanvas.h"
#include "SkGpuDevice.h"
@@ -66,7 +67,12 @@ SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
}
SkImage* SkSurface_Gpu::onNewImageSnapshot() {
- return SkImage::NewTexture(fDevice->accessBitmap(false));
+ const int sampleCount = fDevice->accessRenderTarget()->numSamples();
+ SkImage* image = SkNewImageFromBitmapTexture(fDevice->accessBitmap(false), sampleCount);
+ if (image) {
+ as_IB(image)->initWithProps(this->props());
+ }
+ return image;
}
void SkSurface_Gpu::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
« no previous file with comments | « src/image/SkSurface.cpp ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698