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

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

Issue 2749703002: Refactor ImageFrame::setSizeAndColorSpace() (Closed)
Patch Set: Moving to another CR the separation of zeroing pixel data from setting alpha 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
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698