Chromium Code Reviews| Index: cc/output/shader.cc |
| diff --git a/cc/output/shader.cc b/cc/output/shader.cc |
| index 5bc704497ca5b63c24547ac5d9ea15092783b454..ad0a939d458f7f303529c234496eb4a18d63de3e 100644 |
| --- a/cc/output/shader.cc |
| +++ b/cc/output/shader.cc |
| @@ -191,14 +191,17 @@ std::string VertexShaderPosTex::GetShaderString() const { |
| } |
| VertexShaderPosTexYUVStretchOffset::VertexShaderPosTexYUVStretchOffset() |
| - : matrix_location_(-1), tex_scale_location_(-1), tex_offset_location_(-1) { |
| + : matrix_location_(-1), |
| + tex_scale_location_(-1), |
| + tex_offset_location_(-1), |
| + clamp_size_location_(-1) { |
| } |
| void VertexShaderPosTexYUVStretchOffset::Init(GLES2Interface* context, |
| unsigned program, |
| int* base_uniform_index) { |
| static const char* uniforms[] = { |
| - "matrix", "texScale", "texOffset", |
| + "matrix", "texScale", "texOffset", "clampSize", |
| }; |
| int locations[arraysize(uniforms)]; |
| @@ -211,22 +214,21 @@ void VertexShaderPosTexYUVStretchOffset::Init(GLES2Interface* context, |
| matrix_location_ = locations[0]; |
| tex_scale_location_ = locations[1]; |
| tex_offset_location_ = locations[2]; |
| + clamp_size_location_ = locations[3]; |
| } |
| std::string VertexShaderPosTexYUVStretchOffset::GetShaderString() const { |
| // clang-format off |
| return VERTEX_SHADER( |
| // clang-format on |
| - precision mediump float; |
| - attribute vec4 a_position; |
| - attribute TexCoordPrecision vec2 a_texCoord; |
| - uniform mat4 matrix; |
| + precision mediump float; attribute vec4 a_position; |
| + attribute TexCoordPrecision vec2 a_texCoord; uniform mat4 matrix; |
| varying TexCoordPrecision vec2 v_texCoord; |
| uniform TexCoordPrecision vec2 texScale; |
| uniform TexCoordPrecision vec2 texOffset; |
| - void main() { |
| + uniform TexCoordPrecision vec2 clampSize; void main() { |
|
danakj
2015/01/28 01:02:00
formatting..
enne (OOO)
2015/01/31 01:32:13
git cl format T_T
|
| gl_Position = matrix * a_position; |
| - v_texCoord = a_texCoord * texScale + texOffset; |
| + v_texCoord = min(clampSize, a_texCoord * texScale + texOffset); |
|
danakj
2015/01/28 01:02:00
do we not have to clamp on the left/top too?
enne (OOO)
2015/01/31 01:32:13
Turns out we do. Thanks. I changed clampSize to
|
| } |
| // clang-format off |
| ); // NOLINT(whitespace/parens) |