| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // in that image in order to release the decoder when all frames are | 356 // in that image in order to release the decoder when all frames are |
| 357 // decoded. frameCount() is reliable only if all data is received and set in | 357 // decoded. frameCount() is reliable only if all data is received and set in |
| 358 // decoder, particularly with GIF. | 358 // decoder, particularly with GIF. |
| 359 if (allDataReceived) | 359 if (allDataReceived) |
| 360 m_frameCount = (*decoder)->frameCount(); | 360 m_frameCount = (*decoder)->frameCount(); |
| 361 | 361 |
| 362 (*decoder)->setData(0, false); // Unref SharedBuffer from ImageDecoder. | 362 (*decoder)->setData(0, false); // Unref SharedBuffer from ImageDecoder. |
| 363 (*decoder)->clearCacheExceptFrame(index); | 363 (*decoder)->clearCacheExceptFrame(index); |
| 364 (*decoder)->setMemoryAllocator(0); | 364 (*decoder)->setMemoryAllocator(0); |
| 365 | 365 |
| 366 if (!frame || frame->status() == ImageFrame::FrameEmpty) | 366 if (!frame || frame->getStatus() == ImageFrame::FrameEmpty) |
| 367 return false; | 367 return false; |
| 368 | 368 |
| 369 // A cache object is considered complete if we can decode a complete frame. | 369 // A cache object is considered complete if we can decode a complete frame. |
| 370 // Or we have received all data. The image might not be fully decoded in | 370 // Or we have received all data. The image might not be fully decoded in |
| 371 // the latter case. | 371 // the latter case. |
| 372 const bool isDecodeComplete = frame->status() == ImageFrame::FrameComplete |
| allDataReceived; | 372 const bool isDecodeComplete = frame->getStatus() == ImageFrame::FrameComplet
e || allDataReceived; |
| 373 | 373 |
| 374 SkBitmap fullSizeBitmap = frame->getSkBitmap(); | 374 SkBitmap fullSizeBitmap = frame->getSkBitmap(); |
| 375 if (!fullSizeBitmap.isNull()) { | 375 if (!fullSizeBitmap.isNull()) { |
| 376 ASSERT(fullSizeBitmap.width() == m_fullSize.width() && fullSizeBitmap.he
ight() == m_fullSize.height()); | 376 ASSERT(fullSizeBitmap.width() == m_fullSize.width() && fullSizeBitmap.he
ight() == m_fullSize.height()); |
| 377 setHasAlpha(index, !fullSizeBitmap.isOpaque()); | 377 setHasAlpha(index, !fullSizeBitmap.isOpaque()); |
| 378 } | 378 } |
| 379 | 379 |
| 380 *bitmap = fullSizeBitmap; | 380 *bitmap = fullSizeBitmap; |
| 381 return isDecodeComplete; | 381 return isDecodeComplete; |
| 382 } | 382 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 408 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. | 408 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. |
| 409 decoder->setData(data, allDataReceived); | 409 decoder->setData(data, allDataReceived); |
| 410 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); | 410 OwnPtr<ImagePlanes> dummyImagePlanes = adoptPtr(new ImagePlanes); |
| 411 decoder->setImagePlanes(dummyImagePlanes.release()); | 411 decoder->setImagePlanes(dummyImagePlanes.release()); |
| 412 | 412 |
| 413 ASSERT(componentSizes); | 413 ASSERT(componentSizes); |
| 414 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); | 414 return updateYUVComponentSizes(decoder.get(), componentSizes, ImageDecoder::
SizeForMemoryAllocation); |
| 415 } | 415 } |
| 416 | 416 |
| 417 } // namespace blink | 417 } // namespace blink |
| OLD | NEW |