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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (MODE_LAST == mode) { | 235 if (MODE_LAST == mode) { |
236 return false; | 236 return false; |
237 } | 237 } |
238 | 238 |
239 if (0 == WebPInitDecoderConfig(config)) { | 239 if (0 == WebPInitDecoderConfig(config)) { |
240 return false; | 240 return false; |
241 } | 241 } |
242 | 242 |
243 config->output.colorspace = mode; | 243 config->output.colorspace = mode; |
244 config->output.u.RGBA.rgba = (uint8_t*)decodedBitmap->getPixels(); | 244 config->output.u.RGBA.rgba = (uint8_t*)decodedBitmap->getPixels(); |
245 config->output.u.RGBA.stride = decodedBitmap->rowBytes(); | 245 config->output.u.RGBA.stride = (int) decodedBitmap->rowBytes(); |
246 config->output.u.RGBA.size = decodedBitmap->getSize(); | 246 config->output.u.RGBA.size = decodedBitmap->getSize(); |
247 config->output.is_external_memory = 1; | 247 config->output.is_external_memory = 1; |
248 | 248 |
249 if (width != decodedBitmap->width() || height != decodedBitmap->height()) { | 249 if (width != decodedBitmap->width() || height != decodedBitmap->height()) { |
250 config->options.use_scaling = 1; | 250 config->options.use_scaling = 1; |
251 config->options.scaled_width = decodedBitmap->width(); | 251 config->options.scaled_width = decodedBitmap->width(); |
252 config->options.scaled_height = decodedBitmap->height(); | 252 config->options.scaled_height = decodedBitmap->height(); |
253 } | 253 } |
254 | 254 |
255 return true; | 255 return true; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 return SkImageDecoder::kUnknown_Format; | 593 return SkImageDecoder::kUnknown_Format; |
594 } | 594 } |
595 | 595 |
596 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { | 596 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { |
597 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; | 597 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; |
598 } | 598 } |
599 | 599 |
600 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); | 600 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); |
601 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); | 601 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); |
602 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); | 602 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); |
OLD | NEW |