OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 if (failed()) | 450 if (failed()) |
451 return false; | 451 return false; |
452 | 452 |
453 DCHECK(isDecodedSizeAvailable()); | 453 DCHECK(isDecodedSizeAvailable()); |
454 | 454 |
455 DCHECK_GT(m_frameBufferCache.size(), frameIndex); | 455 DCHECK_GT(m_frameBufferCache.size(), frameIndex); |
456 ImageFrame& buffer = m_frameBufferCache[frameIndex]; | 456 ImageFrame& buffer = m_frameBufferCache[frameIndex]; |
457 DCHECK_NE(buffer.getStatus(), ImageFrame::FrameComplete); | 457 DCHECK_NE(buffer.getStatus(), ImageFrame::FrameComplete); |
458 | 458 |
459 if (buffer.getStatus() == ImageFrame::FrameEmpty) { | 459 if (buffer.getStatus() == ImageFrame::FrameEmpty) { |
460 if (!buffer.setSizeAndColorSpace(size().width(), size().height(), | 460 if (!buffer.allocatePixelData(size().width(), size().height(), |
461 colorSpaceForSkImages())) | 461 colorSpaceForSkImages())) |
462 return setFailed(); | 462 return setFailed(); |
| 463 buffer.zeroFillPixelData(); |
463 buffer.setStatus(ImageFrame::FramePartial); | 464 buffer.setStatus(ImageFrame::FramePartial); |
464 // The buffer is transparent outside the decoded area while the image is | 465 // The buffer is transparent outside the decoded area while the image is |
465 // loading. The correct alpha value for the frame will be set when it is | 466 // loading. The correct alpha value for the frame will be set when it is |
466 // fully decoded. | 467 // fully decoded. |
467 buffer.setHasAlpha(true); | 468 buffer.setHasAlpha(true); |
468 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); | 469 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
469 } | 470 } |
470 | 471 |
471 const IntRect& frameRect = buffer.originalFrameRect(); | 472 const IntRect& frameRect = buffer.originalFrameRect(); |
472 if (!m_decoder) { | 473 if (!m_decoder) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 return false; | 513 return false; |
513 } | 514 } |
514 // FALLTHROUGH | 515 // FALLTHROUGH |
515 default: | 516 default: |
516 clear(); | 517 clear(); |
517 return setFailed(); | 518 return setFailed(); |
518 } | 519 } |
519 } | 520 } |
520 | 521 |
521 } // namespace blink | 522 } // namespace blink |
OLD | NEW |