mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1656 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
		
			
				
	
	
		
			167 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			167 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| Index: compositing_iosurface_layer_mac.mm
 | |
| ===================================================================
 | |
| --- compositing_iosurface_layer_mac.mm	(revision 261035)
 | |
| +++ compositing_iosurface_layer_mac.mm	(working copy)
 | |
| @@ -120,7 +120,7 @@
 | |
|        (context_ && context_->cgl_context() != glContext) ||
 | |
|        !renderWidgetHostView_ ||
 | |
|        !renderWidgetHostView_->compositing_iosurface_) {
 | |
| -    glClearColor(1, 1, 1, 1);
 | |
| +    glClearColor(0, 0, 0, 0);
 | |
|      glClear(GL_COLOR_BUFFER_BIT);
 | |
|      return;
 | |
|    }
 | |
| Index: compositing_iosurface_mac.mm
 | |
| ===================================================================
 | |
| --- compositing_iosurface_mac.mm	(revision 261035)
 | |
| +++ compositing_iosurface_mac.mm	(working copy)
 | |
| @@ -362,7 +362,7 @@
 | |
|      glUseProgram(0); CHECK_AND_SAVE_GL_ERROR();
 | |
|    } else {
 | |
|      // Should match the clear color of RenderWidgetHostViewMac.
 | |
| -    glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
 | |
| +    glClearColor(0, 0, 0, 0);
 | |
|      glClear(GL_COLOR_BUFFER_BIT);
 | |
|    }
 | |
|  
 | |
| Index: compositing_iosurface_shader_programs_mac.cc
 | |
| ===================================================================
 | |
| --- compositing_iosurface_shader_programs_mac.cc	(revision 261035)
 | |
| +++ compositing_iosurface_shader_programs_mac.cc	(working copy)
 | |
| @@ -11,6 +11,7 @@
 | |
|  #include "base/debug/trace_event.h"
 | |
|  #include "base/logging.h"
 | |
|  #include "base/memory/scoped_ptr.h"
 | |
| +#include "base/strings/stringprintf.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 @@
 | |
|      }
 | |
|  );
 | |
|  
 | |
| +float bgcolor[] = {1.0f, 1.0f, 1.0f};
 | |
|  
 | |
|  // Only calculates position.
 | |
|  const char kvsSolidWhite[] = GLSL_PROGRAM_AS_STRING(
 | |
| @@ -238,6 +240,16 @@
 | |
|    const GLuint shader = glCreateShader(shader_type);
 | |
|    DCHECK_NE(shader, 0u);
 | |
|  
 | |
| +  // Support customization of the background color.
 | |
| +  std::string bg_shader;
 | |
| +  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]);
 | |
| +    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 @@
 | |
|    Reset();
 | |
|  }
 | |
|  
 | |
| +// static
 | |
| +void CompositingIOSurfaceShaderPrograms::SetBackgroundColor(
 | |
| +    float r, float g, float b) {
 | |
| +  bgcolor[0] = r;
 | |
| +  bgcolor[1] = g;
 | |
| +  bgcolor[2] = b;
 | |
| +}
 | |
| +
 | |
|  GLuint CompositingIOSurfaceShaderPrograms::GetShaderProgram(int which) {
 | |
|    if (shader_programs_[which] == 0u) {
 | |
|      shader_programs_[which] =
 | |
| Index: compositing_iosurface_shader_programs_mac.h
 | |
| ===================================================================
 | |
| --- compositing_iosurface_shader_programs_mac.h	(revision 261035)
 | |
| +++ compositing_iosurface_shader_programs_mac.h	(working copy)
 | |
| @@ -48,6 +48,8 @@
 | |
|      return rgb_to_yv12_output_format_;
 | |
|    }
 | |
|  
 | |
| +  static void SetBackgroundColor(float r, float g, float b);
 | |
| +
 | |
|   protected:
 | |
|    FRIEND_TEST_ALL_PREFIXES(CompositingIOSurfaceTransformerTest,
 | |
|                             TransformsRGBToYV12);
 | |
| Index: render_widget_host_view_aura.cc
 | |
| ===================================================================
 | |
| --- render_widget_host_view_aura.cc	(revision 261035)
 | |
| +++ render_widget_host_view_aura.cc	(working copy)
 | |
| @@ -2685,8 +2685,10 @@
 | |
|      // For non-opaque windows, we don't draw anything, since we depend on the
 | |
|      // canvas coming from the compositor to already be initialized as
 | |
|      // transparent.
 | |
| -    if (window_->layer()->fills_bounds_opaquely())
 | |
| -      canvas->DrawColor(SK_ColorWHITE);
 | |
| +    if (window_->layer()->fills_bounds_opaquely()) {
 | |
| +      canvas->DrawColor(GetContentClient()->browser()->GetBaseBackgroundColor(
 | |
| +          RenderViewHost::From(host_)));
 | |
| +    }
 | |
|    }
 | |
|  }
 | |
|  
 | |
| Index: render_widget_host_view_mac.mm
 | |
| ===================================================================
 | |
| --- render_widget_host_view_mac.mm	(revision 261035)
 | |
| +++ render_widget_host_view_mac.mm	(working copy)
 | |
| @@ -434,7 +434,7 @@
 | |
|      use_core_animation_ = true;
 | |
|      background_layer_.reset([[CALayer alloc] init]);
 | |
|      [background_layer_
 | |
| -        setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
 | |
| +        setBackgroundColor:CGColorGetConstantColor(kCGColorClear)];
 | |
|      [cocoa_view_ setLayer:background_layer_];
 | |
|      [cocoa_view_ setWantsLayer:YES];
 | |
|    }
 | |
| @@ -3087,7 +3087,7 @@
 | |
|  
 | |
|      NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)];
 | |
|      CGContextSetFillColorWithColor(context,
 | |
| -                                   CGColorGetConstantColor(kCGColorWhite));
 | |
| +                                   CGColorGetConstantColor(kCGColorClear));
 | |
|      CGContextFillRect(context, NSRectToCGRect(r));
 | |
|    }
 | |
|    if (damagedRect.bottom() > rect.bottom()) {
 | |
| @@ -3109,7 +3109,7 @@
 | |
|  
 | |
|      NSRect r = [self flipRectToNSRect:gfx::Rect(x, y, width, height)];
 | |
|      CGContextSetFillColorWithColor(context,
 | |
| -                                   CGColorGetConstantColor(kCGColorWhite));
 | |
| +                                   CGColorGetConstantColor(kCGColorClear));
 | |
|      CGContextFillRect(context, NSRectToCGRect(r));
 | |
|    }
 | |
|  }
 | |
| @@ -3259,7 +3259,7 @@
 | |
|      }
 | |
|    } else {
 | |
|      CGContextSetFillColorWithColor(context,
 | |
| -                                   CGColorGetConstantColor(kCGColorWhite));
 | |
| +                                   CGColorGetConstantColor(kCGColorClear));
 | |
|      CGContextFillRect(context, dirtyRect);
 | |
|      if (renderWidgetHostView_->whiteout_start_time_.is_null())
 | |
|        renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now();
 | |
| @@ -4282,7 +4282,7 @@
 | |
|    if (self = [super init]) {
 | |
|      renderWidgetHostView_ = r;
 | |
|  
 | |
| -    [self setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
 | |
| +    [self setBackgroundColor:CGColorGetConstantColor(kCGColorClear)];
 | |
|      [self setAnchorPoint:CGPointMake(0, 0)];
 | |
|      // Setting contents gravity is necessary to prevent the layer from being
 | |
|      // scaled during dyanmic resizes (especially with devtools open).
 | |
| @@ -4311,7 +4311,7 @@
 | |
|                                                  inContext:context];
 | |
|    } else {
 | |
|      CGContextSetFillColorWithColor(context,
 | |
| -                                   CGColorGetConstantColor(kCGColorWhite));
 | |
| +                                   CGColorGetConstantColor(kCGColorClear));
 | |
|      CGContextFillRect(context, clipRect);
 | |
|    }
 | |
|  }
 |