OLD | NEW |
| (Empty) |
1 /* | |
2 Copyright (C) 2012 Digia Corporation and/or its subsidiary(-ies) | |
3 | |
4 This library is free software; you can redistribute it and/or | |
5 modify it under the terms of the GNU Library General Public | |
6 License as published by the Free Software Foundation; either | |
7 version 2 of the License, or (at your option) any later version. | |
8 | |
9 This library is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 Library General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU Library General Public License | |
15 along with this library; see the file COPYING.LIB. If not, write to | |
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
17 Boston, MA 02110-1301, USA. | |
18 */ | |
19 | |
20 #ifndef GraphicsSurfaceToken_h | |
21 #define GraphicsSurfaceToken_h | |
22 | |
23 #include "GraphicsContext.h" | |
24 #include "IntRect.h" | |
25 #include <wtf/OwnPtr.h> | |
26 #include <wtf/PassOwnPtr.h> | |
27 #include <wtf/RefCounted.h> | |
28 #include <wtf/RefPtr.h> | |
29 | |
30 #if USE(GRAPHICS_SURFACE) | |
31 | |
32 namespace WebCore { | |
33 | |
34 struct GraphicsSurfaceToken { | |
35 | |
36 #if OS(DARWIN) | |
37 typedef mach_port_t BufferHandle; | |
38 #elif OS(LINUX) | |
39 typedef uint32_t BufferHandle; | |
40 #elif OS(WINDOWS) | |
41 typedef HANDLE BufferHandle; | |
42 #endif | |
43 | |
44 #if HAVE(GLX) | |
45 GraphicsSurfaceToken(uint32_t windowID = 0) | |
46 : frontBufferHandle(windowID) | |
47 { } | |
48 | |
49 bool operator!=(const GraphicsSurfaceToken &rhs) const | |
50 { | |
51 return frontBufferHandle != rhs.frontBufferHandle; | |
52 } | |
53 | |
54 bool isValid() const | |
55 { | |
56 return frontBufferHandle; | |
57 } | |
58 | |
59 #endif | |
60 | |
61 #if OS(DARWIN) || OS(WINDOWS) | |
62 GraphicsSurfaceToken(BufferHandle frontBuffer = 0, BufferHandle backBuffer =
0) | |
63 : frontBufferHandle(frontBuffer) | |
64 , backBufferHandle(backBuffer) | |
65 { } | |
66 | |
67 bool operator!=(const GraphicsSurfaceToken &rhs) const | |
68 { | |
69 return (frontBufferHandle != rhs.frontBufferHandle || backBufferHandle !
= rhs.backBufferHandle); | |
70 } | |
71 | |
72 bool isValid() const | |
73 { | |
74 return frontBufferHandle && backBufferHandle; | |
75 } | |
76 | |
77 BufferHandle backBufferHandle; | |
78 #endif | |
79 | |
80 BufferHandle frontBufferHandle; | |
81 }; | |
82 | |
83 } | |
84 #endif // USE(GRAPHICS_SURFACE) | |
85 | |
86 #endif // GraphicsSurfaceToken_h | |
OLD | NEW |