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

Unified Diff: src/codec/SkCodec.cpp

Issue 947283002: Bmp Image Decoding (Closed) Base URL: https://skia.googlesource.com/skia.git@decode-leon-3
Patch Set: Moved bmp specific code out of the swizzler Created 5 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
Index: src/codec/SkCodec.cpp
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index 69d95a41da24be0231cdd32b8719d2b1d6ea3747..75c0ca1244c308d6b9f84ddfd315c295808477f3 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -7,6 +7,7 @@
#include "SkCodec.h"
#include "SkData.h"
+#include "SkCodec_libbmp.h"
#include "SkCodec_libpng.h"
#include "SkStream.h"
@@ -15,6 +16,14 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream) {
return NULL;
}
SkAutoTDelete<SkStream> streamDeleter(stream);
+ const bool isBmp = SkBmpCodec::IsBmp(stream);
+ if (!stream->rewind()) {
+ return NULL;
+ }
+ if (isBmp) {
+ streamDeleter.detach();
+ return SkBmpCodec::NewFromStream(stream);
+ }
const bool isPng = SkPngCodec::IsPng(stream);
scroggo 2015/03/06 18:56:12 nit: PNG should be first, since we'll see more PNG
if (!stream->rewind()) {
return NULL;
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkCodec_libbmp.h » ('j') | src/codec/SkCodec_libbmp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698