Index: cc/output/shader.h |
diff --git a/cc/output/shader.h b/cc/output/shader.h |
index 3039c80ef2c790f3506babb6b4f714fd8571280b..73e252951710222f25971ad6d158bdd6bab7abfa 100644 |
--- a/cc/output/shader.h |
+++ b/cc/output/shader.h |
@@ -9,6 +9,7 @@ |
#include "base/basictypes.h" |
#include "cc/base/cc_export.h" |
+#include "third_party/skia/include/core/SkXfermode.h" |
namespace gfx { |
class Point; |
@@ -279,13 +280,32 @@ class VertexShaderVideoTransform { |
DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); |
}; |
-class FragmentTexAlphaBinding { |
+class FragmentTexBlendMode { |
+ public: |
+ int backdrop_location() const { return backdrop_location_; } |
+ int backdrop_rect_location() const { return backdrop_rect_location_; } |
+ |
+ protected: |
+ FragmentTexBlendMode(); |
+ |
+ static std::string SetBlendModeFunctions(SkXfermode::Mode blend_mode, |
+ std::string shader_string); |
+ |
+ int backdrop_location_; |
+ int backdrop_rect_location_; |
+ |
+ static const char* kUniformBackdropTexture; |
+ static const char* kUniformBackdropRect; |
+}; |
+ |
+class FragmentTexAlphaBinding : public FragmentTexBlendMode { |
public: |
FragmentTexAlphaBinding(); |
void Init(gpu::gles2::GLES2Interface* context, |
unsigned program, |
- int* base_uniform_index); |
+ int* base_uniform_index, |
+ bool needs_backdrop_texture = false); |
int alpha_location() const { return alpha_location_; } |
int fragment_tex_transform_location() const { return -1; } |
int sampler_location() const { return sampler_location_; } |
@@ -297,13 +317,14 @@ class FragmentTexAlphaBinding { |
DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); |
}; |
-class FragmentTexColorMatrixAlphaBinding { |
+class FragmentTexColorMatrixAlphaBinding : public FragmentTexBlendMode { |
public: |
FragmentTexColorMatrixAlphaBinding(); |
void Init(gpu::gles2::GLES2Interface* context, |
unsigned program, |
- int* base_uniform_index); |
+ int* base_uniform_index, |
+ bool needs_backdrop_texture); |
int alpha_location() const { return alpha_location_; } |
int color_matrix_location() const { return color_matrix_location_; } |
int color_offset_location() const { return color_offset_location_; } |
@@ -381,14 +402,17 @@ class FragmentShaderTexBackgroundPremultiplyAlpha |
class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { |
public: |
std::string GetShaderString( |
- TexCoordPrecision precision, SamplerType sampler) const; |
+ TexCoordPrecision precision, |
+ SamplerType sampler, |
+ SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode) const; |
}; |
class FragmentShaderRGBATexColorMatrixAlpha |
: public FragmentTexColorMatrixAlphaBinding { |
public: |
- std::string GetShaderString( |
- TexCoordPrecision precision, SamplerType sampler) const; |
+ std::string GetShaderString(TexCoordPrecision precision, |
+ SamplerType sampler, |
+ SkXfermode::Mode mode) const; |
}; |
class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding { |
@@ -417,15 +441,17 @@ class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { |
TexCoordPrecision precision, SamplerType sampler) const; |
}; |
-class FragmentShaderRGBATexAlphaAA { |
+class FragmentShaderRGBATexAlphaAA : public FragmentTexBlendMode { |
public: |
FragmentShaderRGBATexAlphaAA(); |
void Init(gpu::gles2::GLES2Interface* context, |
unsigned program, |
- int* base_uniform_index); |
- std::string GetShaderString( |
- TexCoordPrecision precision, SamplerType sampler) const; |
+ int* base_uniform_index, |
+ bool needs_backdrop_texture); |
+ std::string GetShaderString(TexCoordPrecision precision, |
+ SamplerType sampler, |
+ SkXfermode::Mode blend_mode) const; |
int alpha_location() const { return alpha_location_; } |
int sampler_location() const { return sampler_location_; } |
@@ -473,15 +499,17 @@ class FragmentShaderRGBATexClampSwizzleAlphaAA |
TexCoordPrecision precision, SamplerType sampler) const; |
}; |
-class FragmentShaderRGBATexAlphaMask { |
+class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode { |
public: |
FragmentShaderRGBATexAlphaMask(); |
- std::string GetShaderString( |
- TexCoordPrecision precision, SamplerType sampler) const; |
+ std::string GetShaderString(TexCoordPrecision precision, |
+ SamplerType sampler, |
+ SkXfermode::Mode mode) const; |
void Init(gpu::gles2::GLES2Interface* context, |
unsigned program, |
- int* base_uniform_index); |
+ int* base_uniform_index, |
+ bool needs_backdrop_texture); |
int alpha_location() const { return alpha_location_; } |
int sampler_location() const { return sampler_location_; } |
int mask_sampler_location() const { return mask_sampler_location_; } |
@@ -502,15 +530,17 @@ class FragmentShaderRGBATexAlphaMask { |
DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); |
}; |
-class FragmentShaderRGBATexAlphaMaskAA { |
+class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode { |
public: |
FragmentShaderRGBATexAlphaMaskAA(); |
- std::string GetShaderString( |
- TexCoordPrecision precision, SamplerType sampler) const; |
+ std::string GetShaderString(TexCoordPrecision precision, |
+ SamplerType sampler, |
+ SkXfermode::Mode mode) const; |
void Init(gpu::gles2::GLES2Interface* context, |
unsigned program, |
- int* base_uniform_index); |
+ int* base_uniform_index, |
+ bool needs_backdrop_texture); |
int alpha_location() const { return alpha_location_; } |
int sampler_location() const { return sampler_location_; } |
int mask_sampler_location() const { return mask_sampler_location_; } |
@@ -531,15 +561,18 @@ class FragmentShaderRGBATexAlphaMaskAA { |
DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); |
}; |
-class FragmentShaderRGBATexAlphaMaskColorMatrixAA { |
+class FragmentShaderRGBATexAlphaMaskColorMatrixAA |
+ : public FragmentTexBlendMode { |
public: |
FragmentShaderRGBATexAlphaMaskColorMatrixAA(); |
- std::string GetShaderString( |
- TexCoordPrecision precision, SamplerType sampler) const; |
+ std::string GetShaderString(TexCoordPrecision precision, |
+ SamplerType sampler, |
+ SkXfermode::Mode mode) const; |
void Init(gpu::gles2::GLES2Interface* context, |
unsigned program, |
- int* base_uniform_index); |
+ int* base_uniform_index, |
+ bool needs_backdrop_texture); |
int alpha_location() const { return alpha_location_; } |
int sampler_location() const { return sampler_location_; } |
int mask_sampler_location() const { return mask_sampler_location_; } |
@@ -562,15 +595,17 @@ class FragmentShaderRGBATexAlphaMaskColorMatrixAA { |
int color_offset_location_; |
}; |
-class FragmentShaderRGBATexAlphaColorMatrixAA { |
+class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentTexBlendMode { |
public: |
FragmentShaderRGBATexAlphaColorMatrixAA(); |
- std::string GetShaderString( |
- TexCoordPrecision precision, SamplerType sampler) const; |
+ std::string GetShaderString(TexCoordPrecision precision, |
+ SamplerType sampler, |
+ SkXfermode::Mode mode) const; |
void Init(gpu::gles2::GLES2Interface* context, |
unsigned program, |
- int* base_uniform_index); |
+ int* base_uniform_index, |
+ bool needs_backdrop_texture); |
int alpha_location() const { return alpha_location_; } |
int sampler_location() const { return sampler_location_; } |
int color_matrix_location() const { return color_matrix_location_; } |
@@ -583,15 +618,17 @@ class FragmentShaderRGBATexAlphaColorMatrixAA { |
int color_offset_location_; |
}; |
-class FragmentShaderRGBATexAlphaMaskColorMatrix { |
+class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode { |
public: |
FragmentShaderRGBATexAlphaMaskColorMatrix(); |
- std::string GetShaderString( |
- TexCoordPrecision precision, SamplerType sampler) const; |
+ std::string GetShaderString(TexCoordPrecision precision, |
+ SamplerType sampler, |
+ SkXfermode::Mode mode) const; |
void Init(gpu::gles2::GLES2Interface* context, |
unsigned program, |
- int* base_uniform_index); |
+ int* base_uniform_index, |
+ bool needs_backdrop_texture); |
int alpha_location() const { return alpha_location_; } |
int sampler_location() const { return sampler_location_; } |
int mask_sampler_location() const { return mask_sampler_location_; } |