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"
|
2013-07-26 23:28:31 +04:00
|
|
|
#include "mozilla/GfxMessageUtils.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()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
SurfaceDescriptorX11(gfxXlibSurface* aSurf);
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
Drawable mId;
|
2012-01-10 14:54:38 +04:00
|
|
|
XID mFormat; // either a PictFormat or VisualID
|
2013-12-20 20:46:30 +04:00
|
|
|
gfx::IntSize mSize;
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|