mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 604101 - Part 6 - Add TextureImage::DirectUpload for faster texture uploads. r=jrmuizel a=blocking2.0
This commit is contained in:
parent
47294e7de3
commit
a2e7cac831
@ -285,13 +285,7 @@ ShadowCanvasLayerOGL::Swap(gfxSharedImageSurface* aNewFront)
|
||||
|
||||
gfxSize sz = aNewFront->GetSize();
|
||||
nsIntRegion updateRegion(nsIntRect(0, 0, sz.width, sz.height));
|
||||
// NB: this gfxContext must not escape EndUpdate() below
|
||||
nsRefPtr<gfxContext> dest = mTexImage->BeginUpdate(updateRegion);
|
||||
|
||||
dest->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
dest->DrawSurface(aNewFront, aNewFront->GetSize());
|
||||
|
||||
mTexImage->EndUpdate();
|
||||
mTexImage->DirectUpdate(aNewFront, updateRegion);
|
||||
}
|
||||
|
||||
return aNewFront;
|
||||
|
@ -735,13 +735,7 @@ ShadowImageLayerOGL::Swap(gfxSharedImageSurface* aNewFront)
|
||||
|
||||
gfxSize sz = aNewFront->GetSize();
|
||||
nsIntRegion updateRegion(nsIntRect(0, 0, sz.width, sz.height));
|
||||
// NB: this gfxContext must not escape EndUpdate() below
|
||||
nsRefPtr<gfxContext> dest = mTexImage->BeginUpdate(updateRegion);
|
||||
|
||||
dest->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
dest->DrawSurface(aNewFront, aNewFront->GetSize());
|
||||
|
||||
mTexImage->EndUpdate();
|
||||
mTexImage->DirectUpdate(aNewFront, updateRegion);
|
||||
}
|
||||
|
||||
return aNewFront;
|
||||
|
@ -641,12 +641,7 @@ ShadowBufferOGL::Upload(gfxASurface* aUpdate, const nsIntRegion& aUpdated,
|
||||
// NB: this gfxContext must not escape EndUpdate() below
|
||||
nsIntRegion scaledDestRegion(nsIntRect(destRect.pos.x, destRect.pos.y,
|
||||
destRect.size.width, destRect.size.height));
|
||||
nsRefPtr<gfxContext> dest = mTexImage->BeginUpdate(scaledDestRegion);
|
||||
|
||||
dest->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
dest->DrawSurface(aUpdate, aUpdate->GetSize());
|
||||
|
||||
mTexImage->EndUpdate();
|
||||
mTexImage->DirectUpdate(aUpdate, scaledDestRegion);
|
||||
|
||||
mBufferRect = aRect;
|
||||
mBufferRotation = aRotation;
|
||||
|
@ -645,6 +645,25 @@ BasicTextureImage::FinishedSurfaceUpload()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
BasicTextureImage::DirectUpdate(gfxASurface *aSurf, const nsIntRegion& aRegion)
|
||||
{
|
||||
nsIntRect bounds = aRegion.GetBounds();
|
||||
if (!mTextureInited) {
|
||||
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
|
||||
}
|
||||
|
||||
mShaderType =
|
||||
mGLContext->UploadSurfaceToTexture(aSurf,
|
||||
bounds,
|
||||
mTexture,
|
||||
!mTextureInited,
|
||||
bounds.TopLeft(),
|
||||
PR_FALSE);
|
||||
mTextureInited = PR_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BasicTextureImage::Resize(const nsIntSize& aSize)
|
||||
{
|
||||
|
@ -202,6 +202,8 @@ public:
|
||||
EndUpdate();
|
||||
}
|
||||
|
||||
virtual bool DirectUpdate(gfxASurface *aSurf, const nsIntRegion& aRegion) =0;
|
||||
|
||||
/**
|
||||
* Return this TextureImage's texture ID for use with GL APIs.
|
||||
* Callers are responsible for properly binding the texture etc.
|
||||
@ -295,6 +297,7 @@ public:
|
||||
|
||||
virtual gfxContext* BeginUpdate(nsIntRegion& aRegion);
|
||||
virtual PRBool EndUpdate();
|
||||
virtual bool DirectUpdate(gfxASurface *aSurf, const nsIntRegion& aRegion);
|
||||
|
||||
// Returns a surface to draw into
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
|
@ -1132,6 +1132,30 @@ public:
|
||||
return PR_TRUE; // mTexture is bound
|
||||
}
|
||||
|
||||
virtual bool DirectUpdate(gfxASurface *aSurf, const nsIntRegion& aRegion)
|
||||
{
|
||||
nsIntRect bounds = aRegion.GetBounds();
|
||||
nsIntPoint dest = bounds.TopLeft();
|
||||
|
||||
// Bounds is the destination rect, it will be at 0,0 on the source
|
||||
bounds.x = 0;
|
||||
bounds.y = 0;
|
||||
|
||||
if (!mCreated) {
|
||||
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
|
||||
}
|
||||
|
||||
mShaderType =
|
||||
mGLContext->UploadSurfaceToTexture(aSurf,
|
||||
bounds,
|
||||
mTexture,
|
||||
!mCreated,
|
||||
dest,
|
||||
PR_FALSE);
|
||||
mCreated = PR_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual PRBool InUpdate() const { return !!mUpdateContext; }
|
||||
|
||||
virtual void Resize(const nsIntSize& aSize)
|
||||
|
Loading…
Reference in New Issue
Block a user