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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 sizeof(kVertexAttributes), | 482 sizeof(kVertexAttributes), |
483 kVertexAttributes, | 483 kVertexAttributes, |
484 GL_STATIC_DRAW); | 484 GL_STATIC_DRAW); |
485 } | 485 } |
486 | 486 |
487 scoped_refptr<ShaderProgram> | 487 scoped_refptr<ShaderProgram> |
488 GLHelperScaling::GetShaderProgram(ShaderType type, | 488 GLHelperScaling::GetShaderProgram(ShaderType type, |
489 bool swizzle) { | 489 bool swizzle) { |
490 ShaderProgramKeyType key(type, swizzle); | 490 ShaderProgramKeyType key(type, swizzle); |
491 scoped_refptr<ShaderProgram>& cache_entry(shader_programs_[key]); | 491 scoped_refptr<ShaderProgram>& cache_entry(shader_programs_[key]); |
492 if (!cache_entry) { | 492 if (!cache_entry.get()) { |
493 cache_entry = new ShaderProgram(context_, helper_); | 493 cache_entry = new ShaderProgram(context_, helper_); |
494 std::basic_string<WebKit::WGC3Dchar> vertex_program; | 494 std::basic_string<WebKit::WGC3Dchar> vertex_program; |
495 std::basic_string<WebKit::WGC3Dchar> fragment_program; | 495 std::basic_string<WebKit::WGC3Dchar> fragment_program; |
496 std::basic_string<WebKit::WGC3Dchar> vertex_header; | 496 std::basic_string<WebKit::WGC3Dchar> vertex_header; |
497 std::basic_string<WebKit::WGC3Dchar> fragment_header; | 497 std::basic_string<WebKit::WGC3Dchar> fragment_header; |
498 std::basic_string<WebKit::WGC3Dchar> shared_variables; | 498 std::basic_string<WebKit::WGC3Dchar> shared_variables; |
499 | 499 |
500 vertex_header.append( | 500 vertex_header.append( |
501 "precision highp float;\n" | 501 "precision highp float;\n" |
502 "attribute vec2 a_position;\n" | 502 "attribute vec2 a_position;\n" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 static_cast<float>(dst_size.width()), | 805 static_cast<float>(dst_size.width()), |
806 static_cast<float>(dst_size.height())); | 806 static_cast<float>(dst_size.height())); |
807 | 807 |
808 context_->uniform2f(scaling_vector_location_, | 808 context_->uniform2f(scaling_vector_location_, |
809 scale_x ? 1.0 : 0.0, | 809 scale_x ? 1.0 : 0.0, |
810 scale_x ? 0.0 : 1.0); | 810 scale_x ? 0.0 : 1.0); |
811 context_->uniform4fv(color_weights_location_, 1, color_weights); | 811 context_->uniform4fv(color_weights_location_, 1, color_weights); |
812 } | 812 } |
813 | 813 |
814 } // namespace content | 814 } // namespace content |
OLD | NEW |