gfx/layers/basic/TextureClientX11.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/basic/TextureClientX11.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 +//  * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef MOZILLA_GFX_TEXTURECLIENT_X11_H
    1.10 +#define MOZILLA_GFX_TEXTURECLIENT_X11_H
    1.11 +
    1.12 +#include "mozilla/layers/TextureClient.h"
    1.13 +#include "ISurfaceAllocator.h" // For IsSurfaceDescriptorValid
    1.14 +#include "mozilla/layers/ShadowLayerUtilsX11.h"
    1.15 +
    1.16 +namespace mozilla {
    1.17 +namespace layers {
    1.18 +
    1.19 +/**
    1.20 + * A TextureClient implementation based on Xlib.
    1.21 + */
    1.22 +class TextureClientX11 : public TextureClient
    1.23 +{
    1.24 + public:
    1.25 +  TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
    1.26 +
    1.27 +  ~TextureClientX11();
    1.28 +
    1.29 +  // TextureClient
    1.30 +
    1.31 +  virtual bool IsAllocated() const MOZ_OVERRIDE;
    1.32 +
    1.33 +  virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
    1.34 +
    1.35 +  virtual TextureClientData* DropTextureData() MOZ_OVERRIDE;
    1.36 +
    1.37 +  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
    1.38 +
    1.39 +  virtual bool Lock(OpenMode aMode) MOZ_OVERRIDE;
    1.40 +
    1.41 +  virtual void Unlock() MOZ_OVERRIDE;
    1.42 +
    1.43 +  virtual bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
    1.44 +
    1.45 +  virtual bool AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlags flags) MOZ_OVERRIDE;
    1.46 +
    1.47 +  virtual bool CanExposeDrawTarget() const MOZ_OVERRIDE { return true; }
    1.48 +
    1.49 +  virtual TemporaryRef<gfx::DrawTarget> GetAsDrawTarget() MOZ_OVERRIDE;
    1.50 +
    1.51 +  virtual gfx::SurfaceFormat GetFormat() const { return mFormat; }
    1.52 +
    1.53 +  virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; }
    1.54 +
    1.55 + private:
    1.56 +  gfx::SurfaceFormat mFormat;
    1.57 +  gfx::IntSize mSize;
    1.58 +  RefPtr<gfxXlibSurface> mSurface;
    1.59 +  bool mLocked;
    1.60 +};
    1.61 +
    1.62 +} // namespace layers
    1.63 +} // namespace mozilla
    1.64 +
    1.65 +#endif

mercurial