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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp

Issue 2462803002: Plumb color space to DecodingImageGenerator and ImageFrameGenerator (Closed)
Patch Set: Incorporate review feedback Created 4 years, 1 month 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) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 setFailed(); 362 setFailed();
363 } 363 }
364 364
365 bool GIFImageDecoder::initFrameBuffer(size_t frameIndex) { 365 bool GIFImageDecoder::initFrameBuffer(size_t frameIndex) {
366 // Initialize the frame rect in our buffer. 366 // Initialize the frame rect in our buffer.
367 ImageFrame* const buffer = &m_frameBufferCache[frameIndex]; 367 ImageFrame* const buffer = &m_frameBufferCache[frameIndex];
368 368
369 size_t requiredPreviousFrameIndex = buffer->requiredPreviousFrameIndex(); 369 size_t requiredPreviousFrameIndex = buffer->requiredPreviousFrameIndex();
370 if (requiredPreviousFrameIndex == kNotFound) { 370 if (requiredPreviousFrameIndex == kNotFound) {
371 // This frame doesn't rely on any previous data. 371 // This frame doesn't rely on any previous data.
372 if (!buffer->setSizeAndColorSpace(size().width(), size().height(), nullptr)) 372 if (!buffer->setSizeAndColorSpace(size().width(), size().height(),
373 colorSpace())) {
373 return setFailed(); 374 return setFailed();
375 }
374 } else { 376 } else {
375 ImageFrame* prevBuffer = &m_frameBufferCache[requiredPreviousFrameIndex]; 377 ImageFrame* prevBuffer = &m_frameBufferCache[requiredPreviousFrameIndex];
376 ASSERT(prevBuffer->getStatus() == ImageFrame::FrameComplete); 378 ASSERT(prevBuffer->getStatus() == ImageFrame::FrameComplete);
377 379
378 // We try to reuse |prevBuffer| as starting state to avoid copying. 380 // We try to reuse |prevBuffer| as starting state to avoid copying.
379 // For DisposeOverwritePrevious, the next frame will also use 381 // For DisposeOverwritePrevious, the next frame will also use
380 // |prevBuffer| as its starting state, so we can't take over its image 382 // |prevBuffer| as its starting state, so we can't take over its image
381 // data using takeBitmapDataIfWritable. Copy the data instead. 383 // data using takeBitmapDataIfWritable. Copy the data instead.
382 if ((buffer->getDisposalMethod() == ImageFrame::DisposeOverwritePrevious || 384 if ((buffer->getDisposalMethod() == ImageFrame::DisposeOverwritePrevious ||
383 !buffer->takeBitmapDataIfWritable(prevBuffer)) && 385 !buffer->takeBitmapDataIfWritable(prevBuffer)) &&
(...skipping 11 matching lines...) Expand all
395 } 397 }
396 398
397 // Update our status to be partially complete. 399 // Update our status to be partially complete.
398 buffer->setStatus(ImageFrame::FramePartial); 400 buffer->setStatus(ImageFrame::FramePartial);
399 401
400 // Reset the alpha pixel tracker for this frame. 402 // Reset the alpha pixel tracker for this frame.
401 m_currentBufferSawAlpha = false; 403 m_currentBufferSawAlpha = false;
402 return true; 404 return true;
403 } 405 }
404 } // namespace blink 406 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698