Bug 1355898. Use the first frame of animated images for texImage2d. r=jgilbert. a=gchang
☠☠ backed out by de3b2daf03b4 ☠ ☠
authorTimothy Nikkel <tnikkel@gmail.com>
Tue, 18 Apr 2017 17:58:34 +0800
changeset 375967 3bab94261ee0
parent 375966 076f4a79219b
child 375968 7595a01c76d1
push id11069
push userihsiao@mozilla.com
push date2017-04-18 10:00 +0000
treeherdermozilla-aurora@7595a01c76d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, gchang
bugs1355898, 666855
milestone54.0a2
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.
dom/canvas/WebGLTextureUpload.cpp
--- 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;