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

Unified Diff: src/image/SkImage.cpp

Issue 834633006: add ImageGenerator::NewFromData to porting layer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add helper for SkInstallDiscardablePixelRef(SkData*, ...) Created 5 years, 11 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
Index: src/image/SkImage.cpp
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 8796b0328355f1c5049ee0151454197c74acbc57..97e7475a34ff28dc49b6499d5ecaef86c3c8d7fa 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -7,6 +7,7 @@
#include "SkBitmap.h"
#include "SkCanvas.h"
+#include "SkImageGenerator.h"
#include "SkImagePriv.h"
#include "SkImage_Base.h"
#include "SkReadPixelsRec.h"
@@ -72,6 +73,14 @@ SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const {
return NULL;
}
+SkImage* SkImage::NewFromData(SkData* data) {
+ if (NULL == data) {
+ return NULL;
+ }
+ SkImageGenerator* generator = SkImageGenerator::NewFromData(data);
+ return generator ? SkImage::NewFromGenerator(generator) : NULL;
+}
+
SkSurface* SkImage::newSurface(const SkImageInfo& info, const SkSurfaceProps* props) const {
if (NULL == props) {
props = &as_IB(this)->props();

Powered by Google App Engine
This is Rietveld 408576698