• halcanary@google.com's avatar
    GIF decode: optional error messages and fault tolerance. · 29d4e638
    halcanary@google.com authored
    Add new runtime configuration variable,
    images.gif.suppressDecoderWarnings, which suppresses warning and
    errors from the GIF library.  It defaults to "true", which is current
    behavior.
    
    (This setting can be changed by setting the environment variable
    skia_images_gif_suppressDecoderWarnings="false".)
    
    Some conditions which were errors before are now warnings:
    
    -   If the image width or height is greater than the GIF screen width or
        height (respectively) we expand the screen to hold the image.
    
    -   If the offset of the image inside the screen would place the
        image outside of the screen, we shift the image to fix this.
    
    -   If the image lacks a color table, we create a default color table.
    
    -   If the image is truncated, then the rest of the image is filled with
        the fill color.
    
    In all four cases, if images.gif.suppressDecoderWarnings is set to
    false, then a warning message is printed via SkDebugf.
    
    In the event of another kind of error, SkGIFImageDecoder::onDecode()
    will still return false.  But with this change, if
    images.gif.suppressDecoderWarnings is set to false, a description of
    the error is printed via SkDebugf.
    
    Also, added a new unit test GifTest, which tests the deconing of both
    good GIf files and corrupted files that should now work with this
    change.  This unit test is disabled on Win32, iOS, and Mac.
    
    BUG=skia:1689
    R=scroggo@google.com
    
    Review URL: https://codereview.chromium.org/26743002
    
    git-svn-id: http://skia.googlecode.com/svn/trunk@11734 2bbb7eff-a529-9590-31e7-b0007b416f81
    29d4e638
tests.gyp 5.8 KB