mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 858914 - Basic backend for the new textures. r=mattwoodrow
This commit is contained in:
parent
734c145428
commit
02f17f9efb
@ -9,6 +9,7 @@
|
|||||||
#include "mozilla/layers/YCbCrImageDataSerializer.h"
|
#include "mozilla/layers/YCbCrImageDataSerializer.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "gfx2DGlue.h"
|
#include "gfx2DGlue.h"
|
||||||
|
#include "mozilla/gfx/2D.h"
|
||||||
#include "gfxUtils.h"
|
#include "gfxUtils.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -27,6 +28,46 @@ public:
|
|||||||
virtual gfx::SourceSurface* GetSurface() = 0;
|
virtual gfx::SourceSurface* GetSurface() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DataTextureSourceBasic : public DataTextureSource
|
||||||
|
, public TextureSourceBasic
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual TextureSourceBasic* AsSourceBasic() MOZ_OVERRIDE { return this; }
|
||||||
|
|
||||||
|
virtual gfx::SourceSurface* GetSurface() MOZ_OVERRIDE { return mSurface; }
|
||||||
|
|
||||||
|
SurfaceFormat GetFormat() const MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
return mSurface->GetFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual IntSize GetSize() const MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
return mSurface->GetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool Update(gfx::DataSourceSurface* aSurface,
|
||||||
|
TextureFlags aFlags,
|
||||||
|
nsIntRegion* aDestRegion = nullptr,
|
||||||
|
gfx::IntPoint* aSrcOffset = nullptr) MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
// XXX - For this to work with IncrementalContentHost we will need to support
|
||||||
|
// the aDestRegion and aSrcOffset parameters properly;
|
||||||
|
mSurface = aSurface;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void DeallocateDeviceData() MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
mSurface = nullptr;
|
||||||
|
SetUpdateSerial(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
RefPtr<gfx::DataSourceSurface> mSurface;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Texture source and host implementaion for software compositing.
|
* Texture source and host implementaion for software compositing.
|
||||||
*/
|
*/
|
||||||
@ -34,6 +75,12 @@ class DeprecatedTextureHostBasic : public DeprecatedTextureHost
|
|||||||
, public TextureSourceBasic
|
, public TextureSourceBasic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
DeprecatedTextureHostBasic()
|
||||||
|
: mCompositor(nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
|
||||||
|
|
||||||
virtual IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
virtual IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||||
|
|
||||||
virtual TextureSourceBasic* AsSourceBasic() MOZ_OVERRIDE { return this; }
|
virtual TextureSourceBasic* AsSourceBasic() MOZ_OVERRIDE { return this; }
|
||||||
@ -88,6 +135,7 @@ protected:
|
|||||||
nsRefPtr<gfxImageSurface> mThebesImage;
|
nsRefPtr<gfxImageSurface> mThebesImage;
|
||||||
nsRefPtr<gfxASurface> mThebesSurface;
|
nsRefPtr<gfxASurface> mThebesSurface;
|
||||||
IntSize mSize;
|
IntSize mSize;
|
||||||
|
SurfaceFormat mFormat;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -231,6 +279,19 @@ BasicCompositor::CreateRenderTargetFromSource(const IntRect &aRect,
|
|||||||
return rt.forget();
|
return rt.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TemporaryRef<DataTextureSource>
|
||||||
|
BasicCompositor::CreateDataTextureSource(TextureFlags aFlags)
|
||||||
|
{
|
||||||
|
RefPtr<DataTextureSource> result = new DataTextureSourceBasic();
|
||||||
|
return result.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
BasicCompositor::SupportsEffect(EffectTypes aEffect)
|
||||||
|
{
|
||||||
|
return static_cast<EffectTypes>(aEffect) != EFFECT_YCBCR;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DrawSurfaceWithTextureCoords(DrawTarget *aDest,
|
DrawSurfaceWithTextureCoords(DrawTarget *aDest,
|
||||||
const gfx::Rect& aDestRect,
|
const gfx::Rect& aDestRect,
|
||||||
|
@ -23,6 +23,12 @@ public:
|
|||||||
|
|
||||||
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
|
||||||
|
|
||||||
|
virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE
|
||||||
|
{
|
||||||
|
return mDrawTarget ? mDrawTarget->GetFormat()
|
||||||
|
: gfx::FORMAT_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
RefPtr<gfx::DrawTarget> mDrawTarget;
|
RefPtr<gfx::DrawTarget> mDrawTarget;
|
||||||
gfx::IntSize mSize;
|
gfx::IntSize mSize;
|
||||||
};
|
};
|
||||||
@ -39,9 +45,6 @@ public:
|
|||||||
|
|
||||||
virtual void Destroy() MOZ_OVERRIDE;
|
virtual void Destroy() MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual TemporaryRef<DataTextureSource>
|
|
||||||
CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE { return nullptr; }
|
|
||||||
|
|
||||||
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
|
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
return TextureFactoryIdentifier(LAYERS_BASIC,
|
return TextureFactoryIdentifier(LAYERS_BASIC,
|
||||||
@ -56,6 +59,11 @@ public:
|
|||||||
CreateRenderTargetFromSource(const gfx::IntRect &aRect,
|
CreateRenderTargetFromSource(const gfx::IntRect &aRect,
|
||||||
const CompositingRenderTarget *aSource) MOZ_OVERRIDE;
|
const CompositingRenderTarget *aSource) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual TemporaryRef<DataTextureSource>
|
||||||
|
CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual bool SupportsEffect(EffectTypes aEffect) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual void SetRenderTarget(CompositingRenderTarget *aSource) MOZ_OVERRIDE
|
virtual void SetRenderTarget(CompositingRenderTarget *aSource) MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
mRenderTarget = static_cast<BasicCompositingRenderTarget*>(aSource);
|
mRenderTarget = static_cast<BasicCompositingRenderTarget*>(aSource);
|
||||||
|
Loading…
Reference in New Issue
Block a user