Chromium Code Reviews| Index: remoting/client/gl_canvas.h |
| diff --git a/remoting/client/gl_canvas.h b/remoting/client/gl_canvas.h |
| index 4df0a4b8d6bcb2dbccc9fc03744975eb48331bc7..36b30f4fbf17b120596df1f67d19bd7e2ba61e48 100644 |
| --- a/remoting/client/gl_canvas.h |
| +++ b/remoting/client/gl_canvas.h |
| @@ -22,7 +22,7 @@ class GlCanvas { |
| // gl_version: version number of the OpenGL ES context. Either 2 or 3. |
| GlCanvas(int gl_version); |
| - ~GlCanvas(); |
| + virtual ~GlCanvas(); |
| // Sets the transformation matrix. This matrix defines how the canvas should |
| // be shown on the view. |
| @@ -42,6 +42,9 @@ class GlCanvas { |
| // Sets the size of the view in pixels. |
| void SetViewSize(int width, int height); |
| + // Clears the frame. |
| + virtual void Clear(); |
| + |
| // Draws the texture on the canvas. Nothing will happen if |
| // SetNormalizedTransformation() has not been called. |
| // vertex_buffer: reference to the 2x4x2 float vertex buffer. |
| @@ -64,7 +67,11 @@ class GlCanvas { |
| // the height of the texture can exceed this limitation. |
| int GetMaxTextureSize() const; |
| + static GlCanvas* CreateGlCanvas(int gl_version); |
|
joedow
2016/12/22 19:18:09
If you want the caller to own the instance, the ex
nicholss
2017/01/09 18:50:24
good call. Changing to return a std::unique_prt.
|
| + |
| private: |
| + friend class FakeGlCanvas; |
| + GlCanvas(); |
| int gl_version_; |
| int max_texture_size_ = 0; |
| @@ -84,11 +91,36 @@ class GlCanvas { |
| GLuint position_location_; |
| GLuint tex_cord_location_; |
| + bool gl_constructed_; |
|
joedow
2016/12/22 00:29:02
You should use inline inits for primitives instead
nicholss
2017/01/09 18:50:24
this was removed and replaced with the use of an i
|
| + |
| base::ThreadChecker thread_checker_; |
| DISALLOW_COPY_AND_ASSIGN(GlCanvas); |
| }; |
| +class FakeGlCanvas : public GlCanvas { |
|
Yuwei
2016/12/21 23:41:59
Is this just for testing? I think it will be clear
joedow
2016/12/22 00:29:02
This should go into a separate file, most of the f
nicholss
2016/12/22 16:21:41
This was added to support testing that the draw me
Yuwei
2016/12/22 19:01:10
We do sometimes use interface to make things testa
joedow
2016/12/22 19:18:09
We separate prod and test code routinely. If you
nicholss
2017/01/09 18:50:24
Went ahead and created the interface.
|
| + public: |
| + FakeGlCanvas() {} |
| + |
| + ~FakeGlCanvas() override {} |
| + void SetTransformationMatrix(const std::array<float, 9>& matrix) {} |
| + |
| + void SetViewSize(int width, int height) {} |
| + |
| + void Clear() override {} |
| + |
| + void DrawTexture(int texture_id, |
| + GLuint texture_handle, |
| + GLuint vertex_buffer, |
| + float alpha_multiplier) {} |
| + |
| + int GetGlVersion() const { return -1; } |
| + |
| + int GetMaxTextureSize() const { return 0; } |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FakeGlCanvas); |
| +}; |
| + |
| } // namespace remoting |
| #endif // REMOTING_CLIENT_OPENGL_GL_CANVAS_H_ |