Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp

Issue 2756463003: Remove opaque alpha channel special case (Closed)
Patch Set: Fix gif detecting if a frame claims to have transparency Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.allocatePixelData(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.zeroFillPixelData();
464 buffer.setStatus(ImageFrame::FramePartial);
Peter Kasting 2017/03/22 23:37:47 Again, I think this got removed in another CL
cblume 2017/05/08 10:28:02 I did a quick look around my CLs but didn't see it
465 // The buffer is transparent outside the decoded area while the image is 464 // The buffer is transparent outside the decoded area while the image is
466 // loading. The correct alpha value for the frame will be set when it is 465 // loading. The correct alpha value for the frame will be set when it is
467 // fully decoded. 466 // fully decoded.
468 buffer.setHasAlpha(true); 467 buffer.setStatus(ImageFrame::FramePartial);
469 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); 468 buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));
470 } 469 }
471 470
472 const IntRect& frameRect = buffer.originalFrameRect(); 471 const IntRect& frameRect = buffer.originalFrameRect();
473 if (!m_decoder) { 472 if (!m_decoder) {
474 WEBP_CSP_MODE mode = outputMode(m_formatFlags & ALPHA_FLAG); 473 WEBP_CSP_MODE mode = outputMode(m_formatFlags & ALPHA_FLAG);
475 if (!m_premultiplyAlpha) 474 if (!m_premultiplyAlpha)
476 mode = outputMode(false); 475 mode = outputMode(false);
477 if (colorTransform()) { 476 if (colorTransform()) {
478 // Swizzling between RGBA and BGRA is zero cost in a color transform. 477 // Swizzling between RGBA and BGRA is zero cost in a color transform.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 return false; 512 return false;
514 } 513 }
515 // FALLTHROUGH 514 // FALLTHROUGH
516 default: 515 default:
517 clear(); 516 clear();
518 return setFailed(); 517 return setFailed();
519 } 518 }
520 } 519 }
521 520
522 } // namespace blink 521 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698