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

Unified Diff: src/image/SkImagePriv.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/SkImagePriv.h ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImagePriv.cpp
diff --git a/src/image/SkImagePriv.cpp b/src/image/SkImagePriv.cpp
index bde47e71eba07853b720d75be2ce6bae779d5cf8..ad7b154e7657f351b92bc7f1d453f452c5fb7e8a 100644
--- a/src/image/SkImagePriv.cpp
+++ b/src/image/SkImagePriv.cpp
@@ -6,10 +6,12 @@
*/
#include "SkImagePriv.h"
+#include "SkImage_Base.h"
#include "SkCanvas.h"
#include "SkPicture.h"
-SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) {
+SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef,
+ const SkSurfaceProps* props) {
const SkImageInfo info = bm.info();
if (kUnknown_SkColorType == info.colorType()) {
return NULL;
@@ -17,13 +19,18 @@ SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) {
SkImage* image = NULL;
if (canSharePixelRef || bm.isImmutable()) {
- image = SkNewImageFromPixelRef(info, bm.pixelRef(), bm.rowBytes());
+ image = SkNewImageFromPixelRef(info, bm.pixelRef(), bm.rowBytes(), props);
} else {
bm.lockPixels();
if (bm.getPixels()) {
image = SkImage::NewRasterCopy(info, bm.getPixels(), bm.rowBytes());
}
bm.unlockPixels();
+
+ // we don't expose props to NewRasterCopy (need a private vers) so post-init it here
+ if (image && props) {
+ as_IB(image)->initWithProps(*props);
+ }
}
return image;
}
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkImage_Base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698