diff --git a/src/Titano.Setup/Views/SetupCapture.cs b/src/Titano.Setup/Views/SetupCapture.cs index 1212b8e9..f25307c1 100644 --- a/src/Titano.Setup/Views/SetupCapture.cs +++ b/src/Titano.Setup/Views/SetupCapture.cs @@ -173,24 +173,11 @@ internal static class SetupCapture var height = (int)Math.Ceiling(root.ActualHeight * dpi.DpiScaleY); if (width <= 0 || height <= 0) return; var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32); - bitmap.Render(window.FlowDirection == FlowDirection.RightToLeft ? Mirrored(root) : root); + // A right-to-left window's content already renders mirrored, as on screen. + bitmap.Render(root); var encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bitmap)); using var stream = File.Create(path); encoder.Save(stream); } - - /// - /// A right-to-left window is mirrored by a transform on the window itself, which rendering its content alone - /// would leave out: draw the content through that mirror. - /// - private static DrawingVisual Mirrored(FrameworkElement root) - { - var size = new Rect(0, 0, root.ActualWidth, root.ActualHeight); - var visual = new DrawingVisual(); - using var dc = visual.RenderOpen(); - dc.PushTransform(new MatrixTransform(-1, 0, 0, 1, size.Width, 0)); - dc.DrawRectangle(new VisualBrush(root) { Stretch = Stretch.Fill, ViewboxUnits = BrushMappingMode.Absolute, Viewbox = size }, null, size); - return visual; - } } diff --git a/src/Titano.Uploader/Shell/ScreenCapture.cs b/src/Titano.Uploader/Shell/ScreenCapture.cs index 010d3a9f..9cfc8df9 100644 --- a/src/Titano.Uploader/Shell/ScreenCapture.cs +++ b/src/Titano.Uploader/Shell/ScreenCapture.cs @@ -98,24 +98,11 @@ public static class ScreenCapture var height = (int)Math.Ceiling(root.ActualHeight * dpi.DpiScaleY); if (width <= 0 || height <= 0) return; var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32); - bitmap.Render(window.FlowDirection == FlowDirection.RightToLeft ? Mirrored(root) : root); + // A right-to-left window's content already renders mirrored, as on screen. + bitmap.Render(root); var encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bitmap)); using var stream = File.Create(path); encoder.Save(stream); } - - /// - /// A right-to-left window is mirrored by a transform on the window itself, which rendering its content alone - /// would leave out (mirrored glyphs, left-to-right layout): draw the content through that mirror. - /// - private static DrawingVisual Mirrored(FrameworkElement root) - { - var size = new Rect(0, 0, root.ActualWidth, root.ActualHeight); - var visual = new DrawingVisual(); - using var dc = visual.RenderOpen(); - dc.PushTransform(new MatrixTransform(-1, 0, 0, 1, size.Width, 0)); - dc.DrawRectangle(new VisualBrush(root) { Stretch = Stretch.Fill, ViewboxUnits = BrushMappingMode.Absolute, Viewbox = size }, null, size); - return visual; - } }