Title: [104192] trunk/Source/WebCore
Revision
104192
Author
[email protected]
Date
2012-01-05 12:02:19 -0800 (Thu, 05 Jan 2012)

Log Message

Remove style warning in GraphicsContext3DOpenGL.cpp
https://bugs.webkit.org/show_bug.cgi?id=75466

Patch by ChangSeok Oh <[email protected]> on 2012-01-05
Reviewed by Kenneth Russell.

Relocated some headers according to alphabetical order & modified indentation.
And used OwnArrayPtr to deal with character array.

No new tests required.

* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::getString):
(WebCore::GraphicsContext3D::releaseShaderCompiler):
(WebCore::GraphicsContext3D::getProgramInfoLog):
(WebCore::GraphicsContext3D::getShaderiv):
(WebCore::GraphicsContext3D::getShaderInfoLog):
(WebCore::GraphicsContext3D::getShaderSource):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104191 => 104192)


--- trunk/Source/WebCore/ChangeLog	2012-01-05 19:55:40 UTC (rev 104191)
+++ trunk/Source/WebCore/ChangeLog	2012-01-05 20:02:19 UTC (rev 104192)
@@ -1,3 +1,23 @@
+2012-01-05  ChangSeok Oh  <[email protected]>
+
+        Remove style warning in GraphicsContext3DOpenGL.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=75466
+
+        Reviewed by Kenneth Russell.
+
+        Relocated some headers according to alphabetical order & modified indentation.
+        And used OwnArrayPtr to deal with character array.
+
+        No new tests required. 
+
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::getString):
+        (WebCore::GraphicsContext3D::releaseShaderCompiler):
+        (WebCore::GraphicsContext3D::getProgramInfoLog):
+        (WebCore::GraphicsContext3D::getShaderiv):
+        (WebCore::GraphicsContext3D::getShaderInfoLog):
+        (WebCore::GraphicsContext3D::getShaderSource):
+
 2012-01-05  Ken Buchanan <[email protected]>
 
         Crash due to reparenting of relpositioned object under anonymous block

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (104191 => 104192)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2012-01-05 19:55:40 UTC (rev 104191)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2012-01-05 20:02:19 UTC (rev 104192)
@@ -25,15 +25,10 @@
 
 #include "config.h"
 
-#if PLATFORM(QT)
-#include <QtGlobal>
-#endif
-
 #if ENABLE(WEBGL)
 
 #include "GraphicsContext3D.h"
 
-#include "WebGLObject.h"
 #include "CanvasRenderingContext.h"
 #include "Extensions3DOpenGL.h"
 #include "GraphicsContext.h"
@@ -41,6 +36,7 @@
 #include "ImageBuffer.h"
 #include "ImageData.h"
 #include "NotImplemented.h"
+#include "WebGLObject.h"
 #include <cstring>
 #include <wtf/ArrayBuffer.h>
 #include <wtf/ArrayBufferView.h>
@@ -55,6 +51,7 @@
 #elif PLATFORM(GTK)
 #include "OpenGLShims.h"
 #elif PLATFORM(QT)
+#include <QtGlobal>
 #include <cairo/OpenGLShims.h>
 #endif
 
@@ -773,7 +770,7 @@
 String GraphicsContext3D::getString(GC3Denum name)
 {
     makeContextCurrent();
-    return String((const char*) ::glGetString(name));
+    return String(reinterpret_cast<const char*>(::glGetString(name)));
 }
 
 void GraphicsContext3D::hint(GC3Denum target, GC3Denum mode)
@@ -887,9 +884,9 @@
 
 void GraphicsContext3D::releaseShaderCompiler()
 {
-    // FIXME: This is not implemented on desktop OpenGL. We need to have ifdefs for the different GL variants
+    // FIXME: This is not implemented on desktop OpenGL. We need to have ifdefs for the different GL variants.
     makeContextCurrent();
-    //::glReleaseShaderCompiler();
+    notImplemented();
 }
 
 void GraphicsContext3D::renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height)
@@ -1245,18 +1242,16 @@
     ASSERT(program);
 
     makeContextCurrent();
-    GLint length;
+    GLint length = 0;
     ::glGetProgramiv(program, GL_INFO_LOG_LENGTH, &length);
     if (!length)
-        return "";
+        return String(); 
 
-    GLsizei size;
-    GLchar* info = (GLchar*) fastMalloc(length);
+    GLsizei size = 0;
+    OwnArrayPtr<GLchar> info = adoptArrayPtr(static_cast<GLchar*>(fastMalloc(length)));
+    ::glGetProgramInfoLog(program, length, &size, info.get());
 
-    ::glGetProgramInfoLog(program, length, &size, info);
-    String s(info);
-    fastFree(info);
-    return s;
+    return String(info.get());
 }
 
 void GraphicsContext3D::getRenderbufferParameteriv(GC3Denum target, GC3Denum pname, GC3Dint* value)
@@ -1274,37 +1269,29 @@
     HashMap<Platform3DObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader);
     
     switch (pname) {
-        case DELETE_STATUS:
-        case SHADER_TYPE:
-            // Let OpenGL handle these.
-        
-            ::glGetShaderiv(shader, pname, value);
-            break;
-        
-        case COMPILE_STATUS:
-            if (result == m_shaderSourceMap.end()) {
-                (*value) = static_cast<int>(false);
-                return;
-            }
-        
-            (*value) = static_cast<int>(result->second.isValid);
-            break;
-        
-        case INFO_LOG_LENGTH:
-            if (result == m_shaderSourceMap.end()) {
-                (*value) = 0;
-                return;
-            }
-        
-            (*value) = getShaderInfoLog(shader).length();
-            break;
-        
-        case SHADER_SOURCE_LENGTH:
-            (*value) = getShaderSource(shader).length();
-            break;
-        
-        default:
-            synthesizeGLError(INVALID_ENUM);
+    case DELETE_STATUS:
+    case SHADER_TYPE:
+        ::glGetShaderiv(shader, pname, value);
+        break;
+    case COMPILE_STATUS:
+        if (result == m_shaderSourceMap.end()) {
+            *value = static_cast<int>(false);
+            return;
+        }
+        *value = static_cast<int>(result->second.isValid);
+        break;
+    case INFO_LOG_LENGTH:
+        if (result == m_shaderSourceMap.end()) {
+            *value = 0;
+            return;
+        }
+        *value = getShaderInfoLog(shader).length();
+        break;
+    case SHADER_SOURCE_LENGTH:
+        *value = getShaderSource(shader).length();
+        break;
+    default:
+        synthesizeGLError(INVALID_ENUM);
     }
 }
 
@@ -1315,28 +1302,23 @@
     makeContextCurrent();
 
     HashMap<Platform3DObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader);
-
     if (result == m_shaderSourceMap.end())
-         return "";
+        return String(); 
 
-     ShaderSourceEntry entry = result->second;
+    ShaderSourceEntry entry = result->second;
+    if (!entry.isValid)
+        return entry.log;
 
-     if (entry.isValid) {
-         GLint length;
-         ::glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
-         if (!length)
-             return "";
+    GLint length = 0;
+    ::glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
+    if (!length)
+        return String(); 
 
-         GLsizei size;
-         GLchar* info = (GLchar*) fastMalloc(length);
+    GLsizei size = 0;
+    OwnArrayPtr<GLchar> info = adoptArrayPtr(static_cast<GLchar*>(fastMalloc(length)));
+    ::glGetShaderInfoLog(shader, length, &size, info.get());
 
-         ::glGetShaderInfoLog(shader, length, &size, info);
-
-         String s(info);
-         fastFree(info);
-         return s;
-     } else
-         return entry.log;
+    return String(info.get());
 }
 
 String GraphicsContext3D::getShaderSource(Platform3DObject shader)
@@ -1346,9 +1328,8 @@
     makeContextCurrent();
 
     HashMap<Platform3DObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader);
-
     if (result == m_shaderSourceMap.end())
-        return "";
+        return String(); 
 
     return result->second.source;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to