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: #ifndef MOZILLA_GFX_IMAGEHOST_H michael@0: #define MOZILLA_GFX_IMAGEHOST_H michael@0: michael@0: #include // for FILE michael@0: #include "CompositableHost.h" // for CompositableHost michael@0: #include "mozilla/Attributes.h" // for MOZ_OVERRIDE michael@0: #include "mozilla/RefPtr.h" // for RefPtr michael@0: #include "mozilla/gfx/Point.h" // for Point michael@0: #include "mozilla/gfx/Rect.h" // for Rect michael@0: #include "mozilla/gfx/Types.h" // for Filter michael@0: #include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc michael@0: #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor michael@0: #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc michael@0: #include "mozilla/layers/TextureHost.h" // for TextureHost, etc michael@0: #include "mozilla/mozalloc.h" // for operator delete michael@0: #include "nsCOMPtr.h" // for already_AddRefed michael@0: #include "nsRect.h" // for nsIntRect michael@0: #include "nscore.h" // for nsACString michael@0: michael@0: class nsIntRegion; michael@0: michael@0: namespace mozilla { michael@0: namespace gfx { michael@0: class Matrix4x4; michael@0: } michael@0: namespace layers { michael@0: michael@0: class Compositor; michael@0: class ISurfaceAllocator; michael@0: struct EffectChain; michael@0: michael@0: /** michael@0: * ImageHost. Works with ImageClientSingle and ImageClientBuffered michael@0: */ michael@0: class ImageHost : public CompositableHost michael@0: { michael@0: public: michael@0: ImageHost(const TextureInfo& aTextureInfo); michael@0: ~ImageHost(); michael@0: michael@0: virtual CompositableType GetType() { return mTextureInfo.mCompositableType; } michael@0: michael@0: virtual void Composite(EffectChain& aEffectChain, michael@0: float aOpacity, michael@0: const gfx::Matrix4x4& aTransform, michael@0: const gfx::Filter& aFilter, michael@0: const gfx::Rect& aClipRect, michael@0: const nsIntRegion* aVisibleRegion = nullptr, michael@0: TiledLayerProperties* aLayerProperties = nullptr) MOZ_OVERRIDE; michael@0: michael@0: virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE; michael@0: michael@0: virtual void RemoveTextureHost(TextureHost* aTexture) MOZ_OVERRIDE; michael@0: michael@0: virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE; michael@0: michael@0: virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE; michael@0: michael@0: virtual void SetPictureRect(const nsIntRect& aPictureRect) MOZ_OVERRIDE michael@0: { michael@0: mPictureRect = aPictureRect; michael@0: mHasPictureRect = true; michael@0: } michael@0: michael@0: virtual LayerRenderState GetRenderState() MOZ_OVERRIDE; michael@0: michael@0: virtual void PrintInfo(nsACString& aTo, const char* aPrefix); michael@0: michael@0: #ifdef MOZ_DUMP_PAINTING michael@0: virtual void Dump(FILE* aFile = nullptr, michael@0: const char* aPrefix = "", michael@0: bool aDumpHtml = false) MOZ_OVERRIDE; michael@0: michael@0: virtual TemporaryRef GetAsSurface() MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: protected: michael@0: michael@0: RefPtr mFrontBuffer; michael@0: nsIntRect mPictureRect; michael@0: bool mHasPictureRect; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif