Skip to content
  • dino@apple.com's avatar
    [WebGL] CoreGraphics can provide greyscale image data · 24b242ea
    dino@apple.com authored
    https://webkit.org/b/120443
    
    Reviewed by Simon Fraser.
    
    Source/WebCore:
    
    CoreGraphics can decode greyscale or greyscale+alpha images
    while preserving the format. Our WebGL texture unpacker
    was seeing this and assuming it meant the data did not come
    from an <img> element. Since that method already special cased
    CoreGraphics, the fix was to simply return true for these
    extra types.
    
    I also renamed srcFormatComeFromDOMElementOrImageData
    to srcFormatComesFromDOMElementOrImageData.
    
    Test: fast/canvas/webgl/tex-image-with-greyscale-image.html
    
    * platform/graphics/GraphicsContext3D.cpp: Call new name.
    * platform/graphics/GraphicsContext3D.h:
    (WebCore::GraphicsContext3D::srcFormatComesFromDOMElementOrImageData):
    Add support for R8, AR8, A8, and RA8 data formats.
    
    LayoutTests:
    
    New test that attempts to load and draw an image that only has grey
    and alpha channels.
    
    * fast/canvas/webgl/resources/greyscale.png: Added.
    * fast/canvas/webgl/tex-image-with-greyscale-image-expected.txt: Added.
    * fast/canvas/webgl/tex-image-with-greyscale-image.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    24b242ea