|
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include <stdint.h> // for uint8_t, uint32_t |
|
7 #include "ImageContainer.h" // for PlanarYCbCrImage, etc |
|
8 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE |
|
9 #include "mozilla/RefPtr.h" // for RefPtr |
|
10 #include "mozilla/ipc/Shmem.h" // for Shmem |
|
11 #include "nsCOMPtr.h" // for already_AddRefed |
|
12 #include "nsDebug.h" // for NS_WARNING |
|
13 #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR |
|
14 |
|
15 #ifndef MOZILLA_LAYERS_SHAREDPLANARYCBCRIMAGE_H |
|
16 #define MOZILLA_LAYERS_SHAREDPLANARYCBCRIMAGE_H |
|
17 |
|
18 namespace mozilla { |
|
19 namespace layers { |
|
20 |
|
21 class BufferTextureClient; |
|
22 class ImageClient; |
|
23 class ISurfaceAllocator; |
|
24 class SurfaceDescriptor; |
|
25 class TextureClient; |
|
26 |
|
27 class SharedPlanarYCbCrImage : public PlanarYCbCrImage |
|
28 , public ISharedImage |
|
29 { |
|
30 public: |
|
31 SharedPlanarYCbCrImage(ImageClient* aCompositable); |
|
32 ~SharedPlanarYCbCrImage(); |
|
33 |
|
34 virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; } |
|
35 virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE; |
|
36 virtual uint8_t* GetBuffer() MOZ_OVERRIDE; |
|
37 |
|
38 virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE; |
|
39 virtual void SetData(const PlanarYCbCrData& aData) MOZ_OVERRIDE; |
|
40 virtual void SetDataNoCopy(const Data &aData) MOZ_OVERRIDE; |
|
41 |
|
42 virtual bool Allocate(PlanarYCbCrData& aData); |
|
43 virtual uint8_t* AllocateBuffer(uint32_t aSize) MOZ_OVERRIDE; |
|
44 // needs to be overriden because the parent class sets mBuffer which we |
|
45 // do not want to happen. |
|
46 virtual uint8_t* AllocateAndGetNewBuffer(uint32_t aSize) MOZ_OVERRIDE; |
|
47 |
|
48 virtual bool IsValid() MOZ_OVERRIDE; |
|
49 |
|
50 virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE |
|
51 { |
|
52 return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf); |
|
53 } |
|
54 |
|
55 virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; |
|
56 |
|
57 private: |
|
58 RefPtr<BufferTextureClient> mTextureClient; |
|
59 RefPtr<ImageClient> mCompositable; |
|
60 }; |
|
61 |
|
62 } // namespace |
|
63 } // namespace |
|
64 |
|
65 #endif |