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

Side by Side Diff: WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp

Issue 3573008: Merge 68446 - WebCore: ImageDecoderSkia.cpp needs to check for allocator fail... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 2 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) 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 const RGBA32Buffer* prevBuffer = &m_frameBufferCache[--frameIndex]; 349 const RGBA32Buffer* prevBuffer = &m_frameBufferCache[--frameIndex];
350 RGBA32Buffer::FrameDisposalMethod prevMethod = prevBuffer->disposalMetho d(); 350 RGBA32Buffer::FrameDisposalMethod prevMethod = prevBuffer->disposalMetho d();
351 while (frameIndex && (prevMethod == RGBA32Buffer::DisposeOverwritePrevio us)) { 351 while (frameIndex && (prevMethod == RGBA32Buffer::DisposeOverwritePrevio us)) {
352 prevBuffer = &m_frameBufferCache[--frameIndex]; 352 prevBuffer = &m_frameBufferCache[--frameIndex];
353 prevMethod = prevBuffer->disposalMethod(); 353 prevMethod = prevBuffer->disposalMethod();
354 } 354 }
355 ASSERT(prevBuffer->status() == RGBA32Buffer::FrameComplete); 355 ASSERT(prevBuffer->status() == RGBA32Buffer::FrameComplete);
356 356
357 if ((prevMethod == RGBA32Buffer::DisposeNotSpecified) || (prevMethod == RGBA32Buffer::DisposeKeep)) { 357 if ((prevMethod == RGBA32Buffer::DisposeNotSpecified) || (prevMethod == RGBA32Buffer::DisposeKeep)) {
358 // Preserve the last frame as the starting state for this frame. 358 // Preserve the last frame as the starting state for this frame.
359 buffer->copyBitmapData(*prevBuffer); 359 if (!buffer->copyBitmapData(*prevBuffer))
360 return setFailed();
360 } else { 361 } else {
361 // We want to clear the previous frame to transparent, without 362 // We want to clear the previous frame to transparent, without
362 // affecting pixels in the image outside of the frame. 363 // affecting pixels in the image outside of the frame.
363 const IntRect& prevRect = prevBuffer->rect(); 364 const IntRect& prevRect = prevBuffer->rect();
364 const IntSize& bufferSize = scaledSize(); 365 const IntSize& bufferSize = scaledSize();
365 if (!frameIndex || prevRect.contains(IntRect(IntPoint(), scaledSize( )))) { 366 if (!frameIndex || prevRect.contains(IntRect(IntPoint(), scaledSize( )))) {
366 // Clearing the first frame, or a frame the size of the whole 367 // Clearing the first frame, or a frame the size of the whole
367 // image, results in a completely empty image. 368 // image, results in a completely empty image.
368 if (!buffer->setSize(bufferSize.width(), bufferSize.height())) 369 if (!buffer->setSize(bufferSize.width(), bufferSize.height()))
369 return setFailed(); 370 return setFailed();
370 } else { 371 } else {
371 // Copy the whole previous buffer, then clear just its frame. 372 // Copy the whole previous buffer, then clear just its frame.
372 buffer->copyBitmapData(*prevBuffer); 373 if (!buffer->copyBitmapData(*prevBuffer))
374 return setFailed();
373 for (int y = prevRect.y(); y < prevRect.bottom(); ++y) { 375 for (int y = prevRect.y(); y < prevRect.bottom(); ++y) {
374 for (int x = prevRect.x(); x < prevRect.right(); ++x) 376 for (int x = prevRect.x(); x < prevRect.right(); ++x)
375 buffer->setRGBA(x, y, 0, 0, 0, 0); 377 buffer->setRGBA(x, y, 0, 0, 0, 0);
376 } 378 }
377 if ((prevRect.width() > 0) && (prevRect.height() > 0)) 379 if ((prevRect.width() > 0) && (prevRect.height() > 0))
378 buffer->setHasAlpha(true); 380 buffer->setHasAlpha(true);
379 } 381 }
380 } 382 }
381 } 383 }
382 384
383 // Update our status to be partially complete. 385 // Update our status to be partially complete.
384 buffer->setStatus(RGBA32Buffer::FramePartial); 386 buffer->setStatus(RGBA32Buffer::FramePartial);
385 387
386 // Reset the alpha pixel tracker for this frame. 388 // Reset the alpha pixel tracker for this frame.
387 m_currentBufferSawAlpha = false; 389 m_currentBufferSawAlpha = false;
388 return true; 390 return true;
389 } 391 }
390 392
391 } // namespace WebCore 393 } // namespace WebCore
OLDNEW
« no previous file with comments | « WebCore/platform/image-decoders/ImageDecoder.cpp ('k') | WebCore/platform/image-decoders/qt/RGBA32BufferQt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698