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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 if (config != SkBitmap::kRGB_565_Config && | 286 if (config != SkBitmap::kRGB_565_Config && |
287 config != SkBitmap::kARGB_4444_Config) { | 287 config != SkBitmap::kARGB_4444_Config) { |
288 config = SkBitmap::kARGB_8888_Config; | 288 config = SkBitmap::kARGB_8888_Config; |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 if (!this->chooseFromOneChoice(config, width, height)) { | 292 if (!this->chooseFromOneChoice(config, width, height)) { |
293 return false; | 293 return false; |
294 } | 294 } |
295 | 295 |
296 decodedBitmap->setConfig(config, width, height, 0); | 296 return decodedBitmap->setConfig(config, width, height, 0, |
297 | 297 fHasAlpha ? kPremul_SkAlphaType : kOpaque_Sk AlphaType); |
scroggo
2013/09/30 22:20:04
This should check this->getRequireUnpremultipliedC
| |
298 decodedBitmap->setIsOpaque(!fHasAlpha); | |
299 | |
300 return true; | |
301 } | 298 } |
302 | 299 |
303 bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, | 300 bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, |
304 int *width, int *height) { | 301 int *width, int *height) { |
305 int origWidth, origHeight, hasAlpha; | 302 int origWidth, origHeight, hasAlpha; |
306 if (!webp_parse_header(stream, &origWidth, &origHeight, &hasAlpha)) { | 303 if (!webp_parse_header(stream, &origWidth, &origHeight, &hasAlpha)) { |
307 return false; | 304 return false; |
308 } | 305 } |
309 | 306 |
310 if (!stream->rewind()) { | 307 if (!stream->rewind()) { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
593 return SkImageDecoder::kUnknown_Format; | 590 return SkImageDecoder::kUnknown_Format; |
594 } | 591 } |
595 | 592 |
596 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { | 593 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { |
597 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL L; | 594 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL L; |
598 } | 595 } |
599 | 596 |
600 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); | 597 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); |
601 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); | 598 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); |
602 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); | 599 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); |
OLD | NEW |