| 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 | 8 |
| 9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 if (!bitmap->copyTo(&bm8888, SkBitmap::kARGB_8888_Config, &allocator)) { | 397 if (!bitmap->copyTo(&bm8888, SkBitmap::kARGB_8888_Config, &allocator)) { |
| 398 return false; | 398 return false; |
| 399 } | 399 } |
| 400 | 400 |
| 401 bitmap->swap(bm8888); | 401 bitmap->swap(bm8888); |
| 402 return true; | 402 return true; |
| 403 } | 403 } |
| 404 | 404 |
| 405 bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size, | 405 bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size, |
| 406 SkImageInfo* info, | 406 SkImageInfo* info, |
| 407 const SkBitmapFactory::Target* target)
{ | 407 const SkImageDecoder::Target* target)
{ |
| 408 // FIXME: Just to get this working, implement in terms of existing | 408 // FIXME: Just to get this working, implement in terms of existing |
| 409 // ImageDecoder calls. | 409 // ImageDecoder calls. |
| 410 SkBitmap bm; | 410 SkBitmap bm; |
| 411 SkMemoryStream stream(buffer, size); | 411 SkMemoryStream stream(buffer, size); |
| 412 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); | 412 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); |
| 413 if (NULL == decoder.get()) { | 413 if (NULL == decoder.get()) { |
| 414 return false; | 414 return false; |
| 415 } | 415 } |
| 416 | 416 |
| 417 if (!decode_bounds_to_8888(decoder.get(), &stream, &bm)) { | 417 if (!decode_bounds_to_8888(decoder.get(), &stream, &bm)) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 if (kUnknown_Format == *format) { | 462 if (kUnknown_Format == *format) { |
| 463 if (stream->rewind()) { | 463 if (stream->rewind()) { |
| 464 *format = GetStreamFormat(stream); | 464 *format = GetStreamFormat(stream); |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 delete codec; | 468 delete codec; |
| 469 } | 469 } |
| 470 return success; | 470 return success; |
| 471 } | 471 } |
| OLD | NEW |