 Chromium Code Reviews
 Chromium Code Reviews Issue 959283004:
  Background filters are affected by masks  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 959283004:
  Background filters are affected by masks  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: cc/output/shader.h | 
| diff --git a/cc/output/shader.h b/cc/output/shader.h | 
| index 93407d4cc892a12bfd375cde7e89514ce6ec8928..e814ed3dc8e1e46ea2520497574a19cd32bc0900 100644 | 
| --- a/cc/output/shader.h | 
| +++ b/cc/output/shader.h | 
| @@ -59,6 +59,23 @@ enum BlendMode { | 
| LAST_BLEND_MODE = BLEND_MODE_LUMINOSITY | 
| }; | 
| +struct ShaderLocations { | 
| 
enne (OOO)
2015/03/02 23:34:41
This seems like a good refactoring.  Can you split
 | 
| + int quad = -1; | 
| + int edge = -1; | 
| + int viewport = -1; | 
| + int mask_sampler = -1; | 
| + int mask_tex_coord_scale = -1; | 
| + int mask_tex_coord_offset = -1; | 
| + int matrix = -1; | 
| + int alpha = -1; | 
| + int color_matrix = -1; | 
| + int color_offset = -1; | 
| + int tex_transform = -1; | 
| + int backdrop = -1; | 
| + int backdrop_rect = -1; | 
| + int original_backdrop = -1; | 
| +}; | 
| + | 
| // Note: The highp_threshold_cache must be provided by the caller to make | 
| // the caching multi-thread/context safe in an easy low-overhead manner. | 
| // The caller must make sure to clear highp_threshold_cache to 0, so it can be | 
| @@ -156,6 +173,7 @@ class VertexShaderPosTexTransform { | 
| std::string GetShaderString() const; | 
| static std::string GetShaderHead(); | 
| static std::string GetShaderBody(); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| int matrix_location() const { return matrix_location_; } | 
| int tex_transform_location() const { return tex_transform_location_; } | 
| @@ -228,6 +246,7 @@ class VertexShaderQuadTexTransformAA { | 
| std::string GetShaderString() const; | 
| static std::string GetShaderHead(); | 
| static std::string GetShaderBody(); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| int matrix_location() const { return matrix_location_; } | 
| int viewport_location() const { return viewport_location_; } | 
| @@ -325,11 +344,16 @@ class VertexShaderVideoTransform { | 
| class FragmentTexBlendMode { | 
| public: | 
| int backdrop_location() const { return backdrop_location_; } | 
| + int original_backdrop_location() const { return original_backdrop_location_; } | 
| int backdrop_rect_location() const { return backdrop_rect_location_; } | 
| BlendMode blend_mode() const { return blend_mode_; } | 
| void set_blend_mode(BlendMode blend_mode) { blend_mode_ = blend_mode; } | 
| bool has_blend_mode() const { return blend_mode_ != BLEND_MODE_NONE; } | 
| + void set_mask_for_background(bool mask_for_background) { | 
| + mask_for_background_ = mask_for_background; | 
| + } | 
| + bool mask_for_background() const { return mask_for_background_; } | 
| protected: | 
| FragmentTexBlendMode(); | 
| @@ -337,10 +361,12 @@ class FragmentTexBlendMode { | 
| std::string SetBlendModeFunctions(std::string shader_string) const; | 
| int backdrop_location_; | 
| + int original_backdrop_location_; | 
| int backdrop_rect_location_; | 
| private: | 
| BlendMode blend_mode_; | 
| + bool mask_for_background_; | 
| std::string GetHelperFunctions() const; | 
| std::string GetBlendFunction() const; | 
| @@ -460,6 +486,7 @@ class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { | 
| TexCoordPrecision precision, SamplerType sampler) const; | 
| static std::string GetShaderHead(); | 
| static std::string GetShaderBody(); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| }; | 
| class FragmentShaderRGBATexColorMatrixAlpha | 
| @@ -469,6 +496,7 @@ class FragmentShaderRGBATexColorMatrixAlpha | 
| SamplerType sampler) const; | 
| static std::string GetShaderHead(); | 
| static std::string GetShaderBody(); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| }; | 
| class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding { | 
| @@ -516,6 +544,7 @@ class FragmentShaderRGBATexAlphaAA : public FragmentTexBlendMode { | 
| TexCoordPrecision precision, SamplerType sampler) const; | 
| static std::string GetShaderHead(); | 
| static std::string GetShaderBody(); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| int alpha_location() const { return alpha_location_; } | 
| int sampler_location() const { return sampler_location_; } | 
| @@ -573,8 +602,8 @@ class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode { | 
| std::string GetShaderString( | 
| TexCoordPrecision precision, SamplerType sampler) const; | 
| static std::string GetShaderHead(); | 
| - static std::string GetShaderBody(); | 
| - | 
| + static std::string GetShaderBody(bool mask_for_background); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| void Init(gpu::gles2::GLES2Interface* context, | 
| unsigned program, | 
| int* base_uniform_index); | 
| @@ -604,8 +633,8 @@ class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode { | 
| std::string GetShaderString( | 
| TexCoordPrecision precision, SamplerType sampler) const; | 
| static std::string GetShaderHead(); | 
| - static std::string GetShaderBody(); | 
| - | 
| + static std::string GetShaderBody(bool mask_for_background); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| void Init(gpu::gles2::GLES2Interface* context, | 
| unsigned program, | 
| int* base_uniform_index); | 
| @@ -636,8 +665,8 @@ class FragmentShaderRGBATexAlphaMaskColorMatrixAA | 
| std::string GetShaderString( | 
| TexCoordPrecision precision, SamplerType sampler) const; | 
| static std::string GetShaderHead(); | 
| - static std::string GetShaderBody(); | 
| - | 
| + static std::string GetShaderBody(bool mask_for_background); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| void Init(gpu::gles2::GLES2Interface* context, | 
| unsigned program, | 
| int* base_uniform_index); | 
| @@ -670,7 +699,7 @@ class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentTexBlendMode { | 
| TexCoordPrecision precision, SamplerType sampler) const; | 
| static std::string GetShaderHead(); | 
| static std::string GetShaderBody(); | 
| - | 
| + void FillLocations(ShaderLocations* locations) const; | 
| void Init(gpu::gles2::GLES2Interface* context, | 
| unsigned program, | 
| int* base_uniform_index); | 
| @@ -692,8 +721,8 @@ class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode { | 
| std::string GetShaderString( | 
| TexCoordPrecision precision, SamplerType sampler) const; | 
| static std::string GetShaderHead(); | 
| - static std::string GetShaderBody(); | 
| - | 
| + static std::string GetShaderBody(bool need); | 
| + void FillLocations(ShaderLocations* locations) const; | 
| void Init(gpu::gles2::GLES2Interface* context, | 
| unsigned program, | 
| int* base_uniform_index); |