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

Unified Diff: src/core/SkPicture.cpp

Issue 1671193002: Make SkPicture/SkImageGenerator default to SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move ImageGenerator impl into ktx code to share with nanobench Created 4 years, 10 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 | « public.bzl ('k') | src/images/SkImageDecoder_ktx.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicture.cpp
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 8247336d49e96d3d7698dbb8bdaf61a1a9498b41..04f2f93ba73ea3270e43aa4e77c4502f9538081a 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -6,6 +6,7 @@
*/
#include "SkAtomics.h"
+#include "SkImageGenerator.h"
#include "SkMessageBus.h"
#include "SkPicture.h"
#include "SkPictureData.h"
@@ -138,6 +139,16 @@ SkPicture* SkPicture::Forwardport(const SkPictInfo& info, const SkPictureData* d
return r.endRecording();
}
+static bool default_install(const void* src, size_t length, SkBitmap* dst) {
+ SkAutoTUnref<SkData> encoded(SkData::NewWithCopy(src, length));
+ return encoded && SkDEPRECATED_InstallDiscardablePixelRef(
+ SkImageGenerator::NewFromEncoded(encoded), dst);
+}
+
+SkPicture* SkPicture::CreateFromStream(SkStream* stream) {
+ return CreateFromStream(stream, &default_install, nullptr);
+}
+
SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc proc) {
return CreateFromStream(stream, proc, nullptr);
}
« no previous file with comments | « public.bzl ('k') | src/images/SkImageDecoder_ktx.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698