Bug 959154 - Part 6: Move away from DeprecatedDirectUpdate and remove them. r=nical

This commit is contained in:
Andreas Pehrson 2014-02-13 17:27:19 +01:00
parent 43e9ea8f99
commit 920f9c11d5
5 changed files with 13 additions and 59 deletions

View File

@ -90,14 +90,9 @@ TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
: nsIntRect(0, 0,
aSurface->GetSize().width,
aSurface->GetSize().height);
nsIntPoint thebesSrcPoint = aSrcPoint ? nsIntPoint(aSrcPoint->x, aSrcPoint->y)
: nsIntPoint(0, 0);
RefPtr<gfxASurface> thebesSurf
= new gfxImageSurface(aSurface->GetData(),
ThebesIntSize(aSurface->GetSize()),
aSurface->Stride(),
SurfaceFormatToImageFormat(aSurface->GetFormat()));
return DeprecatedDirectUpdate(thebesSurf, destRegion, thebesSrcPoint);
gfx::IntPoint srcPoint = aSrcPoint ? *aSrcPoint
: gfx::IntPoint(0, 0);
return DirectUpdate(aSurface, destRegion, srcPoint);
}
gfx::IntRect TextureImage::GetTileRect() {
@ -224,20 +219,6 @@ BasicTextureImage::FinishedSurfaceUpload()
{
}
bool
BasicTextureImage::DeprecatedDirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom /* = nsIntPoint(0, 0) */)
{
nsRefPtr<gfxImageSurface> imageSurf = aSurf->GetAsImageSurface();
NS_ASSERTION(imageSurf, "surface is not an image surface");
RefPtr<gfx::DataSourceSurface> wrappedSurf =
gfx::Factory::CreateWrappingDataSourceSurface(imageSurf->Data(),
imageSurf->Stride(),
gfx::ToIntSize(imageSurf->GetSize()),
gfx::ImageFormatToSurfaceFormat(imageSurf->Format()));
return DirectUpdate(wrappedSurf, aRegion, gfx::IntPoint(aFrom.x, aFrom.y));
}
bool
BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0, 0) */)
{
@ -373,20 +354,6 @@ TiledTextureImage::~TiledTextureImage()
{
}
bool
TiledTextureImage::DeprecatedDirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom /* = nsIntPoint(0, 0) */)
{
nsRefPtr<gfxImageSurface> imageSurf = aSurf->GetAsImageSurface();
NS_ASSERTION(imageSurf, "surface is not an image surface");
RefPtr<gfx::DataSourceSurface> wrappedSurf =
gfx::Factory::CreateWrappingDataSourceSurface(imageSurf->Data(),
imageSurf->Stride(),
gfx::ToIntSize(imageSurf->GetSize()),
gfx::ImageFormatToSurfaceFormat(imageSurf->Format()));
return DirectUpdate(wrappedSurf, aRegion, gfx::IntPoint(aFrom.x, aFrom.y));
}
bool
TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0, 0) */)
{

View File

@ -176,8 +176,6 @@ public:
* aRegion - the region in this image to update
* aFrom - offset in the source to update from
*/
virtual bool DeprecatedDirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom = nsIntPoint(0,0)) = 0;
// Moz2D equivalent
virtual bool DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom = gfx::IntPoint(0,0)) = 0;
bool UpdateFromDataSource(gfx::DataSourceSurface *aSurf,
const nsIntRegion* aDstRegion = nullptr,
@ -283,7 +281,6 @@ public:
virtual gfxASurface* BeginUpdate(nsIntRegion& aRegion);
virtual void GetUpdateRegion(nsIntRegion& aForRegion);
virtual void EndUpdate();
virtual bool DeprecatedDirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom = nsIntPoint(0,0));
virtual bool DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom = gfx::IntPoint(0,0));
virtual GLuint GetTextureID() { return mTexture; }
// Returns a surface to draw into
@ -344,7 +341,6 @@ public:
virtual GLuint GetTextureID() {
return mImages[mCurrentImage]->GetTextureID();
}
virtual bool DeprecatedDirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom = nsIntPoint(0,0));
virtual bool DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom = gfx::IntPoint(0,0));
virtual bool InUpdate() const { return mInUpdate; }
virtual void BindTexture(GLenum);

View File

@ -203,20 +203,6 @@ TextureImageEGL::EndUpdate()
return; // mTexture is bound
}
bool
TextureImageEGL::DeprecatedDirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom /* = nsIntPoint(0, 0) */)
{
nsRefPtr<gfxImageSurface> imageSurf = aSurf->GetAsImageSurface();
NS_ASSERTION(imageSurf, "surface is not an image surface");
RefPtr<gfx::DataSourceSurface> wrappedSurf =
gfx::Factory::CreateWrappingDataSourceSurface(imageSurf->Data(),
imageSurf->Stride(),
gfx::ToIntSize(imageSurf->GetSize()),
gfx::ImageFormatToSurfaceFormat(imageSurf->Format()));
return DirectUpdate(wrappedSurf, aRegion, gfx::IntPoint(aFrom.x, aFrom.y));
}
bool
TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0,0) */)
{

View File

@ -32,8 +32,6 @@ public:
virtual void EndUpdate();
virtual bool DeprecatedDirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, const nsIntPoint& aFrom /* = nsIntPoint(0, 0) */);
virtual bool DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom = gfx::IntPoint(0,0));
virtual void BindTexture(GLenum aTextureUnit);

View File

@ -740,11 +740,18 @@ TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage
} else {
updateRegion = *aRegion;
}
nsIntPoint offset;
gfx::IntPoint offset;
if (aOffset) {
offset = *aOffset;
offset.x = aOffset->x;
offset.y = aOffset->y;
}
mTexture->DeprecatedDirectUpdate(surf.Get(), updateRegion, offset);
nsRefPtr<gfxImageSurface> thebesSurf = surf.GetAsImage();
RefPtr<DataSourceSurface> sourceSurf =
gfx::Factory::CreateWrappingDataSourceSurface(thebesSurf->Data(),
thebesSurf->Stride(),
ToIntSize(thebesSurf->GetSize()),
ImageFormatToSurfaceFormat(thebesSurf->Format()));
mTexture->DirectUpdate(sourceSurf, updateRegion, offset);
mFormat = mTexture->GetTextureFormat();
if (mTexture->InUpdate()) {