| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 (*decoder)->setMemoryAllocator(0); | 295 (*decoder)->setMemoryAllocator(0); |
| 296 | 296 |
| 297 if (!frame || frame->getStatus() == ImageFrame::FrameEmpty) | 297 if (!frame || frame->getStatus() == ImageFrame::FrameEmpty) |
| 298 return false; | 298 return false; |
| 299 | 299 |
| 300 // A cache object is considered complete if we can decode a complete frame. | 300 // A cache object is considered complete if we can decode a complete frame. |
| 301 // Or we have received all data. The image might not be fully decoded in | 301 // Or we have received all data. The image might not be fully decoded in |
| 302 // the latter case. | 302 // the latter case. |
| 303 const bool isDecodeComplete = frame->getStatus() == ImageFrame::FrameComplet
e || allDataReceived; | 303 const bool isDecodeComplete = frame->getStatus() == ImageFrame::FrameComplet
e || allDataReceived; |
| 304 | 304 |
| 305 SkBitmap fullSizeBitmap = frame->bitmap(); | 305 SkBitmap fullSizeBitmap = frame->bitmap(false); |
| 306 if (!fullSizeBitmap.isNull()) { | 306 if (!fullSizeBitmap.isNull()) { |
| 307 ASSERT(fullSizeBitmap.width() == m_fullSize.width() && fullSizeBitmap.he
ight() == m_fullSize.height()); | 307 ASSERT(fullSizeBitmap.width() == m_fullSize.width() && fullSizeBitmap.he
ight() == m_fullSize.height()); |
| 308 setHasAlpha(index, !fullSizeBitmap.isOpaque()); | 308 setHasAlpha(index, !fullSizeBitmap.isOpaque()); |
| 309 } | 309 } |
| 310 | 310 |
| 311 *bitmap = fullSizeBitmap; | 311 *bitmap = fullSizeBitmap; |
| 312 return isDecodeComplete; | 312 return isDecodeComplete; |
| 313 } | 313 } |
| 314 | 314 |
| 315 bool ImageFrameGenerator::hasAlpha(size_t index) | 315 bool ImageFrameGenerator::hasAlpha(size_t index) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 333 | 333 |
| 334 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. | 334 // Setting a dummy ImagePlanes object signals to the decoder that we want to
do YUV decoding. |
| 335 decoder->setData(data, true); | 335 decoder->setData(data, true); |
| 336 std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes); | 336 std::unique_ptr<ImagePlanes> dummyImagePlanes = wrapUnique(new ImagePlanes); |
| 337 decoder->setImagePlanes(std::move(dummyImagePlanes)); | 337 decoder->setImagePlanes(std::move(dummyImagePlanes)); |
| 338 | 338 |
| 339 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fW
idthBytes); | 339 return updateYUVComponentSizes(decoder.get(), sizeInfo->fSizes, sizeInfo->fW
idthBytes); |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace blink | 342 } // namespace blink |
| OLD | NEW |