Line data Source code
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 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 ImageClient;
22 : class TextureClient;
23 :
24 : class SharedPlanarYCbCrImage : public PlanarYCbCrImage
25 : {
26 : public:
27 : explicit SharedPlanarYCbCrImage(ImageClient* aCompositable);
28 :
29 : protected:
30 : ~SharedPlanarYCbCrImage();
31 :
32 : public:
33 : virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
34 : virtual uint8_t* GetBuffer() override;
35 :
36 : virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
37 : virtual bool CopyData(const PlanarYCbCrData& aData) override;
38 : virtual bool AdoptData(const Data &aData) override;
39 :
40 : virtual bool Allocate(PlanarYCbCrData& aData);
41 : virtual uint8_t* AllocateAndGetNewBuffer(uint32_t aSize) override;
42 :
43 : virtual bool IsValid() override;
44 :
45 0 : virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
46 : {
47 0 : return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
48 : }
49 :
50 : virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
51 :
52 : private:
53 : RefPtr<TextureClient> mTextureClient;
54 : RefPtr<ImageClient> mCompositable;
55 : };
56 :
57 : } // namespace layers
58 : } // namespace mozilla
59 :
60 : #endif
|