Chromium Code Reviews| Index: remoting/client/display/canvas.h |
| diff --git a/remoting/client/display/gl_canvas.h b/remoting/client/display/canvas.h |
| similarity index 59% |
| copy from remoting/client/display/gl_canvas.h |
| copy to remoting/client/display/canvas.h |
| index 975d79bc9f981b0b691fa91ca846b11b877be416..f83b464f94b3cd1a0fa11c930658fa9fc6f38440 100644 |
| --- a/remoting/client/display/gl_canvas.h |
| +++ b/remoting/client/display/canvas.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef REMOTING_CLIENT_DISPLAY_GL_CANVAS_H_ |
| -#define REMOTING_CLIENT_DISPLAY_GL_CANVAS_H_ |
| +#ifndef REMOTING_CLIENT_DISPLAY_CANVAS_H_ |
| +#define REMOTING_CLIENT_DISPLAY_CANVAS_H_ |
| #include <array> |
| @@ -15,14 +15,14 @@ namespace remoting { |
| // This class holds zoom and pan configurations of the canvas and is used to |
| // draw textures on the canvas. |
| -// Must be constructed after the OpenGL surface is created and destroyed before |
| -// the surface is destroyed. |
| -class GlCanvas { |
| +class Canvas { |
| public: |
| - // gl_version: version number of the OpenGL ES context. Either 2 or 3. |
| - GlCanvas(int gl_version); |
| + Canvas(){}; |
|
joedow
2017/01/10 00:19:43
please run clang format to fix some spacing nits (
nicholss
2017/01/10 16:58:34
It does not work on mac.
joedow
2017/01/10 18:49:27
Weird, ok then add a space manually between parens
Sergey Ulanov
2017/01/10 23:07:18
I'm pretty sure 'git cl format' should work on mac
|
| - ~GlCanvas(); |
| + virtual ~Canvas(){}; |
| + |
| + // Clears the frame. |
| + virtual void Clear() = 0; |
| // Sets the transformation matrix. This matrix defines how the canvas should |
| // be shown on the view. |
| @@ -37,10 +37,10 @@ class GlCanvas { |
| // 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); |
| + virtual void SetTransformationMatrix(const std::array<float, 9>& matrix) = 0; |
| // Sets the size of the view in pixels. |
| - void SetViewSize(int width, int height); |
| + virtual void SetViewSize(int width, int height) = 0; |
| // Draws the texture on the canvas. Nothing will happen if |
| // SetNormalizedTransformation() has not been called. |
| @@ -52,43 +52,21 @@ class GlCanvas { |
| // alpha_multiplier: Will be multiplied with the alpha channel of the texture. |
| // Passing 1 means no change of the transparency of the |
| // texture. |
| - void DrawTexture(int texture_id, |
| - GLuint texture_handle, |
| - GLuint vertex_buffer, |
| - float alpha_multiplier); |
| + virtual void DrawTexture(int texture_id, |
| + GLuint texture_handle, |
| + GLuint vertex_buffer, |
| + float alpha_multiplier) = 0; |
| - // Returns the version number of current OpenGL ES context. Either 2 or 3. |
| - int GetGlVersion() const; |
| + // Version if applicable to implementation. |
|
joedow
2017/01/10 00:19:43
I could see this returning the OpenGL version for
nicholss
2017/01/10 16:58:34
It is up to the impl. It is not a real concern her
joedow
2017/01/10 18:49:27
This still seem confusing to have on an interface
Yuwei
2017/01/10 19:36:10
GetGlVersion is only used by GlRenderLayer to deci
|
| + virtual int GetVersion() const = 0; |
| // Returns the maximum texture resolution limitation. Neither the width nor |
| // the height of the texture can exceed this limitation. |
| - int GetMaxTextureSize() const; |
| - |
| - private: |
| - int gl_version_; |
| - |
| - int max_texture_size_ = 0; |
| - bool transformation_set_ = false; |
| - bool view_size_set_ = false; |
| - |
| - // Handles. |
| - GLuint vertex_shader_; |
| - GLuint fragment_shader_; |
| - GLuint program_; |
| - |
| - // Locations of the corresponding shader attributes. |
| - GLuint transform_location_; |
| - GLuint view_size_location_; |
| - GLuint texture_location_; |
| - GLuint alpha_multiplier_location_; |
| - GLuint position_location_; |
| - GLuint tex_cord_location_; |
| - |
| - base::ThreadChecker thread_checker_; |
| + virtual int GetMaxTextureSize() const = 0; |
| - DISALLOW_COPY_AND_ASSIGN(GlCanvas); |
| + DISALLOW_COPY_AND_ASSIGN(Canvas); |
|
joedow
2017/01/10 00:19:43
Add 'private:' above this line. It was removed in
nicholss
2017/01/10 21:43:10
Done.
|
| }; |
| } // namespace remoting |
| -#endif // REMOTING_CLIENT_DISPLAY_GL_CANVAS_H_ |
| +#endif // REMOTING_CLIENT_DISPLAY_CANVAS_H_ |