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

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

Issue 2749703002: Refactor ImageFrame::setSizeAndColorSpace() (Closed)
Patch Set: Fix alloc returned value flipped 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 DCHECK(isDecodedSizeAvailable()); 450 DCHECK(isDecodedSizeAvailable());
451 451
452 DCHECK_GT(m_frameBufferCache.size(), frameIndex); 452 DCHECK_GT(m_frameBufferCache.size(), frameIndex);
453 ImageFrame& buffer = m_frameBufferCache[frameIndex]; 453 ImageFrame& buffer = m_frameBufferCache[frameIndex];
454 DCHECK_NE(buffer.getStatus(), ImageFrame::FrameComplete); 454 DCHECK_NE(buffer.getStatus(), ImageFrame::FrameComplete);
455 455
456 if (buffer.getStatus() == ImageFrame::FrameEmpty) { 456 if (buffer.getStatus() == ImageFrame::FrameEmpty) {
457 if (!buffer.setSizeAndColorSpace(size().width(), size().height(), 457 if (!buffer.setSizeAndColorSpace(size().width(), size().height(),
458 colorSpaceForSkImages())) 458 colorSpaceForSkImages()))
459 return setFailed(); 459 return setFailed();
460 buffer.zeroFillPixelData();
460 buffer.setStatus(ImageFrame::FramePartial); 461 buffer.setStatus(ImageFrame::FramePartial);
461 // The buffer is transparent outside the decoded area while the image is 462 // The buffer is transparent outside the decoded area while the image is
462 // loading. The correct alpha value for the frame will be set when it is 463 // loading. The correct alpha value for the frame will be set when it is
463 // fully decoded. 464 // fully decoded.
464 buffer.setHasAlpha(true); 465 buffer.setHasAlpha(true);
465 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); 466 buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));
466 } 467 }
467 468
468 const IntRect& frameRect = buffer.originalFrameRect(); 469 const IntRect& frameRect = buffer.originalFrameRect();
469 if (!m_decoder) { 470 if (!m_decoder) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 return false; 510 return false;
510 } 511 }
511 // FALLTHROUGH 512 // FALLTHROUGH
512 default: 513 default:
513 clear(); 514 clear();
514 return setFailed(); 515 return setFailed();
515 } 516 }
516 } 517 }
517 518
518 } // namespace blink 519 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698