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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 if (stream->read((void*)buf, 4) != 4) { | 428 if (stream->read((void*)buf, 4) != 4) { |
429 return false; | 429 return false; |
430 } | 430 } |
431 int reserved = read2Bytes(buf, 0); | 431 int reserved = read2Bytes(buf, 0); |
432 int type = read2Bytes(buf, 2); | 432 int type = read2Bytes(buf, 2); |
433 return 0 == reserved && 1 == type; | 433 return 0 == reserved && 1 == type; |
434 } | 434 } |
435 | 435 |
436 static SkImageDecoder* sk_libico_dfactory(SkStreamRewindable* stream) { | 436 static SkImageDecoder* sk_libico_dfactory(SkStreamRewindable* stream) { |
437 if (is_ico(stream)) { | 437 if (is_ico(stream)) { |
438 return SkNEW(SkICOImageDecoder); | 438 return new SkICOImageDecoder; |
439 } | 439 } |
440 return NULL; | 440 return NULL; |
441 } | 441 } |
442 | 442 |
443 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory); | 443 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory); |
444 | 444 |
445 static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) { | 445 static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) { |
446 if (is_ico(stream)) { | 446 if (is_ico(stream)) { |
447 return SkImageDecoder::kICO_Format; | 447 return SkImageDecoder::kICO_Format; |
448 } | 448 } |
449 return SkImageDecoder::kUnknown_Format; | 449 return SkImageDecoder::kUnknown_Format; |
450 } | 450 } |
451 | 451 |
452 static SkImageDecoder_FormatReg gFormatReg(get_format_ico); | 452 static SkImageDecoder_FormatReg gFormatReg(get_format_ico); |
OLD | NEW |