mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Decouple CairoImage from ImageContainer. (bug 1222910, r=roc)
This commit is contained in:
parent
04c58e0d96
commit
f64d767dfe
@ -151,15 +151,7 @@ static already_AddRefed<layers::Image>
|
||||
CreateImageFromSurface(SourceSurface* aSurface, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(aSurface);
|
||||
|
||||
layers::CairoImage::Data cairoData;
|
||||
cairoData.mSize = aSurface->GetSize();
|
||||
cairoData.mSourceSurface = aSurface;
|
||||
|
||||
RefPtr<layers::CairoImage> image = new layers::CairoImage();
|
||||
|
||||
image->SetData(cairoData);
|
||||
|
||||
RefPtr<layers::CairoImage> image = new layers::CairoImage(aSurface->GetSize(), aSurface);
|
||||
return image.forget();
|
||||
}
|
||||
|
||||
|
@ -1173,13 +1173,7 @@ void
|
||||
HTMLCanvasElement::SetFrameCapture(already_AddRefed<SourceSurface> aSurface)
|
||||
{
|
||||
RefPtr<SourceSurface> surface = aSurface;
|
||||
|
||||
CairoImage::Data imageData;
|
||||
imageData.mSize = surface->GetSize();
|
||||
imageData.mSourceSurface = surface;
|
||||
|
||||
RefPtr<CairoImage> image = new CairoImage();
|
||||
image->SetData(imageData);
|
||||
RefPtr<CairoImage> image = new CairoImage(surface->GetSize(), surface);
|
||||
|
||||
// Loop backwards to allow removing elements in the loop.
|
||||
for (int i = mRequestedFrameListeners.Length() - 1; i >= 0; --i) {
|
||||
|
@ -298,13 +298,7 @@ MediaEngineTabVideoSource::Draw() {
|
||||
return;
|
||||
}
|
||||
|
||||
layers::CairoImage::Data cairoData;
|
||||
cairoData.mSize = size;
|
||||
cairoData.mSourceSurface = surface;
|
||||
|
||||
RefPtr<layers::CairoImage> image = new layers::CairoImage();
|
||||
|
||||
image->SetData(cairoData);
|
||||
RefPtr<layers::CairoImage> image = new layers::CairoImage(size, surface);
|
||||
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mImage = image;
|
||||
|
@ -615,18 +615,15 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
|
||||
updatedRect.bottom - updatedRect.top);
|
||||
surface->MarkDirty(ur);
|
||||
|
||||
ImageContainer *container = GetImageContainer();
|
||||
RefPtr<Image> image = container->CreateImage(ImageFormat::CAIRO_SURFACE);
|
||||
NS_ASSERTION(image->GetFormat() == ImageFormat::CAIRO_SURFACE, "Wrong format?");
|
||||
CairoImage* cairoImage = static_cast<CairoImage*>(image.get());
|
||||
CairoImage::Data cairoData;
|
||||
cairoData.mSize = surface->GetSize();
|
||||
cairoData.mSourceSurface = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr, surface);
|
||||
cairoImage->SetData(cairoData);
|
||||
RefPtr<gfx::SourceSurface> sourceSurface =
|
||||
gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr, surface);
|
||||
RefPtr<CairoImage> image = new CairoImage(surface->GetSize(), sourceSurface);
|
||||
|
||||
nsAutoTArray<ImageContainer::NonOwningImage,1> imageList;
|
||||
imageList.AppendElement(
|
||||
ImageContainer::NonOwningImage(image));
|
||||
|
||||
ImageContainer *container = GetImageContainer();
|
||||
container->SetCurrentImages(imageList);
|
||||
}
|
||||
else if (mImageContainer) {
|
||||
|
@ -77,10 +77,6 @@ ImageFactory::CreateImage(ImageFormat aFormat,
|
||||
img = new RecyclingPlanarYCbCrImage(aRecycleBin);
|
||||
return img.forget();
|
||||
}
|
||||
if (aFormat == ImageFormat::CAIRO_SURFACE) {
|
||||
img = new CairoImage();
|
||||
return img.forget();
|
||||
}
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
if (aFormat == ImageFormat::SURFACE_TEXTURE) {
|
||||
img = new SurfaceTextureImage();
|
||||
@ -592,8 +588,10 @@ PlanarYCbCrImage::GetAsSourceSurface()
|
||||
return surface.forget();
|
||||
}
|
||||
|
||||
CairoImage::CairoImage()
|
||||
: Image(nullptr, ImageFormat::CAIRO_SURFACE)
|
||||
CairoImage::CairoImage(const gfx::IntSize& aSize, gfx::SourceSurface* aSourceSurface)
|
||||
: Image(nullptr, ImageFormat::CAIRO_SURFACE),
|
||||
mSize(aSize),
|
||||
mSourceSurface(aSourceSurface)
|
||||
{}
|
||||
|
||||
CairoImage::~CairoImage()
|
||||
|
@ -748,22 +748,6 @@ protected:
|
||||
*/
|
||||
class CairoImage final : public Image {
|
||||
public:
|
||||
struct Data {
|
||||
gfx::IntSize mSize;
|
||||
RefPtr<gfx::SourceSurface> mSourceSurface;
|
||||
};
|
||||
|
||||
/**
|
||||
* This can only be called on the main thread. It may add a reference
|
||||
* to the surface (which will eventually be released on the main thread).
|
||||
* The surface must not be modified after this call!!!
|
||||
*/
|
||||
void SetData(const Data& aData)
|
||||
{
|
||||
mSize = aData.mSize;
|
||||
mSourceSurface = aData.mSourceSurface;
|
||||
}
|
||||
|
||||
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override
|
||||
{
|
||||
RefPtr<gfx::SourceSurface> surface(mSourceSurface);
|
||||
@ -774,11 +758,11 @@ public:
|
||||
|
||||
virtual gfx::IntSize GetSize() override { return mSize; }
|
||||
|
||||
CairoImage();
|
||||
CairoImage(const gfx::IntSize& aSize, gfx::SourceSurface* aSourceSurface);
|
||||
~CairoImage();
|
||||
|
||||
private:
|
||||
gfx::IntSize mSize;
|
||||
|
||||
nsCountedRef<nsMainThreadSourceSurfaceRef> mSourceSurface;
|
||||
nsDataHashtable<nsUint32HashKey, RefPtr<TextureClient> > mTextureClients;
|
||||
};
|
||||
|
@ -628,17 +628,11 @@ RasterImage::GetCurrentImage(ImageContainer* aContainer, uint32_t aFlags)
|
||||
return MakePair(drawResult, RefPtr<layers::Image>());
|
||||
}
|
||||
|
||||
CairoImage::Data cairoData;
|
||||
GetWidth(&cairoData.mSize.width);
|
||||
GetHeight(&cairoData.mSize.height);
|
||||
cairoData.mSourceSurface = surface;
|
||||
|
||||
RefPtr<layers::Image> image =
|
||||
aContainer->CreateImage(ImageFormat::CAIRO_SURFACE);
|
||||
MOZ_ASSERT(image);
|
||||
|
||||
static_cast<CairoImage*>(image.get())->SetData(cairoData);
|
||||
IntSize size;
|
||||
GetWidth(&size.width);
|
||||
GetHeight(&size.height);
|
||||
|
||||
RefPtr<layers::Image> image = new layers::CairoImage(size, surface);
|
||||
return MakePair(drawResult, Move(image));
|
||||
}
|
||||
|
||||
|
@ -6143,13 +6143,8 @@ ContainerState::CreateMaskLayer(Layer *aLayer,
|
||||
// build the image and container
|
||||
container = aLayer->Manager()->CreateImageContainer();
|
||||
NS_ASSERTION(container, "Could not create image container for mask layer.");
|
||||
RefPtr<Image> image = container->CreateImage(ImageFormat::CAIRO_SURFACE);
|
||||
NS_ASSERTION(image, "Could not create image container for mask layer.");
|
||||
CairoImage::Data data;
|
||||
data.mSize = surfaceSizeInt;
|
||||
data.mSourceSurface = surface;
|
||||
|
||||
static_cast<CairoImage*>(image.get())->SetData(data);
|
||||
RefPtr<CairoImage> image = new CairoImage(surfaceSizeInt, surface);
|
||||
container->SetCurrentImageInTransaction(image);
|
||||
|
||||
GetMaskLayerImageCache()->PutImage(newKey.forget(), container);
|
||||
|
Loading…
Reference in New Issue
Block a user