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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 info.fColorType = SkBitmapConfigToColorType(config); | 304 info.fColorType = SkBitmapConfigToColorType(config); |
305 if (SkToBool(fHasAlpha)) { | 305 if (SkToBool(fHasAlpha)) { |
306 if (this->getRequireUnpremultipliedColors()) { | 306 if (this->getRequireUnpremultipliedColors()) { |
307 info.fAlphaType = kUnpremul_SkAlphaType; | 307 info.fAlphaType = kUnpremul_SkAlphaType; |
308 } else { | 308 } else { |
309 info.fAlphaType = kPremul_SkAlphaType; | 309 info.fAlphaType = kPremul_SkAlphaType; |
310 } | 310 } |
311 } else { | 311 } else { |
312 info.fAlphaType = kOpaque_SkAlphaType; | 312 info.fAlphaType = kOpaque_SkAlphaType; |
313 } | 313 } |
314 return decodedBitmap->setInfo(info); | 314 return decodedBitmap->setConfig(info); |
315 } | 315 } |
316 | 316 |
317 bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, | 317 bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, |
318 int *width, int *height) { | 318 int *width, int *height) { |
319 int origWidth, origHeight, hasAlpha; | 319 int origWidth, origHeight, hasAlpha; |
320 if (!webp_parse_header(stream, &origWidth, &origHeight, &hasAlpha)) { | 320 if (!webp_parse_header(stream, &origWidth, &origHeight, &hasAlpha)) { |
321 return false; | 321 return false; |
322 } | 322 } |
323 | 323 |
324 if (!stream->rewind()) { | 324 if (!stream->rewind()) { |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 return SkImageDecoder::kUnknown_Format; | 686 return SkImageDecoder::kUnknown_Format; |
687 } | 687 } |
688 | 688 |
689 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { | 689 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { |
690 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; | 690 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; |
691 } | 691 } |
692 | 692 |
693 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); | 693 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); |
694 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); | 694 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); |
695 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); | 695 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); |
OLD | NEW |