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

Side by Side Diff: skia/ports/SkImageDecoder_Factory.cpp

Issue 16263: Make Skia build as a dynamic library by fixing up the imports. (Closed)
Patch Set: Created 11 years, 12 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 unified diff | Download patch
« no previous file with comments | « skia/SConscript ('k') | skia/skia.vsprops » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* libs/graphics/ports/SkImageDecoder_Factory.cpp 1 /* libs/graphics/ports/SkImageDecoder_Factory.cpp
2 ** 2 **
3 ** Copyright 2006, The Android Open Source Project 3 ** Copyright 2006, The Android Open Source Project
4 ** 4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License. 6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at 7 ** You may obtain a copy of the License at
8 ** 8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** http://www.apache.org/licenses/LICENSE-2.0
10 ** 10 **
(...skipping 16 matching lines...) Expand all
27 extern SkImageDecoder* SkImageDecoder_JPEG_Factory(SkStream*); 27 extern SkImageDecoder* SkImageDecoder_JPEG_Factory(SkStream*);
28 28
29 typedef SkImageDecoder* (*SkImageDecoderFactoryProc)(SkStream*); 29 typedef SkImageDecoder* (*SkImageDecoderFactoryProc)(SkStream*);
30 30
31 struct CodecFormat { 31 struct CodecFormat {
32 SkImageDecoderFactoryProc fProc; 32 SkImageDecoderFactoryProc fProc;
33 SkImageDecoder::Format fFormat; 33 SkImageDecoder::Format fFormat;
34 }; 34 };
35 35
36 static const CodecFormat gPairs[] = { 36 static const CodecFormat gPairs[] = {
37 #ifdef SK_SUPPORT_IMAGE_DECODE
37 { SkImageDecoder_GIF_Factory, SkImageDecoder::kGIF_Format }, 38 { SkImageDecoder_GIF_Factory, SkImageDecoder::kGIF_Format },
38 { SkImageDecoder_PNG_Factory, SkImageDecoder::kPNG_Format }, 39 { SkImageDecoder_PNG_Factory, SkImageDecoder::kPNG_Format },
39 { SkImageDecoder_ICO_Factory, SkImageDecoder::kICO_Format }, 40 { SkImageDecoder_ICO_Factory, SkImageDecoder::kICO_Format },
40 { SkImageDecoder_WBMP_Factory, SkImageDecoder::kWBMP_Format }, 41 { SkImageDecoder_WBMP_Factory, SkImageDecoder::kWBMP_Format },
41 { SkImageDecoder_BMP_Factory, SkImageDecoder::kBMP_Format }, 42 { SkImageDecoder_BMP_Factory, SkImageDecoder::kBMP_Format },
42 { SkImageDecoder_JPEG_Factory, SkImageDecoder::kJPEG_Format } 43 { SkImageDecoder_JPEG_Factory, SkImageDecoder::kJPEG_Format }
44 #endif
43 }; 45 };
44 46
45 SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) { 47 SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
46 for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) { 48 for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) {
47 SkImageDecoder* codec = gPairs[i].fProc(stream); 49 SkImageDecoder* codec = gPairs[i].fProc(stream);
48 stream->rewind(); 50 stream->rewind();
49 if (NULL != codec) { 51 if (NULL != codec) {
50 return codec; 52 return codec;
51 } 53 }
52 } 54 }
(...skipping 13 matching lines...) Expand all
66 68
67 // the movie may hold onto the stream (by calling ref()) 69 // the movie may hold onto the stream (by calling ref())
68 typedef SkMovie* (*SkMovieStreamProc)(SkStream*); 70 typedef SkMovie* (*SkMovieStreamProc)(SkStream*);
69 // the movie may NOT hold onto the pointer 71 // the movie may NOT hold onto the pointer
70 typedef SkMovie* (*SkMovieMemoryProc)(const void*, size_t); 72 typedef SkMovie* (*SkMovieMemoryProc)(const void*, size_t);
71 73
72 extern SkMovie* SkMovie_GIF_StreamFactory(SkStream*); 74 extern SkMovie* SkMovie_GIF_StreamFactory(SkStream*);
73 extern SkMovie* SkMovie_GIF_MemoryFactory(const void*, size_t); 75 extern SkMovie* SkMovie_GIF_MemoryFactory(const void*, size_t);
74 76
75 static const SkMovieStreamProc gStreamProc[] = { 77 static const SkMovieStreamProc gStreamProc[] = {
78 #ifdef SK_SUPPORT_IMAGE_DECODE
76 SkMovie_GIF_StreamFactory 79 SkMovie_GIF_StreamFactory
80 #endif
77 }; 81 };
78 82
79 static const SkMovieMemoryProc gMemoryProc[] = { 83 static const SkMovieMemoryProc gMemoryProc[] = {
84 #ifdef SK_SUPPORT_IMAGE_DECODE
80 SkMovie_GIF_MemoryFactory 85 SkMovie_GIF_MemoryFactory
86 #endif
81 }; 87 };
82 88
83 SkMovie* SkMovie::DecodeStream(SkStream* stream) { 89 SkMovie* SkMovie::DecodeStream(SkStream* stream) {
84 for (unsigned i = 0; i < SK_ARRAY_COUNT(gStreamProc); i++) { 90 for (unsigned i = 0; i < SK_ARRAY_COUNT(gStreamProc); i++) {
85 SkMovie* movie = gStreamProc[i](stream); 91 SkMovie* movie = gStreamProc[i](stream);
86 if (NULL != movie) { 92 if (NULL != movie) {
87 return movie; 93 return movie;
88 } 94 }
89 stream->rewind(); 95 stream->rewind();
90 } 96 }
(...skipping 23 matching lines...) Expand all
114 case kJPEG_Type: 120 case kJPEG_Type:
115 return SkImageEncoder_JPEG_Factory(); 121 return SkImageEncoder_JPEG_Factory();
116 case kPNG_Type: 122 case kPNG_Type:
117 return SkImageEncoder_PNG_Factory(); 123 return SkImageEncoder_PNG_Factory();
118 default: 124 default:
119 return NULL; 125 return NULL;
120 } 126 }
121 } 127 }
122 128
123 #endif 129 #endif
OLDNEW
« no previous file with comments | « skia/SConscript ('k') | skia/skia.vsprops » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698