Mac: Fix locale error with GL shader (issue #1270).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1702 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2014-05-07 20:40:09 +00:00
parent 63c980ecc0
commit 791c0ff12c
1 changed files with 9 additions and 6 deletions

View File

@ -28,15 +28,16 @@ Index: compositing_iosurface_shader_programs_mac.cc
===================================================================
--- compositing_iosurface_shader_programs_mac.cc (revision 263053)
+++ compositing_iosurface_shader_programs_mac.cc (working copy)
@@ -11,6 +11,7 @@
@@ -11,6 +11,8 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/strings/stringprintf.h"
+#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
@@ -51,6 +52,7 @@
@@ -51,6 +53,7 @@
}
);
@ -44,7 +45,7 @@ Index: compositing_iosurface_shader_programs_mac.cc
// Only calculates position.
const char kvsSolidWhite[] = GLSL_PROGRAM_AS_STRING(
@@ -238,6 +240,16 @@
@@ -238,6 +241,18 @@
const GLuint shader = glCreateShader(shader_type);
DCHECK_NE(shader, 0u);
@ -53,15 +54,17 @@ Index: compositing_iosurface_shader_programs_mac.cc
+ if (shader_program == SHADER_PROGRAM_SOLID_WHITE &&
+ shader_type == GL_FRAGMENT_SHADER) {
+ bg_shader = base::StringPrintf(
+ "void main() { gl_FragColor = vec4(%f, %f, %f, 1.0); }",
+ bgcolor[0], bgcolor[1], bgcolor[2]);
+ "void main() { gl_FragColor = vec4(%s, %s, %s, 1.0); }",
+ base::DoubleToString(bgcolor[0]).c_str(),
+ base::DoubleToString(bgcolor[1]).c_str(),
+ base::DoubleToString(bgcolor[2]).c_str());
+ kFragmentShaderSourceCodeMap[shader_program] = bg_shader.c_str();
+ }
+
// Select and compile the shader program source code.
if (shader_type == GL_VERTEX_SHADER) {
const GLchar* source_snippets[] = {
@@ -412,6 +424,14 @@
@@ -412,6 +427,14 @@
Reset();
}