Bug 1355898. Use the first frame of animated images for texImage2d. r=jgilbert. a=gchang
The spec for canvas drawImage says to use the first frame. I can't find anything spec related at all referencing the issue for webgl (except
bug 666855). So do the same as drawImage.
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -289,17 +289,21 @@ FromImageData(WebGLContext* webgl, const
isAlphaPremult);
}
UniquePtr<webgl::TexUnpackBlob>
WebGLContext::FromDomElem(const char* funcName, TexImageTarget target, uint32_t width,
uint32_t height, uint32_t depth, const dom::Element& elem,
ErrorResult* const out_error)
{
- uint32_t flags = nsLayoutUtils::SFE_WANT_IMAGE_SURFACE |
+ // The canvas spec says that drawImage should draw the first frame of
+ // animated images. The webgl spec doesn't mention the issue, so we do the
+ // same as drawImage.
+ uint32_t flags = nsLayoutUtils::SFE_WANT_FIRST_FRAME_IF_IMAGE |
+ nsLayoutUtils::SFE_WANT_IMAGE_SURFACE |
nsLayoutUtils::SFE_USE_ELEMENT_SIZE_IF_VECTOR;
if (mPixelStore_ColorspaceConversion == LOCAL_GL_NONE)
flags |= nsLayoutUtils::SFE_NO_COLORSPACE_CONVERSION;
if (!mPixelStore_PremultiplyAlpha)
flags |= nsLayoutUtils::SFE_PREFER_NO_PREMULTIPLY_ALPHA;