gfx/layers/ipc/ShadowLayerUtilsX11.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/ipc/ShadowLayerUtilsX11.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=8 et :
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef mozilla_layers_ShadowLayerUtilsX11_h
    1.12 +#define mozilla_layers_ShadowLayerUtilsX11_h
    1.13 +
    1.14 +#include "ipc/IPCMessageUtils.h"
    1.15 +#include "mozilla/GfxMessageUtils.h"
    1.16 +#include "nsCOMPtr.h"                   // for already_AddRefed
    1.17 +
    1.18 +#define MOZ_HAVE_SURFACEDESCRIPTORX11
    1.19 +#define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
    1.20 +
    1.21 +typedef unsigned long XID;
    1.22 +typedef XID Drawable;
    1.23 +
    1.24 +class gfxXlibSurface;
    1.25 +
    1.26 +namespace IPC {
    1.27 +class Message;
    1.28 +}
    1.29 +
    1.30 +namespace mozilla {
    1.31 +namespace layers {
    1.32 +
    1.33 +struct SurfaceDescriptorX11 {
    1.34 +  SurfaceDescriptorX11()
    1.35 +  { }
    1.36 +
    1.37 +  SurfaceDescriptorX11(gfxXlibSurface* aSurf);
    1.38 +
    1.39 +  SurfaceDescriptorX11(Drawable aDrawable, XID aFormatID,
    1.40 +                       const gfx::IntSize& aSize);
    1.41 +
    1.42 +  // Default copy ctor and operator= are OK
    1.43 +
    1.44 +  bool operator==(const SurfaceDescriptorX11& aOther) const {
    1.45 +    // Define == as two descriptors having the same XID for now,
    1.46 +    // ignoring size and render format.  If the two indeed refer to
    1.47 +    // the same valid XID, then size/format are "actually" the same
    1.48 +    // anyway, regardless of the values of the fields in
    1.49 +    // SurfaceDescriptorX11.
    1.50 +    return mId == aOther.mId;
    1.51 +  }
    1.52 +
    1.53 +  already_AddRefed<gfxXlibSurface> OpenForeign() const;
    1.54 +
    1.55 +  Drawable mId;
    1.56 +  XID mFormat; // either a PictFormat or VisualID
    1.57 +  gfx::IntSize mSize;
    1.58 +};
    1.59 +
    1.60 +} // namespace layers
    1.61 +} // namespace mozilla
    1.62 +
    1.63 +namespace IPC {
    1.64 +
    1.65 +template <>
    1.66 +struct ParamTraits<mozilla::layers::SurfaceDescriptorX11> {
    1.67 +  typedef mozilla::layers::SurfaceDescriptorX11 paramType;
    1.68 +
    1.69 +  static void Write(Message* aMsg, const paramType& aParam) {
    1.70 +    WriteParam(aMsg, aParam.mId);
    1.71 +    WriteParam(aMsg, aParam.mSize);
    1.72 +    WriteParam(aMsg, aParam.mFormat);
    1.73 +  }
    1.74 +
    1.75 +  static bool Read(const Message* aMsg, void** aIter, paramType* aResult) {
    1.76 +    return (ReadParam(aMsg, aIter, &aResult->mId) &&
    1.77 +            ReadParam(aMsg, aIter, &aResult->mSize) &&
    1.78 +            ReadParam(aMsg, aIter, &aResult->mFormat));
    1.79 +  }
    1.80 +};
    1.81 +
    1.82 +} // namespace IPC
    1.83 +
    1.84 +#endif  // mozilla_layers_ShadowLayerUtilsX11_h

mercurial