OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_ |
| 6 #define REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/threading/thread_checker.h" |
| 10 #include "remoting/client/opengl_wrapper.h" |
| 11 |
| 12 namespace remoting { |
| 13 class GlCanvas; |
| 14 |
| 15 // This class is for drawing a texture on the canvas. Must be deleted before the |
| 16 // canvas is deleted. |
| 17 class GlRenderLayer { |
| 18 public: |
| 19 GlRenderLayer(int texture_id, GlCanvas* canvas); |
| 20 ~GlRenderLayer(); |
| 21 |
| 22 // Sets the texture (BGRA 8888 bits) to be drawn. |
| 23 void SetTexture(const void* texture, int width, int height); |
| 24 |
| 25 // Sets the positions of four vertices of the texture in normalized |
| 26 // coordinates. The default values are (0, 0), (0, 1), (1, 0), (1, 1), |
| 27 // i.e. stretching the texture to fit the whole canvas. |
| 28 // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft, |
| 29 // x_upperright, y_upperright, x_lowerright, y_lowerright ] |
| 30 void SetVertexPositions(const float positions[8]); |
| 31 |
| 32 // Sets the visible area of the texture. The default values are (0, 0), |
| 33 // (0, 1), (1, 0), (1, 1), i.e. showing the whole texture. |
| 34 // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft, |
| 35 // x_upperright, y_upperright, x_lowerright, y_lowerright ] |
| 36 void SetTextureVisibleArea(const float positions[8]); |
| 37 |
| 38 // Draws the texture on the canvas. |
| 39 void Draw(); |
| 40 |
| 41 private: |
| 42 int texture_id_; |
| 43 GlCanvas* canvas_; |
| 44 |
| 45 GLuint texture_handle_; |
| 46 GLuint buffer_handle_; |
| 47 |
| 48 int texture_width_ = 0; |
| 49 int texture_height_ = 0; |
| 50 |
| 51 base::ThreadChecker thread_checker_; |
| 52 DISALLOW_COPY_AND_ASSIGN(GlRenderLayer); |
| 53 }; |
| 54 |
| 55 } // namespace remoting |
| 56 #endif // REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_ |
OLD | NEW |