From 7cb34e70da5d0ed1ce90c8cc7b847930a0d3afee Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 08:07:15 +0000 Subject: [PATCH] fix(capture): render right-to-left windows as they are, without a second mirror The Arabic Uploader captures came out mirrored with reversed glyphs: a right-to-left window's content already renders mirrored, so drawing it through another flip undid the layout. Flipping that capture back gives the screen. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- src/Titano.Setup/Views/SetupCapture.cs | 17 ++--------------- src/Titano.Uploader/Shell/ScreenCapture.cs | 17 ++--------------- 2 files changed, 4 insertions(+), 30 deletions(-) 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; - } }