| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/gpu/client/gl_helper_scaling.h" | 5 #include "content/common/gpu/client/gl_helper_scaling.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 texture_location_ = gl_->GetUniformLocation(program_, "s_texture"); | 863 texture_location_ = gl_->GetUniformLocation(program_, "s_texture"); |
| 864 src_subrect_location_ = gl_->GetUniformLocation(program_, "src_subrect"); | 864 src_subrect_location_ = gl_->GetUniformLocation(program_, "src_subrect"); |
| 865 src_pixelsize_location_ = gl_->GetUniformLocation(program_, "src_pixelsize"); | 865 src_pixelsize_location_ = gl_->GetUniformLocation(program_, "src_pixelsize"); |
| 866 dst_pixelsize_location_ = gl_->GetUniformLocation(program_, "dst_pixelsize"); | 866 dst_pixelsize_location_ = gl_->GetUniformLocation(program_, "dst_pixelsize"); |
| 867 scaling_vector_location_ = | 867 scaling_vector_location_ = |
| 868 gl_->GetUniformLocation(program_, "scaling_vector"); | 868 gl_->GetUniformLocation(program_, "scaling_vector"); |
| 869 color_weights_location_ = gl_->GetUniformLocation(program_, "color_weights"); | 869 color_weights_location_ = gl_->GetUniformLocation(program_, "color_weights"); |
| 870 // The only reason fetching these attribute locations should fail is | 870 // The only reason fetching these attribute locations should fail is |
| 871 // if the context was spontaneously lost (i.e., because the GPU | 871 // if the context was spontaneously lost (i.e., because the GPU |
| 872 // process crashed, perhaps deliberately for testing). | 872 // process crashed, perhaps deliberately for testing). |
| 873 DCHECK_IMPLIES(!Initialized(), | 873 DCHECK(Initialized() || (gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR)); |
| 874 gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR); | |
| 875 } | 874 } |
| 876 | 875 |
| 877 void ShaderProgram::UseProgram(const gfx::Size& src_size, | 876 void ShaderProgram::UseProgram(const gfx::Size& src_size, |
| 878 const gfx::Rect& src_subrect, | 877 const gfx::Rect& src_subrect, |
| 879 const gfx::Size& dst_size, | 878 const gfx::Size& dst_size, |
| 880 bool scale_x, | 879 bool scale_x, |
| 881 bool flip_y, | 880 bool flip_y, |
| 882 GLfloat color_weights[4]) { | 881 GLfloat color_weights[4]) { |
| 883 gl_->UseProgram(program_); | 882 gl_->UseProgram(program_); |
| 884 | 883 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 gl_->Uniform2f(dst_pixelsize_location_, | 922 gl_->Uniform2f(dst_pixelsize_location_, |
| 924 static_cast<float>(dst_size.width()), | 923 static_cast<float>(dst_size.width()), |
| 925 static_cast<float>(dst_size.height())); | 924 static_cast<float>(dst_size.height())); |
| 926 | 925 |
| 927 gl_->Uniform2f( | 926 gl_->Uniform2f( |
| 928 scaling_vector_location_, scale_x ? 1.0 : 0.0, scale_x ? 0.0 : 1.0); | 927 scaling_vector_location_, scale_x ? 1.0 : 0.0, scale_x ? 0.0 : 1.0); |
| 929 gl_->Uniform4fv(color_weights_location_, 1, color_weights); | 928 gl_->Uniform4fv(color_weights_location_, 1, color_weights); |
| 930 } | 929 } |
| 931 | 930 |
| 932 } // namespace content | 931 } // namespace content |
| OLD | NEW |