| Index: remoting/client/opengl/gl_render_layer.h
|
| diff --git a/remoting/client/opengl/gl_render_layer.h b/remoting/client/opengl/gl_render_layer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f82fc2e5bbd9881c2bbc0fa10a31c170eaadc70c
|
| --- /dev/null
|
| +++ b/remoting/client/opengl/gl_render_layer.h
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_
|
| +#define REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/threading/thread_checker.h"
|
| +#include "remoting/client/opengl_wrapper.h"
|
| +
|
| +namespace remoting {
|
| +class GlCanvas;
|
| +
|
| +// This class is for drawing a texture on the canvas. Must be deleted before the
|
| +// canvas is deleted.
|
| +class GlRenderLayer {
|
| + public:
|
| + GlRenderLayer(int texture_id, GlCanvas* canvas);
|
| + ~GlRenderLayer();
|
| +
|
| + // Sets the texture (BGRA 8888 bits) to be drawn.
|
| + void SetTexture(const void* texture, int width, int height);
|
| +
|
| + // Sets the positions of four vertices of the texture in normalized
|
| + // coordinates. The default values are (0, 0), (0, 1), (1, 0), (1, 1),
|
| + // i.e. stretching the texture to fit the whole canvas.
|
| + // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft,
|
| + // x_upperright, y_upperright, x_lowerright, y_lowerright ]
|
| + void SetVertexPositions(const float positions[8]);
|
| +
|
| + // Sets the visible area of the texture. The default values are (0, 0),
|
| + // (0, 1), (1, 0), (1, 1), i.e. showing the whole texture.
|
| + // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft,
|
| + // x_upperright, y_upperright, x_lowerright, y_lowerright ]
|
| + void SetTextureVisibleArea(const float positions[8]);
|
| +
|
| + // Draws the texture on the canvas.
|
| + void Draw();
|
| +
|
| + private:
|
| + int texture_id_;
|
| + GlCanvas* canvas_;
|
| +
|
| + GLuint texture_handle_;
|
| + GLuint buffer_handle_;
|
| +
|
| + int texture_width_ = 0;
|
| + int texture_height_ = 0;
|
| +
|
| + base::ThreadChecker thread_checker_;
|
| + DISALLOW_COPY_AND_ASSIGN(GlRenderLayer);
|
| +};
|
| +
|
| +} // namespace remoting
|
| +#endif // REMOTING_CLIENT_OPENGL_GL_RENDER_LAYER_H_
|
|
|