2010-09-13 22:23:08 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07: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-13 22:23:08 -07:00
|
|
|
|
|
|
|
#ifndef mozilla_layers_ShadowLayerUtilsX11_h
|
|
|
|
#define mozilla_layers_ShadowLayerUtilsX11_h
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <X11/X.h> // for Drawable
|
2012-08-28 05:41:04 -07:00
|
|
|
#include "ipc/IPCMessageUtils.h"
|
2013-07-26 12:28:31 -07:00
|
|
|
#include "mozilla/GfxMessageUtils.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
2010-09-13 22:23:08 -07:00
|
|
|
|
|
|
|
#define MOZ_HAVE_SURFACEDESCRIPTORX11
|
2010-09-13 22:23:08 -07:00
|
|
|
#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
|
2010-09-13 22:23:08 -07:00
|
|
|
|
|
|
|
class gfxXlibSurface;
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
namespace IPC {
|
|
|
|
class Message;
|
|
|
|
}
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
struct SurfaceDescriptorX11 {
|
|
|
|
SurfaceDescriptorX11()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
SurfaceDescriptorX11(gfxXlibSurface* aSurf);
|
|
|
|
|
2012-01-10 02:54:38 -08:00
|
|
|
SurfaceDescriptorX11(Drawable aDrawable, XID aFormatID,
|
2013-12-20 08:46:30 -08:00
|
|
|
const gfx::IntSize& aSize);
|
2011-09-20 09:20:51 -07:00
|
|
|
|
2010-09-13 22:23:08 -07: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;
|
|
|
|
|
|
|
|
Drawable mId;
|
2012-01-10 02:54:38 -08:00
|
|
|
XID mFormat; // either a PictFormat or VisualID
|
2013-12-20 08:46:30 -08:00
|
|
|
gfx::IntSize mSize;
|
2010-09-13 22:23:08 -07: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);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult) {
|
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mId) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mSize) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mFormat));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace IPC
|
|
|
|
|
|
|
|
#endif // mozilla_layers_ShadowLayerUtilsX11_h
|