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/gl_render_layer.h" | 5 #include "remoting/client/gl_render_layer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "remoting/client/gl_canvas.h" | 8 #include "remoting/client/gl_canvas.h" |
9 #include "remoting/client/gl_helpers.h" | 9 #include "remoting/client/gl_helpers.h" |
10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 void GlRenderLayer::SetTexture(const uint8_t* texture, int width, int height) { | 43 void GlRenderLayer::SetTexture(const uint8_t* texture, int width, int height) { |
44 DCHECK(thread_checker_.CalledOnValidThread()); | 44 DCHECK(thread_checker_.CalledOnValidThread()); |
45 CHECK(width > 0 && height > 0); | 45 CHECK(width > 0 && height > 0); |
46 texture_set_ = true; | 46 texture_set_ = true; |
47 glActiveTexture(GL_TEXTURE0 + texture_id_); | 47 glActiveTexture(GL_TEXTURE0 + texture_id_); |
48 glBindTexture(GL_TEXTURE_2D, texture_handle_); | 48 glBindTexture(GL_TEXTURE_2D, texture_handle_); |
49 | 49 |
50 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, | 50 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, |
51 GL_UNSIGNED_BYTE, texture); | 51 GL_UNSIGNED_BYTE, texture); |
| 52 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 53 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
52 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 54 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
53 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 55 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
54 | 56 |
55 glBindTexture(GL_TEXTURE_2D, 0); | 57 glBindTexture(GL_TEXTURE_2D, 0); |
56 } | 58 } |
57 | 59 |
58 void PackDirtyRegion(uint8_t* dest, | 60 void PackDirtyRegion(uint8_t* dest, |
59 const uint8_t* source, | 61 const uint8_t* source, |
60 int width, | 62 int width, |
61 int height, | 63 int height, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 129 |
128 void GlRenderLayer::SetTextureVisibleArea( | 130 void GlRenderLayer::SetTextureVisibleArea( |
129 const std::array<float, 8>& positions) { | 131 const std::array<float, 8>& positions) { |
130 DCHECK(thread_checker_.CalledOnValidThread()); | 132 DCHECK(thread_checker_.CalledOnValidThread()); |
131 glBindBuffer(GL_ARRAY_BUFFER, buffer_handle_); | 133 glBindBuffer(GL_ARRAY_BUFFER, buffer_handle_); |
132 glBufferSubData(GL_ARRAY_BUFFER, sizeof(kVertices) / 2, sizeof(kVertices) / 2, | 134 glBufferSubData(GL_ARRAY_BUFFER, sizeof(kVertices) / 2, sizeof(kVertices) / 2, |
133 positions.data()); | 135 positions.data()); |
134 glBindBuffer(GL_ARRAY_BUFFER, 0); | 136 glBindBuffer(GL_ARRAY_BUFFER, 0); |
135 } | 137 } |
136 | 138 |
137 void GlRenderLayer::Draw() { | 139 void GlRenderLayer::Draw(float alpha_multiplier) { |
138 DCHECK(thread_checker_.CalledOnValidThread()); | 140 DCHECK(thread_checker_.CalledOnValidThread()); |
139 DCHECK(texture_set_); | 141 DCHECK(texture_set_); |
140 canvas_->DrawTexture(texture_id_, texture_handle_, buffer_handle_); | 142 canvas_->DrawTexture(texture_id_, texture_handle_, buffer_handle_, |
| 143 alpha_multiplier); |
141 } | 144 } |
142 | 145 |
143 } // namespace remoting | 146 } // namespace remoting |
OLD | NEW |