r?jrmuizel - Use existing can-I-read-from-this helper. draft
authorJeff Gilbert <jdashg@gmail.com>
Thu, 26 May 2016 18:08:31 -0700
changeset 371890 364fb576e14b45e2a6861668fbf04b8adf98d906
parent 371889 a2a8f632b7a91062f22f4db923f4f26de6f8468a
child 522043 fc075be2a74b606e086a1bfdf941ce1c99191d5c
push id19380
push userjgilbert@mozilla.com
push dateFri, 27 May 2016 01:10:45 +0000
reviewersjrmuizel
milestone49.0a1
r?jrmuizel - Use existing can-I-read-from-this helper. From de1398f53d90e508367de67e5f4e024a1e41134f Mon Sep 17 00:00:00 2001 --- dom/canvas/WebGLContextState.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) MozReview-Commit-ID: Lrfvga5VJqW
dom/canvas/WebGLContextState.cpp
--- a/dom/canvas/WebGLContextState.cpp
+++ b/dom/canvas/WebGLContextState.cpp
@@ -375,47 +375,37 @@ WebGLContext::GetParameter(JSContext* cx
         case LOCAL_GL_BLEND_EQUATION_RGB:
         case LOCAL_GL_BLEND_EQUATION_ALPHA:
         case LOCAL_GL_GENERATE_MIPMAP_HINT: {
             GLint i = 0;
             gl->fGetIntegerv(pname, &i);
             return JS::NumberValue(uint32_t(i));
         }
         case LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE: {
-            if (mBoundReadFramebuffer) {
-                nsCString fbStatusInfoIgnored;
-                const auto status = mBoundReadFramebuffer->CheckFramebufferStatus(&fbStatusInfoIgnored);
-                if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
-                    ErrorInvalidOperation("getParameter: Read framebuffer must be"
-                                          " complete before querying"
-                                          " IMPLEMENTATION_COLOR_READ_TYPE.");
-                    return JS::NullValue();
-                }
-            }
+            const webgl::FormatUsageInfo* usage;
+            uint32_t width, height;
+            GLenum mode;
+            if (!ValidateCurFBForRead(funcName, &usage, &width, &height, &mode))
+                return JS::NullValue();
 
             GLint i = 0;
             if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
                 gl->fGetIntegerv(pname, &i);
             } else {
                 i = LOCAL_GL_UNSIGNED_BYTE;
             }
 
             return JS::NumberValue(uint32_t(i));
         }
         case LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT: {
-            if (mBoundReadFramebuffer) {
-                nsCString fbStatusInfoIgnored;
-                const auto status = mBoundReadFramebuffer->CheckFramebufferStatus(&fbStatusInfoIgnored);
-                if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
-                    ErrorInvalidOperation("getParameter: Read framebuffer must be"
-                                          " complete before querying"
-                                          " IMPLEMENTATION_COLOR_READ_FORMAT.");
-                    return JS::NullValue();
-                }
-            }
+            const webgl::FormatUsageInfo* usage;
+            uint32_t width, height;
+            GLenum mode;
+            if (!ValidateCurFBForRead(funcName, &usage, &width, &height, &mode))
+                return JS::NullValue();
 
             GLint i = 0;
             if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
                 gl->fGetIntegerv(pname, &i);
             } else {
                 i = LOCAL_GL_RGBA;
             }