2010-09-14 09:23:08 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-09-14 09:23:08 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_layers_ShadowLayerUtilsX11_h
|
|
|
|
#define mozilla_layers_ShadowLayerUtilsX11_h
|
|
|
|
|
2012-08-28 16:41:04 +04:00
|
|
|
#include "ipc/IPCMessageUtils.h"
|
2017-06-09 07:32:13 +03:00
|
|
|
#include "mozilla/layers/LayersMessageUtils.h"
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
2010-09-14 09:23:08 +04:00
|
|
|
|
|
|
|
#define MOZ_HAVE_SURFACEDESCRIPTORX11
|
2010-09-14 09:23:08 +04:00
|
|
|
#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
|
2010-09-14 09:23:08 +04:00
|
|
|
|
2013-12-16 14:47:06 +04:00
|
|
|
typedef unsigned long XID;
|
|
|
|
typedef XID Drawable;
|
|
|
|
|
2010-09-14 09:23:08 +04:00
|
|
|
class gfxXlibSurface;
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
namespace IPC {
|
|
|
|
class Message;
|
|
|
|
}
|
|
|
|
|
2010-09-14 09:23:08 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
struct SurfaceDescriptorX11 {
|
|
|
|
SurfaceDescriptorX11()
|
|
|
|
{ }
|
|
|
|
|
2015-07-30 19:40:56 +03:00
|
|
|
explicit SurfaceDescriptorX11(gfxXlibSurface* aSurf, bool aForwardGLX = false);
|
2010-09-14 09:23:08 +04:00
|
|
|
|
2012-01-10 14:54:38 +04:00
|
|
|
SurfaceDescriptorX11(Drawable aDrawable, XID aFormatID,
|
2013-12-20 20:46:30 +04:00
|
|
|
const gfx::IntSize& aSize);
|
2011-09-20 20:20:51 +04:00
|
|
|
|
2010-09-14 09:23:08 +04:00
|
|
|
// Default copy ctor and operator= are OK
|
|
|
|
|
|
|
|
bool operator==(const SurfaceDescriptorX11& aOther) const {
|
|
|
|
// Define == as two descriptors having the same XID for now,
|
|
|
|
// ignoring size and render format. If the two indeed refer to
|
|
|
|
// the same valid XID, then size/format are "actually" the same
|
|
|
|
// anyway, regardless of the values of the fields in
|
|
|
|
// SurfaceDescriptorX11.
|
|
|
|
return mId == aOther.mId;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<gfxXlibSurface> OpenForeign() const;
|
|
|
|
|
2016-08-23 14:17:56 +03:00
|
|
|
MOZ_INIT_OUTSIDE_CTOR Drawable mId;
|
|
|
|
MOZ_INIT_OUTSIDE_CTOR XID mFormat; // either a PictFormat or VisualID
|
2016-06-06 16:25:28 +03:00
|
|
|
MOZ_INIT_OUTSIDE_CTOR gfx::IntSize mSize;
|
2016-08-23 14:17:56 +03:00
|
|
|
MOZ_INIT_OUTSIDE_CTOR Drawable mGLXPixmap; // used to prevent multiple bindings to the same GLXPixmap in-process
|
2010-09-14 09:23:08 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::SurfaceDescriptorX11> {
|
|
|
|
typedef mozilla::layers::SurfaceDescriptorX11 paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mId);
|
|
|
|
WriteParam(aMsg, aParam.mSize);
|
|
|
|
WriteParam(aMsg, aParam.mFormat);
|
2015-07-30 19:40:56 +03:00
|
|
|
WriteParam(aMsg, aParam.mGLXPixmap);
|
2010-09-14 09:23:08 +04:00
|
|
|
}
|
|
|
|
|
2016-04-21 07:09:15 +03:00
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
|
2010-09-14 09:23:08 +04:00
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mId) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mSize) &&
|
2015-07-30 19:40:56 +03:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mFormat) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mGLXPixmap)
|
|
|
|
);
|
2010-09-14 09:23:08 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace IPC
|
|
|
|
|
|
|
|
#endif // mozilla_layers_ShadowLayerUtilsX11_h
|