| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 457 |
| 458 DCHECK_GT(frame_buffer_cache_.size(), frame_index); | 458 DCHECK_GT(frame_buffer_cache_.size(), frame_index); |
| 459 ImageFrame& buffer = frame_buffer_cache_[frame_index]; | 459 ImageFrame& buffer = frame_buffer_cache_[frame_index]; |
| 460 DCHECK_NE(buffer.GetStatus(), ImageFrame::kFrameComplete); | 460 DCHECK_NE(buffer.GetStatus(), ImageFrame::kFrameComplete); |
| 461 | 461 |
| 462 if (buffer.GetStatus() == ImageFrame::kFrameEmpty) { | 462 if (buffer.GetStatus() == ImageFrame::kFrameEmpty) { |
| 463 if (!buffer.AllocatePixelData(Size().Width(), Size().Height(), | 463 if (!buffer.AllocatePixelData(Size().Width(), Size().Height(), |
| 464 ColorSpaceForSkImages())) | 464 ColorSpaceForSkImages())) |
| 465 return SetFailed(); | 465 return SetFailed(); |
| 466 buffer.ZeroFillPixelData(); | 466 buffer.ZeroFillPixelData(); |
| 467 buffer.SetStatus(ImageFrame::kFramePartial); | |
| 468 // The buffer is transparent outside the decoded area while the image is | 467 // The buffer is transparent outside the decoded area while the image is |
| 469 // loading. The correct alpha value for the frame will be set when it is | 468 // loading. The correct alpha value for the frame will be set when it is |
| 470 // fully decoded. | 469 // fully decoded. |
| 471 buffer.SetHasAlpha(true); | 470 buffer.SetStatus(ImageFrame::kFramePartial); |
| 472 buffer.SetOriginalFrameRect(IntRect(IntPoint(), Size())); | 471 buffer.SetOriginalFrameRect(IntRect(IntPoint(), Size())); |
| 473 } | 472 } |
| 474 | 473 |
| 475 const IntRect& frame_rect = buffer.OriginalFrameRect(); | 474 const IntRect& frame_rect = buffer.OriginalFrameRect(); |
| 476 if (!decoder_) { | 475 if (!decoder_) { |
| 477 WEBP_CSP_MODE mode = outputMode(format_flags_ & ALPHA_FLAG); | 476 WEBP_CSP_MODE mode = outputMode(format_flags_ & ALPHA_FLAG); |
| 478 if (!premultiply_alpha_) | 477 if (!premultiply_alpha_) |
| 479 mode = outputMode(false); | 478 mode = outputMode(false); |
| 480 if (ColorTransform()) { | 479 if (ColorTransform()) { |
| 481 // Swizzling between RGBA and BGRA is zero cost in a color transform. | 480 // Swizzling between RGBA and BGRA is zero cost in a color transform. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 return false; | 515 return false; |
| 517 } | 516 } |
| 518 // FALLTHROUGH | 517 // FALLTHROUGH |
| 519 default: | 518 default: |
| 520 Clear(); | 519 Clear(); |
| 521 return SetFailed(); | 520 return SetFailed(); |
| 522 } | 521 } |
| 523 } | 522 } |
| 524 | 523 |
| 525 } // namespace blink | 524 } // namespace blink |
| OLD | NEW |