gfx/layers/SharedTextureImage.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/SharedTextureImage.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     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 GFX_SHAREDTEXTUREIMAGE_H
    1.10 +#define GFX_SHAREDTEXTUREIMAGE_H
    1.11 +
    1.12 +#include "GLContextProvider.h"          // for GLContextProvider
    1.13 +#include "ImageContainer.h"             // for Image
    1.14 +#include "ImageTypes.h"                 // for ImageFormat::SHARED_TEXTURE
    1.15 +#include "nsCOMPtr.h"                   // for already_AddRefed
    1.16 +#include "mozilla/gfx/Point.h"          // for IntSize
    1.17 +
    1.18 +// Split into a separate header from ImageLayers.h due to GLContext.h dependence
    1.19 +// Implementation remains in ImageLayers.cpp
    1.20 +
    1.21 +namespace mozilla {
    1.22 +
    1.23 +namespace layers {
    1.24 +
    1.25 +class SharedTextureImage : public Image {
    1.26 +public:
    1.27 +  struct Data {
    1.28 +    gl::SharedTextureHandle mHandle;
    1.29 +    gl::SharedTextureShareType mShareType;
    1.30 +    gfx::IntSize mSize;
    1.31 +    bool mInverted;
    1.32 +  };
    1.33 +
    1.34 +  void SetData(const Data& aData) { mData = aData; }
    1.35 +  const Data* GetData() { return &mData; }
    1.36 +
    1.37 +  gfx::IntSize GetSize() { return mData.mSize; }
    1.38 +
    1.39 +  virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE
    1.40 +  {
    1.41 +    return nullptr;
    1.42 +  }
    1.43 +
    1.44 +  SharedTextureImage() : Image(nullptr, ImageFormat::SHARED_TEXTURE) {}
    1.45 +
    1.46 +private:
    1.47 +  Data mData;
    1.48 +};
    1.49 +
    1.50 +} // layers
    1.51 +} // mozilla
    1.52 +
    1.53 +#endif // GFX_SHAREDTEXTUREIMAGE_H

mercurial