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

Side by Side Diff: src/ports/SkImageDecoder_CG.cpp

Issue 23453031: Rewrite SkTRegistry to take any trivially-copyable type. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: reed+scroggo Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/images/SkMovie_gif.cpp ('k') | src/ports/SkImageDecoder_WIC.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCGUtils.h" 8 #include "SkCGUtils.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 case SkImageEncoder::kGIF_Type: 253 case SkImageEncoder::kGIF_Type:
254 case SkImageEncoder::kJPEG_Type: 254 case SkImageEncoder::kJPEG_Type:
255 case SkImageEncoder::kPNG_Type: 255 case SkImageEncoder::kPNG_Type:
256 break; 256 break;
257 default: 257 default:
258 return NULL; 258 return NULL;
259 } 259 }
260 return SkNEW_ARGS(SkImageEncoder_CG, (t)); 260 return SkNEW_ARGS(SkImageEncoder_CG, (t));
261 } 261 }
262 262
263 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_imageencoder_ cg_factory); 263 static SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> gEReg(sk_imageencod er_cg_factory);
264 264
265 struct FormatConversion { 265 struct FormatConversion {
266 CFStringRef fUTType; 266 CFStringRef fUTType;
267 SkImageDecoder::Format fFormat; 267 SkImageDecoder::Format fFormat;
268 }; 268 };
269 269
270 // Array of the types supported by the decoder. 270 // Array of the types supported by the decoder.
271 static const FormatConversion gFormatConversions[] = { 271 static const FormatConversion gFormatConversions[] = {
272 { kUTTypeBMP, SkImageDecoder::kBMP_Format }, 272 { kUTTypeBMP, SkImageDecoder::kBMP_Format },
273 { kUTTypeGIF, SkImageDecoder::kGIF_Format }, 273 { kUTTypeGIF, SkImageDecoder::kGIF_Format },
(...skipping 21 matching lines...) Expand all
295 } 295 }
296 296
297 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc); 297 SkAutoTCallVProc<const void, CFRelease> arsrc(imageSrc);
298 const CFStringRef name = CGImageSourceGetType(imageSrc); 298 const CFStringRef name = CGImageSourceGetType(imageSrc);
299 if (NULL == name) { 299 if (NULL == name) {
300 return SkImageDecoder::kUnknown_Format; 300 return SkImageDecoder::kUnknown_Format;
301 } 301 }
302 return UTType_to_Format(name); 302 return UTType_to_Format(name);
303 } 303 }
304 304
305 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_cg); 305 static SkTRegistry<SkImageDecoder::Format(*)(SkStream*)> gFormatReg(get_format_c g);
OLDNEW
« no previous file with comments | « src/images/SkMovie_gif.cpp ('k') | src/ports/SkImageDecoder_WIC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698