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

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

Issue 2618633004: Add support for Animated PNG (Closed)
Patch Set: Reject bad data. Cleanups Created 3 years, 10 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) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 if (prevBuffer->getDisposalMethod() == 375 if (prevBuffer->getDisposalMethod() ==
376 ImageFrame::DisposeOverwriteBgcolor) { 376 ImageFrame::DisposeOverwriteBgcolor) {
377 // We want to clear the previous frame to transparent, without 377 // We want to clear the previous frame to transparent, without
378 // affecting pixels in the image outside of the frame. 378 // affecting pixels in the image outside of the frame.
379 const IntRect& prevRect = prevBuffer->originalFrameRect(); 379 const IntRect& prevRect = prevBuffer->originalFrameRect();
380 DCHECK(!prevRect.contains(IntRect(IntPoint(), size()))); 380 DCHECK(!prevRect.contains(IntRect(IntPoint(), size())));
381 buffer->zeroFillFrameRect(prevRect); 381 buffer->zeroFillFrameRect(prevRect);
382 } 382 }
383 } 383 }
384 384
385 if (!onInitFrameBuffer(frameIndex))
386 return setFailed();
387
385 // Update our status to be partially complete. 388 // Update our status to be partially complete.
386 buffer->setStatus(ImageFrame::FramePartial); 389 buffer->setStatus(ImageFrame::FramePartial);
387 390
388 onInitFrameBuffer(frameIndex);
389 return true; 391 return true;
390 } 392 }
391 393
392 void ImageDecoder::updateAggressivePurging(size_t index) { 394 void ImageDecoder::updateAggressivePurging(size_t index) {
393 if (m_purgeAggressively) 395 if (m_purgeAggressively)
394 return; 396 return;
395 397
396 // We don't want to cache so much that we cause a memory issue. 398 // We don't want to cache so much that we cause a memory issue.
397 // 399 //
398 // If we used a LRU cache we would fill it and then on next animation loop 400 // If we used a LRU cache we would fill it and then on next animation loop
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const { 544 sk_sp<SkColorSpace> ImageDecoder::colorSpaceForSkImages() const {
543 if (!m_colorBehavior.isTag()) 545 if (!m_colorBehavior.isTag())
544 return nullptr; 546 return nullptr;
545 547
546 if (m_embeddedColorSpace) 548 if (m_embeddedColorSpace)
547 return m_embeddedColorSpace; 549 return m_embeddedColorSpace;
548 return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); 550 return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
549 } 551 }
550 552
551 } // namespace blink 553 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698