OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "remoting/client/display/gl_canvas.h" | 5 #include "remoting/client/display/gl_canvas.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "remoting/client/display/gl_helpers.h" | 8 #include "remoting/client/display/gl_helpers.h" |
9 #include "remoting/client/display/gl_math.h" | 9 #include "remoting/client/display/gl_math.h" |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 DCHECK(thread_checker_.CalledOnValidThread()); | 112 DCHECK(thread_checker_.CalledOnValidThread()); |
113 std::array<float, 9> transposed_matrix = matrix; | 113 std::array<float, 9> transposed_matrix = matrix; |
114 TransposeTransformationMatrix(&transposed_matrix); | 114 TransposeTransformationMatrix(&transposed_matrix); |
115 glUniformMatrix3fv(transform_location_, 1, GL_FALSE, | 115 glUniformMatrix3fv(transform_location_, 1, GL_FALSE, |
116 transposed_matrix.data()); | 116 transposed_matrix.data()); |
117 transformation_set_ = true; | 117 transformation_set_ = true; |
118 } | 118 } |
119 | 119 |
120 void GlCanvas::SetViewSize(int width, int height) { | 120 void GlCanvas::SetViewSize(int width, int height) { |
121 DCHECK(width > 0 && height > 0); | 121 DCHECK(width > 0 && height > 0); |
122 glViewport(0, 0, width, height); | |
123 float view_size[2]{width, height}; | 122 float view_size[2]{width, height}; |
124 glUniform2fv(view_size_location_, 1, view_size); | 123 glUniform2fv(view_size_location_, 1, view_size); |
125 view_size_set_ = true; | 124 view_size_set_ = true; |
126 } | 125 } |
127 | 126 |
128 void GlCanvas::DrawTexture(int texture_id, | 127 void GlCanvas::DrawTexture(int texture_id, |
129 int texture_handle, | 128 int texture_handle, |
130 int vertex_buffer, | 129 int vertex_buffer, |
131 float alpha_multiplier) { | 130 float alpha_multiplier) { |
132 DCHECK(thread_checker_.CalledOnValidThread()); | 131 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 23 matching lines...) Expand all Loading... |
156 int GlCanvas::GetMaxTextureSize() const { | 155 int GlCanvas::GetMaxTextureSize() const { |
157 return max_texture_size_; | 156 return max_texture_size_; |
158 } | 157 } |
159 | 158 |
160 base::WeakPtr<Canvas> GlCanvas::GetWeakPtr() { | 159 base::WeakPtr<Canvas> GlCanvas::GetWeakPtr() { |
161 DCHECK(thread_checker_.CalledOnValidThread()); | 160 DCHECK(thread_checker_.CalledOnValidThread()); |
162 return weak_factory_.GetWeakPtr(); | 161 return weak_factory_.GetWeakPtr(); |
163 } | 162 } |
164 | 163 |
165 } // namespace remoting | 164 } // namespace remoting |
OLD | NEW |