gfx/layers/ipc/SharedRGBImage.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/layers/ipc/SharedRGBImage.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef SHAREDRGBIMAGE_H_
     1.9 +#define SHAREDRGBIMAGE_H_
    1.10 +
    1.11 +#include <stddef.h>                     // for size_t
    1.12 +#include <stdint.h>                     // for uint8_t
    1.13 +#include "ImageContainer.h"             // for ISharedImage, Image, etc
    1.14 +#include "gfxTypes.h"
    1.15 +#include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
    1.16 +#include "mozilla/RefPtr.h"             // for RefPtr
    1.17 +#include "mozilla/gfx/Point.h"          // for IntSize
    1.18 +#include "mozilla/gfx/Types.h"          // for SurfaceFormat
    1.19 +#include "nsCOMPtr.h"                   // for already_AddRefed
    1.20 +
    1.21 +namespace mozilla {
    1.22 +namespace ipc {
    1.23 +class Shmem;
    1.24 +}
    1.25 +
    1.26 +namespace layers {
    1.27 +
    1.28 +class BufferTextureClient;
    1.29 +class ImageClient;
    1.30 +class ISurfaceAllocator;
    1.31 +class TextureClient;
    1.32 +class SurfaceDescriptor;
    1.33 +
    1.34 +already_AddRefed<Image> CreateSharedRGBImage(ImageContainer* aImageContainer,
    1.35 +                                             nsIntSize aSize,
    1.36 +                                             gfxImageFormat aImageFormat);
    1.37 +
    1.38 +/**
    1.39 + * Stores RGB data in shared memory
    1.40 + * It is assumed that the image width and stride are equal
    1.41 + */
    1.42 +class SharedRGBImage : public Image
    1.43 +                     , public ISharedImage
    1.44 +{
    1.45 +public:
    1.46 +  SharedRGBImage(ImageClient* aCompositable);
    1.47 +  ~SharedRGBImage();
    1.48 +
    1.49 +  virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; }
    1.50 +
    1.51 +  virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE;
    1.52 +
    1.53 +  virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
    1.54 +
    1.55 +  gfx::IntSize GetSize();
    1.56 +
    1.57 +  size_t GetBufferSize();
    1.58 +
    1.59 +  TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
    1.60 +
    1.61 +  bool Allocate(gfx::IntSize aSize, gfx::SurfaceFormat aFormat);
    1.62 +private:
    1.63 +  gfx::IntSize mSize;
    1.64 +  RefPtr<ImageClient> mCompositable;
    1.65 +  RefPtr<BufferTextureClient> mTextureClient;
    1.66 +};
    1.67 +
    1.68 +} // namespace layers
    1.69 +} // namespace mozilla
    1.70 +
    1.71 +#endif

mercurial