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

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

Issue 2045963004: [Remoting] OpenGL Rendering Layer (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_helpers.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
(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/sys_opengl.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 // texture_id: An integer in range [0, GL_MAX_TEXTURE_IMAGE_UNITS], defining
20 // which slot to store the texture.
21 GlRenderLayer(int texture_id, GlCanvas* canvas);
22 ~GlRenderLayer();
23
24 // Sets the texture (RGBA 8888) to be drawn. Please use UpdateTexture() if the
25 // texture size isn't changed.
26 void SetTexture(const uint8_t* texture, int width, int height);
27
28 // Updates a subregion (RGBA 8888) of the texture.
29 // stride: byte distance between two rows in |subtexture|.
30 // If |stride| is 0 or |stride| == |width|*kBytesPerPixel, |subtexture| will
31 // be treated as tightly packed.
32 void UpdateTexture(const uint8_t* subtexture,
33 int offset_x,
34 int offset_y,
35 int width,
36 int height,
37 int stride);
38
39 // Sets the positions of four vertices of the texture in normalized
40 // coordinates. The default values are (0, 0), (0, 1), (1, 0), (1, 1),
41 // i.e. stretching the texture to fit the whole canvas.
42 // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft,
43 // x_upperright, y_upperright, x_lowerright, y_lowerright ]
44 void SetVertexPositions(const std::array<float, 8>& positions);
45
46 // 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.
48 // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft,
49 // x_upperright, y_upperright, x_lowerright, y_lowerright ]
50 void SetTextureVisibleArea(const std::array<float, 8>& positions);
51
52 // Draws the texture on the canvas. Texture must be set before calling Draw().
53 void Draw();
54
55 private:
56 int texture_id_;
57 GlCanvas* canvas_;
58
59 GLuint texture_handle_;
60 GLuint buffer_handle_;
61
62 // true IFF the texture is already set by calling SetTexture().
63 bool texture_set_ = false;
64
65 // 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.
67 std::unique_ptr<uint8_t[]> update_buffer_;
68 int update_buffer_size_ = 0;
69
70 base::ThreadChecker thread_checker_;
71 DISALLOW_COPY_AND_ASSIGN(GlRenderLayer);
72 };
73
74 } // namespace remoting
75 #endif // REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_
OLDNEW
« no previous file with comments | « remoting/client/gl_helpers.cc ('k') | remoting/client/gl_render_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698