|
1 /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef SURFACE_TYPES_H_ |
|
7 #define SURFACE_TYPES_H_ |
|
8 |
|
9 #include "mozilla/TypedEnum.h" |
|
10 #include "mozilla/RefPtr.h" |
|
11 #include "mozilla/Attributes.h" |
|
12 #include <stdint.h> |
|
13 |
|
14 namespace mozilla { |
|
15 namespace layers { |
|
16 class ISurfaceAllocator; |
|
17 } |
|
18 |
|
19 namespace gfx { |
|
20 |
|
21 typedef uintptr_t SurfaceStreamHandle; |
|
22 |
|
23 struct SurfaceCaps MOZ_FINAL |
|
24 { |
|
25 bool any; |
|
26 bool color, alpha; |
|
27 bool bpp16; |
|
28 bool depth, stencil; |
|
29 bool antialias; |
|
30 bool preserve; |
|
31 |
|
32 // The surface allocator that we want to create this |
|
33 // for. May be null. |
|
34 RefPtr<layers::ISurfaceAllocator> surfaceAllocator; |
|
35 |
|
36 SurfaceCaps(); |
|
37 SurfaceCaps(const SurfaceCaps& other); |
|
38 ~SurfaceCaps(); |
|
39 |
|
40 void Clear(); |
|
41 |
|
42 SurfaceCaps& operator=(const SurfaceCaps& other); |
|
43 |
|
44 // We can't use just 'RGB' here, since it's an ancient Windows macro. |
|
45 static SurfaceCaps ForRGB() { |
|
46 SurfaceCaps caps; |
|
47 |
|
48 caps.color = true; |
|
49 |
|
50 return caps; |
|
51 } |
|
52 |
|
53 static SurfaceCaps ForRGBA() { |
|
54 SurfaceCaps caps; |
|
55 |
|
56 caps.color = true; |
|
57 caps.alpha = true; |
|
58 |
|
59 return caps; |
|
60 } |
|
61 |
|
62 static SurfaceCaps Any() { |
|
63 SurfaceCaps caps; |
|
64 |
|
65 caps.any = true; |
|
66 |
|
67 return caps; |
|
68 } |
|
69 }; |
|
70 |
|
71 MOZ_BEGIN_ENUM_CLASS(SharedSurfaceType, uint8_t) |
|
72 Unknown = 0, |
|
73 |
|
74 Basic, |
|
75 GLTextureShare, |
|
76 EGLImageShare, |
|
77 EGLSurfaceANGLE, |
|
78 DXGLInterop, |
|
79 DXGLInterop2, |
|
80 Gralloc, |
|
81 IOSurface, |
|
82 |
|
83 Max |
|
84 MOZ_END_ENUM_CLASS(SharedSurfaceType) |
|
85 |
|
86 |
|
87 MOZ_BEGIN_ENUM_CLASS(SurfaceStreamType, uint8_t) |
|
88 SingleBuffer, |
|
89 TripleBuffer_Copy, |
|
90 TripleBuffer_Async, |
|
91 TripleBuffer, |
|
92 Max |
|
93 MOZ_END_ENUM_CLASS(SurfaceStreamType) |
|
94 |
|
95 |
|
96 MOZ_BEGIN_ENUM_CLASS(APITypeT, uint8_t) |
|
97 Generic = 0, |
|
98 |
|
99 OpenGL, |
|
100 |
|
101 Max |
|
102 MOZ_END_ENUM_CLASS(APITypeT) |
|
103 |
|
104 |
|
105 MOZ_BEGIN_ENUM_CLASS(AttachmentType, uint8_t) |
|
106 Screen = 0, |
|
107 |
|
108 GLTexture, |
|
109 GLRenderbuffer, |
|
110 |
|
111 Max |
|
112 MOZ_END_ENUM_CLASS(AttachmentType) |
|
113 |
|
114 } /* namespace gfx */ |
|
115 } /* namespace mozilla */ |
|
116 |
|
117 #endif /* SURFACE_TYPES_H_ */ |