Bug 1258086 - Clear unbuffered SHM images with a 32-bit visual before drawing with the basic layer manager. r?lsalzman
MozReview-Commit-ID: 8XgVwvBDZ3X
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2277,16 +2277,27 @@ nsWindow::OnExposeEvent(cairo_t *cr)
#endif
#endif
#endif // MOZ_X11
bool painted = false;
{
if (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) {
+ GdkScreen *screen = gdk_window_get_screen(mGdkWindow);
+ if (GetTransparencyMode() == eTransparencyTransparent &&
+ layerBuffering == BufferMode::BUFFER_NONE &&
+ gdk_screen_is_composited(screen) &&
+ gdk_window_get_visual(mGdkWindow) ==
+ gdk_screen_get_rgba_visual(screen)) {
+ // If our draw target is unbuffered and we use an alpha channel,
+ // clear the image beforehand to ensure we don't get artifacts from a
+ // reused SHM image. See bug 1258086.
+ dt->ClearRect(Rect(boundsRect));
+ }
AutoLayerManagerSetup setupLayerManager(this, ctx, layerBuffering);
painted = listener->PaintWindow(this, region);
}
}
#ifdef MOZ_X11
// PaintWindow can Destroy us (bug 378273), avoid doing any paint
// operations below if that happened - it will lead to XError and exit().