OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010, The Android Open Source Project | 2 * Copyright 2010, The Android Open Source Project |
3 * | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with the License. | 5 * you may not use this file except in compliance with the License. |
6 * You may obtain a copy of the License at | 6 * You may obtain a copy of the License at |
7 * | 7 * |
8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
9 * | 9 * |
10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 DEFINE_ENCODER_CREATOR(WEBPImageEncoder); | 650 DEFINE_ENCODER_CREATOR(WEBPImageEncoder); |
651 /////////////////////////////////////////////////////////////////////////////// | 651 /////////////////////////////////////////////////////////////////////////////// |
652 | 652 |
653 static SkImageDecoder* sk_libwebp_dfactory(SkStreamRewindable* stream) { | 653 static SkImageDecoder* sk_libwebp_dfactory(SkStreamRewindable* stream) { |
654 int width, height, hasAlpha; | 654 int width, height, hasAlpha; |
655 if (!webp_parse_header(stream, &width, &height, &hasAlpha)) { | 655 if (!webp_parse_header(stream, &width, &height, &hasAlpha)) { |
656 return NULL; | 656 return NULL; |
657 } | 657 } |
658 | 658 |
659 // Magic matches, call decoder | 659 // Magic matches, call decoder |
660 return SkNEW(SkWEBPImageDecoder); | 660 return new SkWEBPImageDecoder; |
661 } | 661 } |
662 | 662 |
663 static SkImageDecoder::Format get_format_webp(SkStreamRewindable* stream) { | 663 static SkImageDecoder::Format get_format_webp(SkStreamRewindable* stream) { |
664 int width, height, hasAlpha; | 664 int width, height, hasAlpha; |
665 if (webp_parse_header(stream, &width, &height, &hasAlpha)) { | 665 if (webp_parse_header(stream, &width, &height, &hasAlpha)) { |
666 return SkImageDecoder::kWEBP_Format; | 666 return SkImageDecoder::kWEBP_Format; |
667 } | 667 } |
668 return SkImageDecoder::kUnknown_Format; | 668 return SkImageDecoder::kUnknown_Format; |
669 } | 669 } |
670 | 670 |
671 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { | 671 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { |
672 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; | 672 return (SkImageEncoder::kWEBP_Type == t) ? new SkWEBPImageEncoder : NULL; |
673 } | 673 } |
674 | 674 |
675 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); | 675 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); |
676 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); | 676 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); |
677 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); | 677 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); |
OLD | NEW |