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

Side by Side Diff: src/images/SkImageDecoder_libico.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/SkImageDecoder_libgif.cpp ('k') | src/images/SkImageDecoder_libjpeg.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 2006 The Android Open Source Project 2 * Copyright 2006 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 "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 stream->read((void*)buf, 4); 391 stream->read((void*)buf, 4);
392 int reserved = read2Bytes(buf, 0); 392 int reserved = read2Bytes(buf, 0);
393 int type = read2Bytes(buf, 2); 393 int type = read2Bytes(buf, 2);
394 if (reserved != 0 || type != 1) { 394 if (reserved != 0 || type != 1) {
395 // This stream does not represent an ICO image. 395 // This stream does not represent an ICO image.
396 return false; 396 return false;
397 } 397 }
398 return true; 398 return true;
399 } 399 }
400 400
401 #include "SkTRegistry.h"
402
403 static SkImageDecoder* sk_libico_dfactory(SkStream* stream) { 401 static SkImageDecoder* sk_libico_dfactory(SkStream* stream) {
404 if (is_ico(stream)) { 402 if (is_ico(stream)) {
405 return SkNEW(SkICOImageDecoder); 403 return SkNEW(SkICOImageDecoder);
406 } 404 }
407 return NULL; 405 return NULL;
408 } 406 }
409 407
410 static SkTRegistry<SkImageDecoder*, SkStream*> gReg(sk_libico_dfactory); 408 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory);
411 409
412 static SkImageDecoder::Format get_format_ico(SkStream* stream) { 410 static SkImageDecoder::Format get_format_ico(SkStream* stream) {
413 if (is_ico(stream)) { 411 if (is_ico(stream)) {
414 return SkImageDecoder::kICO_Format; 412 return SkImageDecoder::kICO_Format;
415 } 413 }
416 return SkImageDecoder::kUnknown_Format; 414 return SkImageDecoder::kUnknown_Format;
417 } 415 }
418 416
419 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_ico) ; 417 static SkImageDecoder_FormatReg gFormatReg(get_format_ico);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libgif.cpp ('k') | src/images/SkImageDecoder_libjpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698