[webkit-reviews] review granted: [Bug 177864] [GTK][WPE] GIFImageDecoder never clears decoded frames even when told to do so : [Attachment 322809] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 5 02:51:33 PDT 2017


Carlos Garcia Campos <cgarcia at igalia.com> has granted Miguel Gomez
<magomez at igalia.com>'s request for review:
Bug 177864: [GTK][WPE] GIFImageDecoder never clears decoded frames even when
told to do so
https://bugs.webkit.org/show_bug.cgi?id=177864

Attachment 322809: Patch

https://bugs.webkit.org/attachment.cgi?id=322809&action=review




--- Comment #3 from Carlos Garcia Campos <cgarcia at igalia.com> ---
Comment on attachment 322809
  --> https://bugs.webkit.org/attachment.cgi?id=322809
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322809&action=review

> Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp:110
> +    for (size_t i = frameIndex; i > 0; i--) {

we normally do --i in for loops.

> Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp:128
> +	       const GIFFrameContext* frameContext = m_reader->frameContext(i -
1);

const auto*. This can return nullptr, if we know for sure we should never get
nullptr in this particular case, then add an assert, otherwise, handle the null
case here, I guess continuing the loop.

> Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp:133
> +	       if (frameRect.contains(IntRect(IntPoint(), size())))

I think you can do something like

if (frameRect.contains({ { }, size() } })))

> Source/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp:149
> +	   size_t startFrame = findFirstRequiredFrameToDecode(index);
> +	   for (size_t i = startFrame; i <= index; i++)

This could probably be a single line

for (auto i = findFirstRequiredFrameToDecode(index); i <= index; ++i)

> Source/WebCore/platform/image-decoders/gif/GIFImageReader.h:289
> +	   return frame < m_frames.size() ? m_frames[frame].get() : 0;

0 -> nullptr


More information about the webkit-reviews mailing list