Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef MOZILLA_GFX_IMAGEHOST_H
|
|
|
|
#define MOZILLA_GFX_IMAGEHOST_H
|
|
|
|
|
2014-01-06 15:06:04 +00:00
|
|
|
#include <stdio.h> // for FILE
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "CompositableHost.h" // for CompositableHost
|
2015-03-21 16:28:04 +00:00
|
|
|
#include "mozilla/Attributes.h" // for override
|
2015-10-18 05:24:48 +00:00
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr
|
2015-12-02 23:52:00 +00:00
|
|
|
#include "mozilla/gfx/MatrixFwd.h" // for Matrix4x4
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/gfx/Point.h" // for Point
|
2016-12-06 23:39:01 +00:00
|
|
|
#include "mozilla/gfx/Polygon.h" // for Polygon
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/gfx/Rect.h" // for Rect
|
2016-05-25 16:01:18 +00:00
|
|
|
#include "mozilla/gfx/Types.h" // for SamplingFilter
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc
|
2017-02-07 08:07:00 +00:00
|
|
|
#include "mozilla/layers/ImageComposite.h" // for ImageComposite
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
|
|
|
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
|
2014-04-03 06:04:04 +00:00
|
|
|
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "mozilla/mozalloc.h" // for operator delete
|
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
2015-05-07 09:07:42 +00:00
|
|
|
#include "nsRect.h" // for mozilla::gfx::IntRect
|
2015-11-04 16:49:49 +00:00
|
|
|
#include "nsRegionFwd.h" // for nsIntRegion
|
2013-08-11 23:17:23 +00:00
|
|
|
#include "nscore.h" // for nsACString
|
2013-11-27 09:59:01 +00:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 23:17:23 +00:00
|
|
|
class Compositor;
|
|
|
|
struct EffectChain;
|
2017-02-16 03:03:20 +00:00
|
|
|
class HostLayerManager;
|
2013-07-30 09:59:51 +00:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
/**
|
2013-07-30 09:59:51 +00:00
|
|
|
* ImageHost. Works with ImageClientSingle and ImageClientBuffered
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
*/
|
2017-02-07 08:07:00 +00:00
|
|
|
class ImageHost : public CompositableHost,
|
|
|
|
public ImageComposite
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-08-20 04:55:14 +00:00
|
|
|
explicit ImageHost(const TextureInfo& aTextureInfo);
|
2013-07-30 09:59:51 +00:00
|
|
|
~ImageHost();
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual CompositableType GetType() override { return mTextureInfo.mCompositableType; }
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
|
2017-03-22 03:32:55 +00:00
|
|
|
virtual void Composite(Compositor* aCompositor,
|
|
|
|
LayerComposite* aLayer,
|
2015-07-06 03:02:26 +00:00
|
|
|
EffectChain& aEffectChain,
|
2013-07-30 09:59:51 +00:00
|
|
|
float aOpacity,
|
|
|
|
const gfx::Matrix4x4& aTransform,
|
2016-05-25 16:01:18 +00:00
|
|
|
const gfx::SamplingFilter aSamplingFilter,
|
2016-05-13 20:15:17 +00:00
|
|
|
const gfx::IntRect& aClipRect,
|
2016-12-06 23:39:01 +00:00
|
|
|
const nsIntRegion* aVisibleRegion = nullptr,
|
|
|
|
const Maybe<gfx::Polygon>& aGeometry = Nothing()) override;
|
2013-07-30 09:59:51 +00:00
|
|
|
|
2015-05-04 10:59:02 +00:00
|
|
|
virtual void UseTextureHost(const nsTArray<TimedTexture>& aTextures) override;
|
2013-07-30 09:59:51 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void RemoveTextureHost(TextureHost* aTexture) override;
|
2014-02-10 20:52:35 +00:00
|
|
|
|
2015-07-03 22:52:42 +00:00
|
|
|
virtual TextureHost* GetAsTextureHost(gfx::IntRect* aPictureRect = nullptr) override;
|
2013-12-11 18:05:15 +00:00
|
|
|
|
2015-05-04 10:59:02 +00:00
|
|
|
virtual void Attach(Layer* aLayer,
|
2017-03-22 03:32:56 +00:00
|
|
|
TextureSourceProvider* aProvider,
|
2015-05-04 10:59:02 +00:00
|
|
|
AttachFlags aFlags = NO_FLAGS) override;
|
|
|
|
|
2017-03-22 03:32:56 +00:00
|
|
|
virtual void SetTextureSourceProvider(TextureSourceProvider* aProvider) override;
|
2013-12-12 01:44:49 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
gfx::IntSize GetImageSize() const override;
|
2014-11-12 21:44:42 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
|
2013-07-30 09:59:51 +00:00
|
|
|
|
2014-06-19 22:36:25 +00:00
|
|
|
virtual void Dump(std::stringstream& aStream,
|
2014-01-06 15:06:04 +00:00
|
|
|
const char* aPrefix = "",
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aDumpHtml = false) override;
|
2013-08-08 12:53:12 +00:00
|
|
|
|
2015-06-17 14:00:52 +00:00
|
|
|
virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
|
2013-07-30 09:59:51 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool Lock() override;
|
2014-06-22 17:06:00 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void Unlock() override;
|
2014-06-22 17:06:00 +00:00
|
|
|
|
2016-05-25 16:01:18 +00:00
|
|
|
virtual already_AddRefed<TexturedEffect> GenEffect(const gfx::SamplingFilter aSamplingFilter) override;
|
2014-06-22 17:06:00 +00:00
|
|
|
|
2016-02-25 13:15:40 +00:00
|
|
|
void SetCurrentTextureHost(TextureHost* aTexture);
|
|
|
|
|
|
|
|
virtual void CleanupResources() override;
|
|
|
|
|
2016-04-11 02:51:21 +00:00
|
|
|
bool IsOpaque();
|
|
|
|
|
2013-07-30 09:59:51 +00:00
|
|
|
protected:
|
2017-02-07 08:07:00 +00:00
|
|
|
// ImageComposite
|
|
|
|
virtual TimeStamp GetCompositionTime() const override;
|
2015-05-25 10:48:09 +00:00
|
|
|
|
2016-06-02 09:00:33 +00:00
|
|
|
// Use a simple RefPtr because the same texture is already held by a
|
|
|
|
// a CompositableTextureHostRef in the array of TimedImage.
|
|
|
|
// See the comment in CompositableTextureRef for more details.
|
2016-06-02 09:00:27 +00:00
|
|
|
RefPtr<TextureHost> mCurrentTextureHost;
|
2016-02-25 13:15:40 +00:00
|
|
|
CompositableTextureSourceRef mCurrentTextureSource;
|
|
|
|
// When doing texture uploads it's best to alternate between two (or three)
|
|
|
|
// texture sources so that the texture we upload to isn't being used by
|
|
|
|
// the GPU to composite the previous frame.
|
|
|
|
RefPtr<TextureSource> mExtraTextureSource;
|
|
|
|
|
2014-06-22 17:06:00 +00:00
|
|
|
bool mLocked;
|
2014-08-19 02:14:00 +00:00
|
|
|
};
|
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
|
|
|
|
#endif
|