OLD | NEW |
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 Loading... |
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); |
OLD | NEW |