From e23b6f8a9d2ddbbb4080f2c6cf5a92d6387d2bf4 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 31 Dec 2018 14:54:53 +0000 Subject: [PATCH] Fix screenshot pixel opacity. --- OpenRA.Platforms.Default/Sdl2GraphicsContext.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenRA.Platforms.Default/Sdl2GraphicsContext.cs b/OpenRA.Platforms.Default/Sdl2GraphicsContext.cs index 6bfbf394e8..c1b2565e1d 100644 --- a/OpenRA.Platforms.Default/Sdl2GraphicsContext.cs +++ b/OpenRA.Platforms.Default/Sdl2GraphicsContext.cs @@ -134,6 +134,16 @@ namespace OpenRA.Platforms.Default OpenGL.glPopClientAttrib(); + // Reset alpha channel to fully opaque + unsafe + { + var colors = (int*)data.Scan0; + var stride = data.Stride / 4; + for (var y = 0; y < rect.Height; y++) + for (var x = 0; x < rect.Width; x++) + colors[y * stride + x] |= 0xFF << 24; + } + bitmap.UnlockBits(data); // OpenGL standard defines the origin in the bottom left corner which is why this is upside-down by default.