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 gfx { | 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 // Implement GLSurface. | 19 // Implement GLSurface. |
20 void Destroy() override; | 20 void Destroy() override; |
21 bool Resize(const gfx::Size& size, | 21 bool Resize(const gfx::Size& size, |
22 float scale_factor, | 22 float scale_factor, |
23 bool has_alpha) override; | 23 bool has_alpha) override; |
24 bool IsOffscreen() override; | 24 bool IsOffscreen() override; |
25 gfx::SwapResult SwapBuffers() override; | 25 gfx::SwapResult SwapBuffers() override; |
26 gfx::Size GetSize() override; | 26 gfx::Size GetSize() override; |
27 void* GetHandle() override; | 27 void* GetHandle() override; |
28 bool BuffersFlipped() const override; | 28 bool BuffersFlipped() const override; |
29 | 29 |
30 protected: | 30 protected: |
31 ~GLSurfaceStub() override; | 31 ~GLSurfaceStub() override; |
32 | 32 |
33 private: | 33 private: |
34 gfx::Size size_; | 34 gfx::Size size_; |
35 bool buffers_flipped_ = false; | 35 bool buffers_flipped_ = false; |
36 }; | 36 }; |
37 | 37 |
38 } // namespace gfx | 38 } // namespace gl |
39 | 39 |
40 #endif // UI_GL_GL_SURFACE_STUB_H_ | 40 #endif // UI_GL_GL_SURFACE_STUB_H_ |
OLD | NEW |