OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GL_GL_SURFACE_STUB_H_ | 5 #ifndef UI_GL_GL_SURFACE_STUB_H_ |
6 #define UI_GL_GL_SURFACE_STUB_H_ | 6 #define UI_GL_GL_SURFACE_STUB_H_ |
7 | 7 |
8 #include "ui/gl/gl_export.h" | 8 #include "ui/gl/gl_export.h" |
9 #include "ui/gl/gl_surface.h" | 9 #include "ui/gl/gl_surface.h" |
10 | 10 |
11 namespace gl { | 11 namespace gl { |
12 | 12 |
13 // A GLSurface that does nothing for unit tests. | 13 // A GLSurface that does nothing for unit tests. |
14 class GL_EXPORT GLSurfaceStub : public GLSurface { | 14 class GL_EXPORT GLSurfaceStub : public GLSurface { |
15 public: | 15 public: |
16 void SetSize(const gfx::Size& size) { size_ = size; } | 16 void SetSize(const gfx::Size& size) { size_ = size; } |
17 void set_buffers_flipped(bool flipped) { buffers_flipped_ = flipped; } | 17 void set_buffers_flipped(bool flipped) { buffers_flipped_ = flipped; } |
18 | 18 |
| 19 void set_supports_draw_rectangle(bool support) { |
| 20 supports_draw_rectangle_ = support; |
| 21 } |
| 22 |
19 // Implement GLSurface. | 23 // Implement GLSurface. |
20 void Destroy() override; | 24 void Destroy() override; |
21 bool Resize(const gfx::Size& size, | 25 bool Resize(const gfx::Size& size, |
22 float scale_factor, | 26 float scale_factor, |
23 bool has_alpha) override; | 27 bool has_alpha) override; |
24 bool IsOffscreen() override; | 28 bool IsOffscreen() override; |
25 gfx::SwapResult SwapBuffers() override; | 29 gfx::SwapResult SwapBuffers() override; |
26 gfx::Size GetSize() override; | 30 gfx::Size GetSize() override; |
27 void* GetHandle() override; | 31 void* GetHandle() override; |
28 bool BuffersFlipped() const override; | 32 bool BuffersFlipped() const override; |
29 GLSurfaceFormat GetFormat() override; | 33 GLSurfaceFormat GetFormat() override; |
| 34 bool SupportsSetDrawRectangle() const override; |
| 35 gfx::Vector2d GetDrawOffset() const override; |
30 | 36 |
31 protected: | 37 protected: |
32 ~GLSurfaceStub() override; | 38 ~GLSurfaceStub() override; |
33 | 39 |
34 private: | 40 private: |
35 gfx::Size size_; | 41 gfx::Size size_; |
36 bool buffers_flipped_ = false; | 42 bool buffers_flipped_ = false; |
| 43 bool supports_draw_rectangle_ = false; |
37 }; | 44 }; |
38 | 45 |
39 } // namespace gl | 46 } // namespace gl |
40 | 47 |
41 #endif // UI_GL_GL_SURFACE_STUB_H_ | 48 #endif // UI_GL_GL_SURFACE_STUB_H_ |
OLD | NEW |