mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 987498 - Part 1 - Layers support OverlayImage. r=roc
This commit is contained in:
parent
5cc85ff40f
commit
47282536a0
@ -138,7 +138,7 @@ BufferRecycleBin::GetBuffer(uint32_t aSize)
|
||||
return result;
|
||||
}
|
||||
|
||||
ImageContainer::ImageContainer(int flag)
|
||||
ImageContainer::ImageContainer(ImageContainer::Mode flag)
|
||||
: mReentrantMonitor("ImageContainer.mReentrantMonitor"),
|
||||
mPaintCount(0),
|
||||
mPreviousImagePainted(false),
|
||||
@ -147,11 +147,24 @@ ImageContainer::ImageContainer(int flag)
|
||||
mCompositionNotifySink(nullptr),
|
||||
mImageClient(nullptr)
|
||||
{
|
||||
if (flag == ENABLE_ASYNC && ImageBridgeChild::IsCreated()) {
|
||||
if (ImageBridgeChild::IsCreated()) {
|
||||
// the refcount of this ImageClient is 1. we don't use a RefPtr here because the refcount
|
||||
// of this class must be done on the ImageBridge thread.
|
||||
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::IMAGE).take();
|
||||
MOZ_ASSERT(mImageClient);
|
||||
switch(flag) {
|
||||
case SYNCHRONOUS:
|
||||
break;
|
||||
case ASYNCHRONOUS:
|
||||
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::IMAGE).take();
|
||||
MOZ_ASSERT(mImageClient);
|
||||
break;
|
||||
case ASYNCHRONOUS_OVERLAY:
|
||||
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::IMAGE_OVERLAY).take();
|
||||
MOZ_ASSERT(mImageClient);
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT(false, "This flag is invalid.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,9 +291,9 @@ class ImageContainer final : public SupportsWeakPtr<ImageContainer> {
|
||||
public:
|
||||
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(ImageContainer)
|
||||
|
||||
enum { DISABLE_ASYNC = 0x0, ENABLE_ASYNC = 0x01 };
|
||||
enum Mode { SYNCHRONOUS = 0x0, ASYNCHRONOUS = 0x01, ASYNCHRONOUS_OVERLAY = 0x02 };
|
||||
|
||||
explicit ImageContainer(int flag = 0);
|
||||
explicit ImageContainer(ImageContainer::Mode flag = SYNCHRONOUS);
|
||||
|
||||
/**
|
||||
* Create an Image in one of the given formats.
|
||||
|
@ -167,16 +167,9 @@ LayerManager::Mutated(Layer* aLayer)
|
||||
#endif // DEBUG
|
||||
|
||||
already_AddRefed<ImageContainer>
|
||||
LayerManager::CreateImageContainer()
|
||||
LayerManager::CreateImageContainer(ImageContainer::Mode flag)
|
||||
{
|
||||
nsRefPtr<ImageContainer> container = new ImageContainer(ImageContainer::DISABLE_ASYNC);
|
||||
return container.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<ImageContainer>
|
||||
LayerManager::CreateAsynchronousImageContainer()
|
||||
{
|
||||
nsRefPtr<ImageContainer> container = new ImageContainer(ImageContainer::ENABLE_ASYNC);
|
||||
nsRefPtr<ImageContainer> container = new ImageContainer(flag);
|
||||
return container.forget();
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "mozilla/Logging.h" // for PRLogModuleInfo
|
||||
#include "nsIWidget.h" // For plugin window configuration information structs
|
||||
#include "gfxVR.h"
|
||||
#include "ImageContainer.h"
|
||||
|
||||
class gfxContext;
|
||||
|
||||
@ -81,7 +82,6 @@ class PaintedLayer;
|
||||
class ContainerLayer;
|
||||
class ImageLayer;
|
||||
class ColorLayer;
|
||||
class ImageContainer;
|
||||
class CanvasLayer;
|
||||
class ReadbackLayer;
|
||||
class ReadbackProcessor;
|
||||
@ -435,19 +435,12 @@ public:
|
||||
* Can be called anytime, from any thread.
|
||||
*
|
||||
* Creates an Image container which forwards its images to the compositor within
|
||||
* layer transactions on the main thread.
|
||||
* layer transactions on the main thread or asynchronously using the ImageBridge IPDL protocol.
|
||||
* In the case of asynchronous, If the protocol is not available, the returned ImageContainer
|
||||
* will forward images within layer transactions.
|
||||
*/
|
||||
static already_AddRefed<ImageContainer> CreateImageContainer();
|
||||
|
||||
/**
|
||||
* Can be called anytime, from any thread.
|
||||
*
|
||||
* Tries to create an Image container which forwards its images to the compositor
|
||||
* asynchronously using the ImageBridge IPDL protocol. If the protocol is not
|
||||
* available, the returned ImageContainer will forward images within layer
|
||||
* transactions, just like if it was created with CreateImageContainer().
|
||||
*/
|
||||
static already_AddRefed<ImageContainer> CreateAsynchronousImageContainer();
|
||||
static already_AddRefed<ImageContainer> CreateImageContainer(ImageContainer::Mode flag
|
||||
= ImageContainer::SYNCHRONOUS);
|
||||
|
||||
/**
|
||||
* Type of layer manager his is. This is to be used sparsely in order to
|
||||
|
@ -363,6 +363,16 @@ ImageHostOverlay::UseOverlaySource(OverlaySource aOverlay)
|
||||
mOverlay = aOverlay;
|
||||
}
|
||||
|
||||
IntSize
|
||||
ImageHostOverlay::GetImageSize() const
|
||||
{
|
||||
if (mHasPictureRect) {
|
||||
return IntSize(mPictureRect.width, mPictureRect.height);
|
||||
}
|
||||
|
||||
return IntSize();
|
||||
}
|
||||
|
||||
void
|
||||
ImageHostOverlay::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
|
@ -112,7 +112,8 @@ public:
|
||||
const nsIntRegion* aVisibleRegion = nullptr) override;
|
||||
virtual LayerRenderState GetRenderState() override;
|
||||
virtual void UseOverlaySource(OverlaySource aOverlay) override;
|
||||
virtual void SetPictureRect(const gfx::IntRect& aPictureRect) override
|
||||
virtual gfx::IntSize GetImageSize() const override;
|
||||
virtual void SetPictureRect(const nsIntRect& aPictureRect) override
|
||||
{
|
||||
mPictureRect = aPictureRect;
|
||||
mHasPictureRect = true;
|
||||
|
Loading…
Reference in New Issue
Block a user