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

Unified Diff: src/ports/SkImageDecoder_WIC.cpp

Issue 14298010: Updates to images project. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Name changes Created 7 years, 8 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 | « src/ports/SkImageDecoder_CG.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkImageDecoder_WIC.cpp
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index 4b869dd3280b85d3a454b32b7a652009c276ea3d..17d75ccaca93d972437f1b7397370698b3ca3f16 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -154,8 +154,16 @@ bool SkImageDecoder_WIC::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
/////////////////////////////////////////////////////////////////////////
+extern SkImageDecoder* image_decoder_from_stream(SkStream*);
+
SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
- return SkNEW(SkImageDecoder_WIC);
+ SkImageDecoder* decoder = image_decoder_from_stream(stream);
+ if (NULL == decoder) {
+ // If no image decoder specific to the stream exists, use SkImageDecoder_WIC.
+ return SkNEW(SkImageDecoder_WIC);
+ } else {
+ return decoder;
+ }
}
/////////////////////////////////////////////////////////////////////////
@@ -183,6 +191,15 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
{
GUID type;
switch (fType) {
+ case kBMP_Type:
+ type = GUID_ContainerFormatBmp;
+ break;
+ case kGIF_Type:
+ type = GUID_ContainerFormatGif;
+ break;
+ case kICO_Type:
+ type = GUID_ContainerFormatIco;
+ break;
case kJPEG_Type:
type = GUID_ContainerFormatJpeg;
break;
@@ -324,13 +341,22 @@ bool SkImageEncoder_WIC::onEncode(SkWStream* stream
return SUCCEEDED(hr);
}
-SkImageEncoder* SkImageEncoder::Create(Type t) {
+///////////////////////////////////////////////////////////////////////////////
+
+#include "SkTRegistry.h"
+
+static SkImageEncoder* sk_imageencoder_wic_factory(SkImageEncoder::Type t) {
switch (t) {
- case kJPEG_Type:
- case kPNG_Type:
+ case SkImageEncoder::kBMP_Type:
+ case SkImageEncoder::kGIF_Type:
+ case SkImageEncoder::kICO_Type:
+ case SkImageEncoder::kJPEG_Type:
+ case SkImageEncoder::kPNG_Type:
break;
default:
return NULL;
}
return SkNEW_ARGS(SkImageEncoder_WIC, (t));
}
+
+static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_imageencoder_wic_factory);
« no previous file with comments | « src/ports/SkImageDecoder_CG.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698