Bug 1224974 - fix GTK shaped window drawing. r=bas

This commit is contained in:
Lee Salzman 2015-11-19 17:23:43 -05:00
parent 225d82ff21
commit f5ef2e5557
2 changed files with 12 additions and 13 deletions

View File

@ -82,7 +82,7 @@ gfxContext::gfxContext(DrawTarget *aTarget, const Point& aDeviceOffset)
mStateStack.SetLength(1);
CurrentState().drawTarget = mDT;
CurrentState().deviceOffset = aDeviceOffset;
mDT->SetTransform(Matrix());
mDT->SetTransform(GetDTTransform());
}
/* static */ already_AddRefed<gfxContext>

View File

@ -2233,8 +2233,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
// support for non-Thebes graphics, UpdateTranslucentWindowAlpha will be
// our private interface so we can rework things to avoid this.
boundsRect = region.GetBounds();
dt->PushClipRect(Rect(boundsRect.x, boundsRect.y,
boundsRect.width, boundsRect.height));
dt->PushClipRect(Rect(boundsRect));
} else {
gfxUtils::ClipToRegion(dt, region);
}
@ -2244,18 +2243,19 @@ nsWindow::OnExposeEvent(cairo_t *cr)
// The double buffering is done here to extract the shape mask.
// (The shape mask won't be necessary when a visual with an alpha
// channel is used on compositing window managers.)
layerBuffering = mozilla::layers::BufferMode::BUFFER_NONE;
RefPtr<DrawTarget> destDT = dt->CreateSimilarDrawTarget(IntSize(boundsRect.width, boundsRect.height), SurfaceFormat::B8G8R8A8);
ctx = new gfxContext(destDT, Point(boundsRect.x, boundsRect.y));
#ifdef MOZ_HAVE_SHMIMAGE
layerBuffering = BufferMode::BUFFER_NONE;
RefPtr<DrawTarget> destDT = dt->CreateSimilarDrawTarget(boundsRect.Size(), SurfaceFormat::B8G8R8A8);
ctx = new gfxContext(destDT, boundsRect.TopLeft());
} else {
#ifdef MOZ_HAVE_SHMIMAGE
if (nsShmImage::UseShm()) {
// We're using an xshm mapping as a back buffer.
layerBuffering = mozilla::layers::BufferMode::BUFFER_NONE;
layerBuffering = BufferMode::BUFFER_NONE;
} else
#endif // MOZ_HAVE_SHMIMAGE
} else {
{
// Get the layer manager to do double buffering (if necessary).
layerBuffering = mozilla::layers::BufferMode::BUFFERED;
layerBuffering = BufferMode::BUFFERED;
}
ctx = new gfxContext(dt);
}
@ -2291,8 +2291,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
UpdateAlpha(surf, boundsRect);
dt->DrawSurface(surf, Rect(boundsRect.x, boundsRect.y, boundsRect.width, boundsRect.height),
Rect(0, 0, boundsRect.width, boundsRect.height),
dt->DrawSurface(surf, Rect(boundsRect), Rect(0, 0, boundsRect.width, boundsRect.height),
DrawSurfaceOptions(Filter::POINT), DrawOptions(1.0f, CompositionOp::OP_SOURCE));
}
}
@ -2346,7 +2345,7 @@ nsWindow::UpdateAlpha(SourceSurface* aSourceSurface, nsIntRect aBoundsRect)
stride, SurfaceFormat::A8);
if (drawTarget) {
drawTarget->DrawSurface(aSourceSurface, Rect(aBoundsRect.x, aBoundsRect.y, aBoundsRect.width, aBoundsRect.height),
drawTarget->DrawSurface(aSourceSurface, Rect(0, 0, aBoundsRect.width, aBoundsRect.height),
Rect(0, 0, aSourceSurface->GetSize().width, aSourceSurface->GetSize().height),
DrawSurfaceOptions(Filter::POINT), DrawOptions(1.0f, CompositionOp::OP_SOURCE));
}