michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include // for uint8_t, uint32_t michael@0: #include "ImageContainer.h" // for PlanarYCbCrImage, etc michael@0: #include "mozilla/Attributes.h" // for MOZ_OVERRIDE michael@0: #include "mozilla/RefPtr.h" // for RefPtr michael@0: #include "mozilla/ipc/Shmem.h" // for Shmem michael@0: #include "nsCOMPtr.h" // for already_AddRefed michael@0: #include "nsDebug.h" // for NS_WARNING michael@0: #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR michael@0: michael@0: #ifndef MOZILLA_LAYERS_SHAREDPLANARYCBCRIMAGE_H michael@0: #define MOZILLA_LAYERS_SHAREDPLANARYCBCRIMAGE_H michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: class BufferTextureClient; michael@0: class ImageClient; michael@0: class ISurfaceAllocator; michael@0: class SurfaceDescriptor; michael@0: class TextureClient; michael@0: michael@0: class SharedPlanarYCbCrImage : public PlanarYCbCrImage michael@0: , public ISharedImage michael@0: { michael@0: public: michael@0: SharedPlanarYCbCrImage(ImageClient* aCompositable); michael@0: ~SharedPlanarYCbCrImage(); michael@0: michael@0: virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; } michael@0: virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE; michael@0: virtual uint8_t* GetBuffer() MOZ_OVERRIDE; michael@0: michael@0: virtual TemporaryRef GetAsSourceSurface() MOZ_OVERRIDE; michael@0: virtual void SetData(const PlanarYCbCrData& aData) MOZ_OVERRIDE; michael@0: virtual void SetDataNoCopy(const Data &aData) MOZ_OVERRIDE; michael@0: michael@0: virtual bool Allocate(PlanarYCbCrData& aData); michael@0: virtual uint8_t* AllocateBuffer(uint32_t aSize) MOZ_OVERRIDE; michael@0: // needs to be overriden because the parent class sets mBuffer which we michael@0: // do not want to happen. michael@0: virtual uint8_t* AllocateAndGetNewBuffer(uint32_t aSize) MOZ_OVERRIDE; michael@0: michael@0: virtual bool IsValid() MOZ_OVERRIDE; michael@0: michael@0: virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE michael@0: { michael@0: return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); michael@0: } michael@0: michael@0: virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: RefPtr mTextureClient; michael@0: RefPtr mCompositable; michael@0: }; michael@0: michael@0: } // namespace michael@0: } // namespace michael@0: michael@0: #endif