summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-26 01:32:15 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-26 01:32:15 +0000
commiteef27c614102a234c25ce78b2d403ed8f2169a64 (patch)
tree19bd6577e6bcf6655633dd03ad4570e503772f57
parent1e7bd84eb9dcf5cc1840613fae20f71f5f8024e4 (diff)
downloadchromium_src-eef27c614102a234c25ce78b2d403ed8f2169a64.zip
chromium_src-eef27c614102a234c25ce78b2d403ed8f2169a64.tar.gz
chromium_src-eef27c614102a234c25ce78b2d403ed8f2169a64.tar.bz2
Windows doesn't like zero-length arrays.
Review URL: http://codereview.chromium.org/16267 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7476 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--skia/ports/SkImageDecoder_Factory.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/skia/ports/SkImageDecoder_Factory.cpp b/skia/ports/SkImageDecoder_Factory.cpp
index 585957c..bc4e7b2 100644
--- a/skia/ports/SkImageDecoder_Factory.cpp
+++ b/skia/ports/SkImageDecoder_Factory.cpp
@@ -33,18 +33,19 @@ struct CodecFormat {
SkImageDecoder::Format fFormat;
};
-static const CodecFormat gPairs[] = {
#ifdef SK_SUPPORT_IMAGE_DECODE
+static const CodecFormat gPairs[] = {
{ SkImageDecoder_GIF_Factory, SkImageDecoder::kGIF_Format },
{ SkImageDecoder_PNG_Factory, SkImageDecoder::kPNG_Format },
{ SkImageDecoder_ICO_Factory, SkImageDecoder::kICO_Format },
{ SkImageDecoder_WBMP_Factory, SkImageDecoder::kWBMP_Format },
{ SkImageDecoder_BMP_Factory, SkImageDecoder::kBMP_Format },
{ SkImageDecoder_JPEG_Factory, SkImageDecoder::kJPEG_Format }
-#endif
};
+#endif
SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
+#ifdef SK_SUPPORT_IMAGE_DECODE
for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) {
SkImageDecoder* codec = gPairs[i].fProc(stream);
stream->rewind();
@@ -52,15 +53,18 @@ SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
return codec;
}
}
+#endif
return NULL;
}
bool SkImageDecoder::SupportsFormat(Format format) {
+#ifdef SK_SUPPORT_IMAGE_DECODE
for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) {
if (gPairs[i].fFormat == format) {
return true;
}
}
+#endif
return false;
}
@@ -74,19 +78,18 @@ typedef SkMovie* (*SkMovieMemoryProc)(const void*, size_t);
extern SkMovie* SkMovie_GIF_StreamFactory(SkStream*);
extern SkMovie* SkMovie_GIF_MemoryFactory(const void*, size_t);
-static const SkMovieStreamProc gStreamProc[] = {
#ifdef SK_SUPPORT_IMAGE_DECODE
+static const SkMovieStreamProc gStreamProc[] = {
SkMovie_GIF_StreamFactory
-#endif
};
static const SkMovieMemoryProc gMemoryProc[] = {
-#ifdef SK_SUPPORT_IMAGE_DECODE
SkMovie_GIF_MemoryFactory
-#endif
};
+#endif
SkMovie* SkMovie::DecodeStream(SkStream* stream) {
+#ifdef SK_SUPPORT_IMAGE_DECODE
for (unsigned i = 0; i < SK_ARRAY_COUNT(gStreamProc); i++) {
SkMovie* movie = gStreamProc[i](stream);
if (NULL != movie) {
@@ -94,17 +97,20 @@ SkMovie* SkMovie::DecodeStream(SkStream* stream) {
}
stream->rewind();
}
+#endif
return NULL;
}
SkMovie* SkMovie::DecodeMemory(const void* data, size_t length)
{
+#ifdef SK_SUPPORT_IMAGE_DECODE
for (unsigned i = 0; i < SK_ARRAY_COUNT(gMemoryProc); i++) {
SkMovie* movie = gMemoryProc[i](data, length);
if (NULL != movie) {
return movie;
}
}
+#endif
return NULL;
}