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(Initialized() || gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR); | 873 DCHECK_IMPLIES(!Initialized(), |
| 874 gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR); |
874 } | 875 } |
875 | 876 |
876 void ShaderProgram::UseProgram(const gfx::Size& src_size, | 877 void ShaderProgram::UseProgram(const gfx::Size& src_size, |
877 const gfx::Rect& src_subrect, | 878 const gfx::Rect& src_subrect, |
878 const gfx::Size& dst_size, | 879 const gfx::Size& dst_size, |
879 bool scale_x, | 880 bool scale_x, |
880 bool flip_y, | 881 bool flip_y, |
881 GLfloat color_weights[4]) { | 882 GLfloat color_weights[4]) { |
882 gl_->UseProgram(program_); | 883 gl_->UseProgram(program_); |
883 | 884 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 gl_->Uniform2f(dst_pixelsize_location_, | 923 gl_->Uniform2f(dst_pixelsize_location_, |
923 static_cast<float>(dst_size.width()), | 924 static_cast<float>(dst_size.width()), |
924 static_cast<float>(dst_size.height())); | 925 static_cast<float>(dst_size.height())); |
925 | 926 |
926 gl_->Uniform2f( | 927 gl_->Uniform2f( |
927 scaling_vector_location_, scale_x ? 1.0 : 0.0, scale_x ? 0.0 : 1.0); | 928 scaling_vector_location_, scale_x ? 1.0 : 0.0, scale_x ? 0.0 : 1.0); |
928 gl_->Uniform4fv(color_weights_location_, 1, color_weights); | 929 gl_->Uniform4fv(color_weights_location_, 1, color_weights); |
929 } | 930 } |
930 | 931 |
931 } // namespace content | 932 } // namespace content |
OLD | NEW |