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

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1916@1703 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2014-05-07 20:42:58 +00:00
parent 1bee375f4b
commit ad6e5f4f76
1 changed files with 42 additions and 39 deletions

View File

@ -1,7 +1,7 @@
diff --git compositing_iosurface_layer_mac.mm compositing_iosurface_layer_mac.mm Index: compositing_iosurface_layer_mac.mm
index 08d3d4d..02467a7 100644 ===================================================================
--- compositing_iosurface_layer_mac.mm --- compositing_iosurface_layer_mac.mm (revision 266998)
+++ compositing_iosurface_layer_mac.mm +++ compositing_iosurface_layer_mac.mm (working copy)
@@ -117,7 +117,7 @@ @@ -117,7 +117,7 @@
(context_ && context_->cgl_context() != glContext) || (context_ && context_->cgl_context() != glContext) ||
!renderWidgetHostView_ || !renderWidgetHostView_ ||
@ -11,11 +11,11 @@ index 08d3d4d..02467a7 100644
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
return; return;
} }
diff --git compositing_iosurface_mac.mm compositing_iosurface_mac.mm Index: compositing_iosurface_mac.mm
index 45f4758..ed071b2 100644 ===================================================================
--- compositing_iosurface_mac.mm --- compositing_iosurface_mac.mm (revision 266998)
+++ compositing_iosurface_mac.mm +++ compositing_iosurface_mac.mm (working copy)
@@ -362,7 +362,7 @@ bool CompositingIOSurfaceMac::DrawIOSurface( @@ -362,7 +362,7 @@
glUseProgram(0); CHECK_AND_SAVE_GL_ERROR(); glUseProgram(0); CHECK_AND_SAVE_GL_ERROR();
} else { } else {
// Should match the clear color of RenderWidgetHostViewMac. // Should match the clear color of RenderWidgetHostViewMac.
@ -24,19 +24,20 @@ index 45f4758..ed071b2 100644
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
} }
diff --git compositing_iosurface_shader_programs_mac.cc compositing_iosurface_shader_programs_mac.cc Index: compositing_iosurface_shader_programs_mac.cc
index 753c180..c5f09f1 100644 ===================================================================
--- compositing_iosurface_shader_programs_mac.cc --- compositing_iosurface_shader_programs_mac.cc (revision 266998)
+++ compositing_iosurface_shader_programs_mac.cc +++ compositing_iosurface_shader_programs_mac.cc (working copy)
@@ -11,6 +11,7 @@ @@ -11,6 +11,8 @@
#include "base/debug/trace_event.h" #include "base/debug/trace_event.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
+#include "base/strings/stringprintf.h" +#include "base/strings/stringprintf.h"
+#include "base/strings/string_number_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_data_manager_impl.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h" #include "gpu/config/gpu_driver_bug_workaround_type.h"
@@ -51,6 +52,7 @@ const char kfsBlit[] = GLSL_PROGRAM_AS_STRING( @@ -51,6 +53,7 @@
} }
); );
@ -44,7 +45,7 @@ index 753c180..c5f09f1 100644
// Only calculates position. // Only calculates position.
const char kvsSolidWhite[] = GLSL_PROGRAM_AS_STRING( const char kvsSolidWhite[] = GLSL_PROGRAM_AS_STRING(
@@ -238,6 +240,16 @@ GLuint CompileShaderGLSL(ShaderProgram shader_program, GLenum shader_type, @@ -238,6 +241,18 @@
const GLuint shader = glCreateShader(shader_type); const GLuint shader = glCreateShader(shader_type);
DCHECK_NE(shader, 0u); DCHECK_NE(shader, 0u);
@ -53,15 +54,17 @@ index 753c180..c5f09f1 100644
+ if (shader_program == SHADER_PROGRAM_SOLID_WHITE && + if (shader_program == SHADER_PROGRAM_SOLID_WHITE &&
+ shader_type == GL_FRAGMENT_SHADER) { + shader_type == GL_FRAGMENT_SHADER) {
+ bg_shader = base::StringPrintf( + bg_shader = base::StringPrintf(
+ "void main() { gl_FragColor = vec4(%f, %f, %f, 1.0); }", + "void main() { gl_FragColor = vec4(%s, %s, %s, 1.0); }",
+ bgcolor[0], bgcolor[1], bgcolor[2]); + 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(); + kFragmentShaderSourceCodeMap[shader_program] = bg_shader.c_str();
+ } + }
+ +
// Select and compile the shader program source code. // Select and compile the shader program source code.
if (shader_type == GL_VERTEX_SHADER) { if (shader_type == GL_VERTEX_SHADER) {
const GLchar* source_snippets[] = { const GLchar* source_snippets[] = {
@@ -412,6 +424,14 @@ void CompositingIOSurfaceShaderPrograms::SetOutputFormatForTesting( @@ -412,6 +427,14 @@
Reset(); Reset();
} }
@ -76,11 +79,11 @@ index 753c180..c5f09f1 100644
GLuint CompositingIOSurfaceShaderPrograms::GetShaderProgram(int which) { GLuint CompositingIOSurfaceShaderPrograms::GetShaderProgram(int which) {
if (shader_programs_[which] == 0u) { if (shader_programs_[which] == 0u) {
shader_programs_[which] = shader_programs_[which] =
diff --git compositing_iosurface_shader_programs_mac.h compositing_iosurface_shader_programs_mac.h Index: compositing_iosurface_shader_programs_mac.h
index de1987f..d36b988 100644 ===================================================================
--- compositing_iosurface_shader_programs_mac.h --- compositing_iosurface_shader_programs_mac.h (revision 266998)
+++ compositing_iosurface_shader_programs_mac.h +++ compositing_iosurface_shader_programs_mac.h (working copy)
@@ -48,6 +48,8 @@ class CompositingIOSurfaceShaderPrograms { @@ -48,6 +48,8 @@
return rgb_to_yv12_output_format_; return rgb_to_yv12_output_format_;
} }
@ -89,11 +92,11 @@ index de1987f..d36b988 100644
protected: protected:
FRIEND_TEST_ALL_PREFIXES(CompositingIOSurfaceTransformerTest, FRIEND_TEST_ALL_PREFIXES(CompositingIOSurfaceTransformerTest,
TransformsRGBToYV12); TransformsRGBToYV12);
diff --git render_widget_host_view_aura.cc render_widget_host_view_aura.cc Index: render_widget_host_view_aura.cc
index 8493660..ce185939 100644 ===================================================================
--- render_widget_host_view_aura.cc --- render_widget_host_view_aura.cc (revision 266998)
+++ render_widget_host_view_aura.cc +++ render_widget_host_view_aura.cc (working copy)
@@ -2685,8 +2685,14 @@ void RenderWidgetHostViewAura::OnPaint(gfx::Canvas* canvas) { @@ -2685,8 +2685,14 @@
// For non-opaque windows, we don't draw anything, since we depend on the // For non-opaque windows, we don't draw anything, since we depend on the
// canvas coming from the compositor to already be initialized as // canvas coming from the compositor to already be initialized as
// transparent. // transparent.
@ -110,11 +113,11 @@ index 8493660..ce185939 100644
} }
} }
diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm Index: render_widget_host_view_mac.mm
index 9cdbc07..4f9c19e 100644 ===================================================================
--- render_widget_host_view_mac.mm --- render_widget_host_view_mac.mm (revision 266998)
+++ render_widget_host_view_mac.mm +++ render_widget_host_view_mac.mm (working copy)
@@ -440,7 +440,7 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget) @@ -440,7 +440,7 @@
use_core_animation_ = true; use_core_animation_ = true;
background_layer_.reset([[CALayer alloc] init]); background_layer_.reset([[CALayer alloc] init]);
[background_layer_ [background_layer_
@ -123,7 +126,7 @@ index 9cdbc07..4f9c19e 100644
[cocoa_view_ setLayer:background_layer_]; [cocoa_view_ setLayer:background_layer_];
[cocoa_view_ setWantsLayer:YES]; [cocoa_view_ setWantsLayer:YES];
} }
@@ -3108,7 +3108,7 @@ SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() { @@ -3108,7 +3108,7 @@
NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)]; NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)];
CGContextSetFillColorWithColor(context, CGContextSetFillColorWithColor(context,
@ -132,7 +135,7 @@ index 9cdbc07..4f9c19e 100644
CGContextFillRect(context, NSRectToCGRect(r)); CGContextFillRect(context, NSRectToCGRect(r));
} }
if (damagedRect.bottom() > rect.bottom()) { if (damagedRect.bottom() > rect.bottom()) {
@@ -3130,7 +3130,7 @@ SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() { @@ -3130,7 +3130,7 @@
NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)]; NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)];
CGContextSetFillColorWithColor(context, CGContextSetFillColorWithColor(context,
@ -141,7 +144,7 @@ index 9cdbc07..4f9c19e 100644
CGContextFillRect(context, NSRectToCGRect(r)); CGContextFillRect(context, NSRectToCGRect(r));
} }
} }
@@ -3280,7 +3280,7 @@ SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() { @@ -3280,7 +3280,7 @@
} }
} else { } else {
CGContextSetFillColorWithColor(context, CGContextSetFillColorWithColor(context,
@ -150,7 +153,7 @@ index 9cdbc07..4f9c19e 100644
CGContextFillRect(context, dirtyRect); CGContextFillRect(context, dirtyRect);
if (renderWidgetHostView_->whiteout_start_time_.is_null()) if (renderWidgetHostView_->whiteout_start_time_.is_null())
renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now(); renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now();
@@ -4303,7 +4303,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName; @@ -4303,7 +4303,7 @@
if (self = [super init]) { if (self = [super init]) {
renderWidgetHostView_ = r; renderWidgetHostView_ = r;
@ -159,7 +162,7 @@ index 9cdbc07..4f9c19e 100644
[self setAnchorPoint:CGPointMake(0, 0)]; [self setAnchorPoint:CGPointMake(0, 0)];
// Setting contents gravity is necessary to prevent the layer from being // Setting contents gravity is necessary to prevent the layer from being
// scaled during dyanmic resizes (especially with devtools open). // scaled during dyanmic resizes (especially with devtools open).
@@ -4332,7 +4332,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName; @@ -4332,7 +4332,7 @@
inContext:context]; inContext:context];
} else { } else {
CGContextSetFillColorWithColor(context, CGContextSetFillColorWithColor(context,