[gtk/wip/chergert/use-fabs-in-macos] macos: fix scale on macOS 12 beta




commit e3ef21f77033a7a92d63e55c3dc7c987faa4fcf0
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 14 14:46:30 2021 -0700

    macos: fix scale on macOS 12 beta
    
    This is a port of the fix in the quartz backend to the new macOS backend.
    
    From the original commit:
    
    In macOS-12.sdk CGContextConverSizeToDeviceSpace returns a negative
    height and passing that to CGContextScaleCTM in turn causes the cairo
    surface to draw outside the window where it can't be seen. Passing the
    absolute values of the scale factors fixes the display on macOS 12 without
    affecting earlier macOS versions.

 gdk/macos/gdkmacossurface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index f94eaa2eca..60f6fe2389 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -809,7 +809,7 @@ _gdk_macos_surface_acquire_context (GdkMacosSurface *self,
       scale = CGSizeMake (1.0, 1.0);
       scale = CGContextConvertSizeToDeviceSpace (cg_context, scale);
 
-      CGContextScaleCTM (cg_context, 1.0 / scale.width, 1.0 / scale.height);
+      CGContextScaleCTM (cg_context, 1.0 / fabs (scale.width), 1.0 / fabs (scale.height));
     }
 
   return cg_context;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]