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

Side by Side Diff: ui/gl/gl_surface_osmesa.h

Issue 1652873002: Android: Use virtualized context only for those with compatible config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_mac.cc ('k') | ui/gl/gl_surface_osmesa.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_OSMESA_H_ 5 #ifndef UI_GL_GL_SURFACE_OSMESA_H_
6 #define UI_GL_GL_SURFACE_OSMESA_H_ 6 #define UI_GL_GL_SURFACE_OSMESA_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
13 #include "ui/gl/gl_surface.h" 13 #include "ui/gl/gl_surface.h"
14 14
15 namespace gfx { 15 namespace gfx {
16 16
17 enum OSMesaSurfaceFormat { OSMesaSurfaceFormatBGRA, OSMesaSurfaceFormatRGBA };
18
19 // A surface that the Mesa software renderer draws to. This is actually just a 17 // A surface that the Mesa software renderer draws to. This is actually just a
20 // buffer in system memory. GetHandle returns a pointer to the buffer. These 18 // buffer in system memory. GetHandle returns a pointer to the buffer. These
21 // surfaces can be resized and resizing preserves the contents. 19 // surfaces can be resized and resizing preserves the contents.
22 class GL_EXPORT GLSurfaceOSMesa : public GLSurface { 20 class GL_EXPORT GLSurfaceOSMesa : public GLSurface {
23 public: 21 public:
24 GLSurfaceOSMesa(OSMesaSurfaceFormat format, const gfx::Size& size); 22 GLSurfaceOSMesa(GLSurface::Format format, const gfx::Size& size);
25 23
26 // Implement GLSurface. 24 // Implement GLSurface.
27 bool Initialize(GLSurface::Format format) override; 25 bool Initialize(GLSurface::Format format) override;
28 void Destroy() override; 26 void Destroy() override;
29 bool Resize(const gfx::Size& new_size, 27 bool Resize(const gfx::Size& new_size,
30 float scale_factor, 28 float scale_factor,
31 bool has_alpha) override; 29 bool has_alpha) override;
32 bool IsOffscreen() override; 30 bool IsOffscreen() override;
33 gfx::SwapResult SwapBuffers() override; 31 gfx::SwapResult SwapBuffers() override;
34 gfx::Size GetSize() override; 32 gfx::Size GetSize() override;
35 void* GetHandle() override; 33 void* GetHandle() override;
36 unsigned GetFormat() override; 34 GLSurface::Format GetFormat() override;
37 35
38 protected: 36 protected:
39 ~GLSurfaceOSMesa() override; 37 ~GLSurfaceOSMesa() override;
40 38
41 private: 39 private:
42 unsigned format_;
43 gfx::Size size_; 40 gfx::Size size_;
41 GLSurface::Format format_;
44 scoped_ptr<int32_t[]> buffer_; 42 scoped_ptr<int32_t[]> buffer_;
45 43
46 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesa); 44 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesa);
47 }; 45 };
48 46
49 // A thin subclass of |GLSurfaceOSMesa| that can be used in place 47 // A thin subclass of |GLSurfaceOSMesa| that can be used in place
50 // of a native hardware-provided surface when a native surface 48 // of a native hardware-provided surface when a native surface
51 // provider is not available. 49 // provider is not available.
52 class GLSurfaceOSMesaHeadless : public GLSurfaceOSMesa { 50 class GLSurfaceOSMesaHeadless : public GLSurfaceOSMesa {
53 public: 51 public:
54 explicit GLSurfaceOSMesaHeadless(); 52 explicit GLSurfaceOSMesaHeadless();
55 53
56 bool IsOffscreen() override; 54 bool IsOffscreen() override;
57 gfx::SwapResult SwapBuffers() override; 55 gfx::SwapResult SwapBuffers() override;
58 56
59 protected: 57 protected:
60 ~GLSurfaceOSMesaHeadless() override; 58 ~GLSurfaceOSMesaHeadless() override;
61 59
62 private: 60 private:
63 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesaHeadless); 61 DISALLOW_COPY_AND_ASSIGN(GLSurfaceOSMesaHeadless);
64 }; 62 };
65 63
66 } // namespace gfx 64 } // namespace gfx
67 65
68 #endif // UI_GL_GL_SURFACE_OSMESA_H_ 66 #endif // UI_GL_GL_SURFACE_OSMESA_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_mac.cc ('k') | ui/gl/gl_surface_osmesa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698