Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: remoting/client/gl_render_layer.h

Issue 2148743005: [Remoting Android] Cursor & Cursor Feedback for OpenGL Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/client/gl_math.cc ('k') | remoting/client/gl_render_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_ 5 #ifndef REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_
6 #define REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_ 6 #define REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/threading/thread_checker.h" 9 #include "base/threading/thread_checker.h"
10 #include "remoting/client/sys_opengl.h" 10 #include "remoting/client/sys_opengl.h"
11 11
12 namespace remoting { 12 namespace remoting {
13 class GlCanvas; 13 class GlCanvas;
14 14
15 // This class is for drawing a texture on the canvas. Must be deleted before the 15 // This class is for drawing a texture on the canvas. Must be deleted before the
16 // canvas is deleted. 16 // canvas is deleted.
17 class GlRenderLayer { 17 class GlRenderLayer {
18 public: 18 public:
19 static const int kBytesPerPixel = 4;
20
19 // texture_id: An integer in range [0, GL_MAX_TEXTURE_IMAGE_UNITS], defining 21 // texture_id: An integer in range [0, GL_MAX_TEXTURE_IMAGE_UNITS], defining
20 // which slot to store the texture. 22 // which slot to store the texture.
21 GlRenderLayer(int texture_id, GlCanvas* canvas); 23 GlRenderLayer(int texture_id, GlCanvas* canvas);
22 ~GlRenderLayer(); 24 ~GlRenderLayer();
23 25
24 // Sets the texture (RGBA 8888) to be drawn. Please use UpdateTexture() if the 26 // Sets the texture (RGBA 8888) to be drawn. Please use UpdateTexture() if the
25 // texture size isn't changed. 27 // texture size isn't changed.
26 void SetTexture(const uint8_t* texture, int width, int height); 28 void SetTexture(const uint8_t* texture, int width, int height);
27 29
28 // Updates a subregion (RGBA 8888) of the texture. 30 // Updates a subregion (RGBA 8888) of the texture.
(...skipping 14 matching lines...) Expand all
43 // x_upperright, y_upperright, x_lowerright, y_lowerright ] 45 // x_upperright, y_upperright, x_lowerright, y_lowerright ]
44 void SetVertexPositions(const std::array<float, 8>& positions); 46 void SetVertexPositions(const std::array<float, 8>& positions);
45 47
46 // Sets the visible area of the texture. The default values are (0, 0), 48 // Sets the visible area of the texture. The default values are (0, 0),
47 // (0, 1), (1, 0), (1, 1), i.e. showing the whole texture. 49 // (0, 1), (1, 0), (1, 1), i.e. showing the whole texture.
48 // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft, 50 // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft,
49 // x_upperright, y_upperright, x_lowerright, y_lowerright ] 51 // x_upperright, y_upperright, x_lowerright, y_lowerright ]
50 void SetTextureVisibleArea(const std::array<float, 8>& positions); 52 void SetTextureVisibleArea(const std::array<float, 8>& positions);
51 53
52 // Draws the texture on the canvas. Texture must be set before calling Draw(). 54 // Draws the texture on the canvas. Texture must be set before calling Draw().
53 void Draw(); 55 void Draw(float alpha_multiplier);
54 56
55 private: 57 private:
56 int texture_id_; 58 int texture_id_;
57 GlCanvas* canvas_; 59 GlCanvas* canvas_;
58 60
59 GLuint texture_handle_; 61 GLuint texture_handle_;
60 GLuint buffer_handle_; 62 GLuint buffer_handle_;
61 63
62 // true IFF the texture is already set by calling SetTexture(). 64 // true IFF the texture is already set by calling SetTexture().
63 bool texture_set_ = false; 65 bool texture_set_ = false;
64 66
65 // Used in OpenGL ES 2 context which doesn't support GL_UNPACK_ROW_LENGTH to 67 // Used in OpenGL ES 2 context which doesn't support GL_UNPACK_ROW_LENGTH to
66 // tightly pack dirty regions before sending them to GPU. 68 // tightly pack dirty regions before sending them to GPU.
67 std::unique_ptr<uint8_t[]> update_buffer_; 69 std::unique_ptr<uint8_t[]> update_buffer_;
68 int update_buffer_size_ = 0; 70 int update_buffer_size_ = 0;
69 71
70 base::ThreadChecker thread_checker_; 72 base::ThreadChecker thread_checker_;
71 DISALLOW_COPY_AND_ASSIGN(GlRenderLayer); 73 DISALLOW_COPY_AND_ASSIGN(GlRenderLayer);
72 }; 74 };
73 75
74 } // namespace remoting 76 } // namespace remoting
75 #endif // REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_ 77 #endif // REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_
OLDNEW
« no previous file with comments | « remoting/client/gl_math.cc ('k') | remoting/client/gl_render_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698