mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 749357 - TiledThebesLayerOGL can draw un-rendered areas of tiles. r=chrislord
This commit is contained in:
parent
293cde4260
commit
9177b22315
@ -122,8 +122,8 @@ ReusableTileStoreOGL::HarvestTiles(TiledLayerBufferOGL* aVideoMemoryTiledBuffer,
|
||||
TiledTexture removedTile;
|
||||
if (aVideoMemoryTiledBuffer->RemoveTile(nsIntPoint(x, y), removedTile)) {
|
||||
ReusableTiledTextureOGL* reusedTile =
|
||||
new ReusableTiledTextureOGL(removedTile, tileRegion, tileSize,
|
||||
aOldResolution);
|
||||
new ReusableTiledTextureOGL(removedTile, nsIntPoint(x, y), tileRegion,
|
||||
tileSize, aOldResolution);
|
||||
mTiles.AppendElement(reusedTile);
|
||||
}
|
||||
#ifdef GFX_TILEDLAYER_PREF_WARNINGS
|
||||
@ -196,12 +196,11 @@ ReusableTileStoreOGL::DrawTiles(TiledThebesLayerOGL* aLayer,
|
||||
// semi-transparent layers.
|
||||
// Similarly, if we have multiple tiles covering the same area, we will
|
||||
// end up with rendering artifacts if the aLayer isn't opaque.
|
||||
nsIntRect tileRect = tile->mTileRegion.GetBounds();
|
||||
uint16_t tileStartX = tileRect.x % tile->mTileSize;
|
||||
uint16_t tileStartY = tileRect.y % tile->mTileSize;
|
||||
nsIntRect textureRect(tileStartX, tileStartY, tileRect.width, tileRect.height);
|
||||
uint16_t tileStartX = tile->mTileOrigin.x % tile->mTileSize;
|
||||
uint16_t tileStartY = tile->mTileOrigin.y % tile->mTileSize;
|
||||
nsIntPoint tileOffset(tile->mTileOrigin.x - tileStartX, tile->mTileOrigin.y - tileStartY);
|
||||
nsIntSize textureSize(tile->mTileSize, tile->mTileSize);
|
||||
aLayer->RenderTile(tile->mTexture, transform, aRenderOffset, tileRect, textureRect, textureSize);
|
||||
aLayer->RenderTile(tile->mTexture, transform, aRenderOffset, tile->mTileRegion, tileOffset, textureSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,12 @@ class ReusableTiledTextureOGL
|
||||
{
|
||||
public:
|
||||
ReusableTiledTextureOGL(TiledTexture aTexture,
|
||||
const nsIntPoint& aTileOrigin,
|
||||
const nsIntRegion& aTileRegion,
|
||||
uint16_t aTileSize,
|
||||
gfxSize aResolution)
|
||||
: mTexture(aTexture)
|
||||
, mTileOrigin(aTileOrigin)
|
||||
, mTileRegion(aTileRegion)
|
||||
, mTileSize(aTileSize)
|
||||
, mResolution(aResolution)
|
||||
@ -35,6 +37,7 @@ public:
|
||||
~ReusableTiledTextureOGL() {}
|
||||
|
||||
TiledTexture mTexture;
|
||||
const nsIntPoint mTileOrigin;
|
||||
const nsIntRegion mTileRegion;
|
||||
uint16_t mTileSize;
|
||||
gfxSize mResolution;
|
||||
|
@ -184,8 +184,8 @@ void
|
||||
TiledThebesLayerOGL::RenderTile(TiledTexture aTile,
|
||||
const gfx3DMatrix& aTransform,
|
||||
const nsIntPoint& aOffset,
|
||||
nsIntRect aScreenRect,
|
||||
nsIntRect aTextureRect,
|
||||
nsIntRegion aScreenRegion,
|
||||
nsIntPoint aTextureOffset,
|
||||
nsIntSize aTextureBounds)
|
||||
{
|
||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, aTile.mTextureHandle);
|
||||
@ -200,11 +200,16 @@ TiledThebesLayerOGL::RenderTile(TiledTexture aTile,
|
||||
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||
program->SetLayerTransform(aTransform);
|
||||
program->SetRenderOffset(aOffset);
|
||||
program->SetLayerQuadRect(aScreenRect);
|
||||
|
||||
mOGLManager->BindAndDrawQuadWithTextureRect(program,
|
||||
aTextureRect,
|
||||
aTextureBounds);
|
||||
nsIntRegionRectIterator it(aScreenRegion);
|
||||
for (const nsIntRect* rect = it.Next(); rect != nsnull; rect = it.Next()) {
|
||||
nsIntRect textureRect(rect->x - aTextureOffset.x, rect->y - aTextureOffset.y,
|
||||
rect->width, rect->height);
|
||||
program->SetLayerQuadRect(*rect);
|
||||
mOGLManager->BindAndDrawQuadWithTextureRect(program,
|
||||
textureRect,
|
||||
aTextureBounds);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -244,9 +249,13 @@ TiledThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer, const nsIntPoint& aOf
|
||||
GetTile(nsIntPoint(mVideoMemoryTiledBuffer.RoundDownToTileEdge(x),
|
||||
mVideoMemoryTiledBuffer.RoundDownToTileEdge(y)));
|
||||
if (tileTexture != mVideoMemoryTiledBuffer.GetPlaceholderTile()) {
|
||||
nsIntRegion tileDrawRegion = nsIntRegion(nsIntRect(x, y, w, h));
|
||||
tileDrawRegion.And(tileDrawRegion, mValidRegion);
|
||||
|
||||
nsIntPoint tileOffset(x - tileStartX, y - tileStartY);
|
||||
uint16_t tileSize = mVideoMemoryTiledBuffer.GetTileLength();
|
||||
RenderTile(tileTexture, GetEffectiveTransform(), aOffset, nsIntRect(x,y,w,h),
|
||||
nsIntRect(tileStartX, tileStartY, w, h), nsIntSize(tileSize, tileSize));
|
||||
RenderTile(tileTexture, GetEffectiveTransform(), aOffset, tileDrawRegion,
|
||||
tileOffset, nsIntSize(tileSize, tileSize));
|
||||
}
|
||||
tileY++;
|
||||
y += h;
|
||||
|
@ -131,13 +131,11 @@ public:
|
||||
void ProcessUploadQueue();
|
||||
|
||||
// Renders a single given tile.
|
||||
// XXX This currently takes an nsIntRect, but should actually take an
|
||||
// nsIntRegion and iterate over each rectangle in the region.
|
||||
void RenderTile(TiledTexture aTile,
|
||||
const gfx3DMatrix& aTransform,
|
||||
const nsIntPoint& aOffset,
|
||||
nsIntRect aScreenRect,
|
||||
nsIntRect aTextureRect,
|
||||
nsIntRegion aScreenRegion,
|
||||
nsIntPoint aTextureOffset,
|
||||
nsIntSize aTextureBounds);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user