1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "CompositableHost.h"
8 #include <map> // for _Rb_tree_iterator, map, etc
9 #include <utility> // for pair
10 #include "Effects.h" // for EffectMask, Effect, etc
12 #include "mozilla/gfx/gfxVars.h"
13 #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
14 #include "mozilla/layers/TextureHost.h" // for TextureHost, etc
15 #include "mozilla/layers/WebRenderImageHost.h"
16 #include "mozilla/RefPtr.h" // for nsRefPtr
17 #include "nsDebug.h" // for NS_WARNING
18 #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
19 #include "gfxPlatform.h" // for gfxPlatform
20 #include "IPDLActor.h"
30 CompositableHost::CompositableHost(const TextureInfo
& aTextureInfo
)
31 : mTextureInfo(aTextureInfo
), mCompositorBridgeID(0) {
32 MOZ_COUNT_CTOR(CompositableHost
);
35 CompositableHost::~CompositableHost() { MOZ_COUNT_DTOR(CompositableHost
); }
37 void CompositableHost::UseTextureHost(const nsTArray
<TimedTexture
>& aTextures
) {
40 void CompositableHost::RemoveTextureHost(TextureHost
* aTexture
) {}
43 already_AddRefed
<CompositableHost
> CompositableHost::Create(
44 const TextureInfo
& aTextureInfo
) {
45 RefPtr
<CompositableHost
> result
;
46 switch (aTextureInfo
.mCompositableType
) {
47 case CompositableType::IMAGE
:
48 result
= new WebRenderImageHost(aTextureInfo
);
51 NS_ERROR("Unknown CompositableType");
53 return result
.forget();
56 void CompositableHost::DumpTextureHost(std::stringstream
& aStream
,
57 TextureHost
* aTexture
) {
61 RefPtr
<gfx::DataSourceSurface
> dSurf
= aTexture
->GetAsSurface();
65 aStream
<< gfxUtils::GetAsDataURI(dSurf
).get();
69 } // namespace mozilla