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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 if (!bitmap->copyTo(&bm8888, SkBitmap::kARGB_8888_Config, &allocator)) { | 380 if (!bitmap->copyTo(&bm8888, SkBitmap::kARGB_8888_Config, &allocator)) { |
381 return false; | 381 return false; |
382 } | 382 } |
383 | 383 |
384 bitmap->swap(bm8888); | 384 bitmap->swap(bm8888); |
385 return true; | 385 return true; |
386 } | 386 } |
387 | 387 |
388 bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size, | 388 bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size, |
389 SkImageInfo* info, | 389 SkImageInfo* info, |
390 const SkBitmapFactory::Target* target)
{ | 390 const SkImageDecoder::Target* target)
{ |
391 // FIXME: Just to get this working, implement in terms of existing | 391 // FIXME: Just to get this working, implement in terms of existing |
392 // ImageDecoder calls. | 392 // ImageDecoder calls. |
393 SkBitmap bm; | 393 SkBitmap bm; |
394 SkMemoryStream stream(buffer, size); | 394 SkMemoryStream stream(buffer, size); |
395 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); | 395 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); |
396 if (NULL == decoder.get()) { | 396 if (NULL == decoder.get()) { |
397 return false; | 397 return false; |
398 } | 398 } |
399 | 399 |
400 if (!decode_bounds_to_8888(decoder.get(), &stream, &bm)) { | 400 if (!decode_bounds_to_8888(decoder.get(), &stream, &bm)) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 if (kUnknown_Format == *format) { | 445 if (kUnknown_Format == *format) { |
446 if (stream->rewind()) { | 446 if (stream->rewind()) { |
447 *format = GetStreamFormat(stream); | 447 *format = GetStreamFormat(stream); |
448 } | 448 } |
449 } | 449 } |
450 } | 450 } |
451 delete codec; | 451 delete codec; |
452 } | 452 } |
453 return success; | 453 return success; |
454 } | 454 } |
OLD | NEW |