/work/obj-fuzz/dist/include/mozilla/layers/ShadowLayerUtilsX11.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_layers_ShadowLayerUtilsX11_h |
8 | | #define mozilla_layers_ShadowLayerUtilsX11_h |
9 | | |
10 | | #include "ipc/IPCMessageUtils.h" |
11 | | #include "mozilla/layers/LayersMessageUtils.h" |
12 | | #include "nsCOMPtr.h" // for already_AddRefed |
13 | | |
14 | | #define MOZ_HAVE_SURFACEDESCRIPTORX11 |
15 | | #define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS |
16 | | |
17 | | typedef unsigned long XID; |
18 | | typedef XID Drawable; |
19 | | |
20 | | class gfxXlibSurface; |
21 | | |
22 | | namespace IPC { |
23 | | class Message; |
24 | | } |
25 | | |
26 | | namespace mozilla { |
27 | | namespace layers { |
28 | | |
29 | | struct SurfaceDescriptorX11 { |
30 | | SurfaceDescriptorX11() |
31 | 0 | { } |
32 | | |
33 | | explicit SurfaceDescriptorX11(gfxXlibSurface* aSurf, bool aForwardGLX = false); |
34 | | |
35 | | SurfaceDescriptorX11(Drawable aDrawable, XID aFormatID, |
36 | | const gfx::IntSize& aSize); |
37 | | |
38 | | // Default copy ctor and operator= are OK |
39 | | |
40 | 0 | bool operator==(const SurfaceDescriptorX11& aOther) const { |
41 | 0 | // Define == as two descriptors having the same XID for now, |
42 | 0 | // ignoring size and render format. If the two indeed refer to |
43 | 0 | // the same valid XID, then size/format are "actually" the same |
44 | 0 | // anyway, regardless of the values of the fields in |
45 | 0 | // SurfaceDescriptorX11. |
46 | 0 | return mId == aOther.mId; |
47 | 0 | } |
48 | | |
49 | | already_AddRefed<gfxXlibSurface> OpenForeign() const; |
50 | | |
51 | | MOZ_INIT_OUTSIDE_CTOR Drawable mId; |
52 | | MOZ_INIT_OUTSIDE_CTOR XID mFormat; // either a PictFormat or VisualID |
53 | | MOZ_INIT_OUTSIDE_CTOR gfx::IntSize mSize; |
54 | | MOZ_INIT_OUTSIDE_CTOR Drawable mGLXPixmap; // used to prevent multiple bindings to the same GLXPixmap in-process |
55 | | }; |
56 | | |
57 | | } // namespace layers |
58 | | } // namespace mozilla |
59 | | |
60 | | namespace IPC { |
61 | | |
62 | | template <> |
63 | | struct ParamTraits<mozilla::layers::SurfaceDescriptorX11> { |
64 | | typedef mozilla::layers::SurfaceDescriptorX11 paramType; |
65 | | |
66 | 0 | static void Write(Message* aMsg, const paramType& aParam) { |
67 | 0 | WriteParam(aMsg, aParam.mId); |
68 | 0 | WriteParam(aMsg, aParam.mSize); |
69 | 0 | WriteParam(aMsg, aParam.mFormat); |
70 | 0 | WriteParam(aMsg, aParam.mGLXPixmap); |
71 | 0 | } |
72 | | |
73 | 0 | static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) { |
74 | 0 | return (ReadParam(aMsg, aIter, &aResult->mId) && |
75 | 0 | ReadParam(aMsg, aIter, &aResult->mSize) && |
76 | 0 | ReadParam(aMsg, aIter, &aResult->mFormat) && |
77 | 0 | ReadParam(aMsg, aIter, &aResult->mGLXPixmap) |
78 | 0 | ); |
79 | 0 | } |
80 | | }; |
81 | | |
82 | | } // namespace IPC |
83 | | |
84 | | #endif // mozilla_layers_ShadowLayerUtilsX11_h |