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

Unified Diff: src/codec/SkCodec_wbmp.cpp

Issue 1472123002: Make SkCodec support peek() and read() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 5 years 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/codec/SkCodec_wbmp.h ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodec_wbmp.cpp
diff --git a/src/codec/SkCodec_wbmp.cpp b/src/codec/SkCodec_wbmp.cpp
index 8f8763fb90e0f0256506c12e82c54c04ab570ce2..d734ad3a624e7cc3a1e50816b98d587bafc03615 100644
--- a/src/codec/SkCodec_wbmp.cpp
+++ b/src/codec/SkCodec_wbmp.cpp
@@ -9,6 +9,7 @@
#include "SkCodecPriv.h"
#include "SkColorPriv.h"
#include "SkColorTable.h"
+#include "SkData.h"
#include "SkStream.h"
#include "SkCodec_wbmp.h"
@@ -151,8 +152,10 @@ SkCodec::Result SkWbmpCodec::onGetPixels(const SkImageInfo& info,
return kSuccess;
}
-bool SkWbmpCodec::IsWbmp(SkStream* stream) {
- return read_header(stream, nullptr);
+bool SkWbmpCodec::IsWbmp(const void* buffer, size_t bytesRead) {
+ SkAutoTUnref<SkData> data(SkData::NewWithoutCopy(buffer, bytesRead));
+ SkMemoryStream stream(data);
+ return read_header(&stream, nullptr);
}
SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) {
« no previous file with comments | « src/codec/SkCodec_wbmp.h ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698