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

Unified Diff: remoting/client/display/gl_canvas.h

Issue 2591363002: Adding drawable to CRD andorid and iOS gl rendering pipeline. (Closed)
Patch Set: More like GetZIndex. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: remoting/client/display/gl_canvas.h
diff --git a/remoting/client/display/gl_canvas.h b/remoting/client/display/gl_canvas.h
index 975d79bc9f981b0b691fa91ca846b11b877be416..77608ce2b8fe4eb639126140b7a08ae4c2340902 100644
--- a/remoting/client/display/gl_canvas.h
+++ b/remoting/client/display/gl_canvas.h
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/threading/thread_checker.h"
+#include "remoting/client/display/canvas.h"
#include "remoting/client/display/sys_opengl.h"
namespace remoting {
@@ -17,52 +18,23 @@ namespace remoting {
// draw textures on the canvas.
// Must be constructed after the OpenGL surface is created and destroyed before
// the surface is destroyed.
-class GlCanvas {
+class GlCanvas : public Canvas {
public:
// gl_version: version number of the OpenGL ES context. Either 2 or 3.
GlCanvas(int gl_version);
+ ~GlCanvas() override;
- ~GlCanvas();
-
- // Sets the transformation matrix. This matrix defines how the canvas should
- // be shown on the view.
- // 3 by 3 transformation matrix, [ m0, m1, m2, m3, m4, m5, m6, m7, m8 ].
- // The matrix will be multiplied with the positions (with projective space,
- // (x, y, 1)) to draw the textures with the right zoom and pan configuration.
- //
- // | m0, m1, m2, | | x |
- // | m3, m4, m5, | * | y |
- // | m6, m7, m8 | | 1 |
- //
- // For a typical transformation matrix such that m1=m3=m6=m7=0 and m8=1, m0
- // and m4 defines the scaling factor of the canvas and m2 and m5 defines the
- // offset of the upper-left corner in pixel.
- void SetTransformationMatrix(const std::array<float, 9>& matrix);
-
- // Sets the size of the view in pixels.
- void SetViewSize(int width, int height);
-
- // Draws the texture on the canvas. Nothing will happen if
- // SetNormalizedTransformation() has not been called.
- // vertex_buffer: reference to the 2x4x2 float vertex buffer.
- // [ four (x, y) position of the texture vertices in pixel
- // with respect to the canvas,
- // four (x, y) position of the vertices in percentage
- // defining the visible area of the texture ]
- // alpha_multiplier: Will be multiplied with the alpha channel of the texture.
- // Passing 1 means no change of the transparency of the
- // texture.
+ // Canvas implementation.
+ void Clear() override;
+ void SetTransformationMatrix(const std::array<float, 9>& matrix) override;
+ void SetViewSize(int width, int height) override;
void DrawTexture(int texture_id,
- GLuint texture_handle,
- GLuint vertex_buffer,
- float alpha_multiplier);
-
- // Returns the version number of current OpenGL ES context. Either 2 or 3.
- int GetGlVersion() const;
-
- // Returns the maximum texture resolution limitation. Neither the width nor
- // the height of the texture can exceed this limitation.
- int GetMaxTextureSize() const;
+ int texture_handle,
+ int vertex_buffer,
+ float alpha_multiplier) override;
+ int GetVersion() const override;
+ int GetMaxTextureSize() const override;
+ base::WeakPtr<Canvas> GetWeakPtr() override;
private:
int gl_version_;
@@ -85,6 +57,7 @@ class GlCanvas {
GLuint tex_cord_location_;
base::ThreadChecker thread_checker_;
+ base::WeakPtrFactory<Canvas> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(GlCanvas);
};

Powered by Google App Engine
This is Rietveld 408576698