summaryrefslogtreecommitdiffstats
path: root/jwxyz/jwxyz.m
diff options
context:
space:
mode:
authorSimon Rettberg2021-04-06 14:43:39 +0200
committerSimon Rettberg2021-04-07 13:38:37 +0200
commit38886de0c3e9ea5729ef23e4c653fa2822f52e8f (patch)
tree9b799c8c968a92cc77746a95e0e8bdd90b6b13c3 /jwxyz/jwxyz.m
parentMaybe not remove, but ... (diff)
downloadxscreensaver-openslx.tar.gz
xscreensaver-openslx.tar.xz
xscreensaver-openslx.zip
xscreensaver 6.00v28r1openslx
Diffstat (limited to 'jwxyz/jwxyz.m')
-rw-r--r--jwxyz/jwxyz.m42
1 files changed, 20 insertions, 22 deletions
diff --git a/jwxyz/jwxyz.m b/jwxyz/jwxyz.m
index c6a7af5..d25d580 100644
--- a/jwxyz/jwxyz.m
+++ b/jwxyz/jwxyz.m
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1991-2019 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1991-2020 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -11,13 +11,11 @@
/* JWXYZ Is Not Xlib.
- But it's a bunch of function definitions that bear some resemblance to
- Xlib and that do Cocoa-ish things that bear some resemblance to the
- things that Xlib might have done.
+ This file implements Xlib in terms of Quartz / Core Graphics rendering
+ for macOS and iOS.
- This is the original version of jwxyz for MacOS and iOS.
- The version used by Android is in jwxyz-gl.c and jwxyz-common.c.
- Both versions depend on jwxyz-cocoa.m.
+ See the comment at the top of jwxyz-common.c for an explanation of
+ the division of labor between these various modules.
*/
#ifdef JWXYZ_QUARTZ // entire file
@@ -26,7 +24,7 @@
#import <stdint.h>
#import <wchar.h>
-#ifdef USE_IPHONE
+#ifdef HAVE_IPHONE
# import <UIKit/UIKit.h>
# import <UIKit/UIScreen.h>
# import <QuartzCore/QuartzCore.h>
@@ -66,7 +64,7 @@ struct jwxyz_Display {
Visual visual;
struct jwxyz_sources_data *timers_data;
-# ifndef USE_IPHONE
+# ifndef HAVE_IPHONE
CGDirectDisplayID cgdpy; /* ...of the one and only Window, main_window.
This can change if the window is dragged to
a different screen. */
@@ -399,7 +397,7 @@ jwxyz_window_resized (Display *dpy)
{
Window w = dpy->main_window;
-# ifndef USE_IPHONE
+# ifndef HAVE_IPHONE
// Figure out which screen the window is currently on.
{
int wx, wy;
@@ -417,7 +415,7 @@ jwxyz_window_resized (Display *dpy)
}
Assert (dpy->cgdpy, "unable to find CGDisplay");
}
-# endif // USE_IPHONE
+# endif // HAVE_IPHONE
/*
{
@@ -1394,9 +1392,9 @@ jwxyz_draw_NSImage_or_CGImage (Display *dpy, Drawable d,
XRectangle *geom_ret, int exif_rotation)
{
CGImageRef cgi;
-# ifndef USE_IPHONE
+# ifndef HAVE_IPHONE
CGImageSourceRef cgsrc;
-# endif // USE_IPHONE
+# endif // HAVE_IPHONE
NSSize imgr;
CGContextRef cgc = d->cgc;
@@ -1406,7 +1404,7 @@ jwxyz_draw_NSImage_or_CGImage (Display *dpy, Drawable d,
NSImage *nsimg = (NSImage *) img_arg;
imgr = [nsimg size];
-# ifndef USE_IPHONE
+# ifndef HAVE_IPHONE
// convert the NSImage to a CGImage via the toll-free-bridging
// of NSData and CFData...
//
@@ -1416,9 +1414,9 @@ jwxyz_draw_NSImage_or_CGImage (Display *dpy, Drawable d,
CFDataRef cfdata = (CFDataRef) nsdata;
cgsrc = CGImageSourceCreateWithData (cfdata, NULL);
cgi = CGImageSourceCreateImageAtIndex (cgsrc, 0, NULL);
-# else // USE_IPHONE
+# else // HAVE_IPHONE
cgi = nsimg.CGImage;
-# endif // USE_IPHONE
+# endif // HAVE_IPHONE
} else {
cgi = (CGImageRef) img_arg;
@@ -1481,12 +1479,12 @@ jwxyz_draw_NSImage_or_CGImage (Display *dpy, Drawable d,
CGContextDrawImage (cgc, dst2, cgi);
CGContextRestoreGState (cgc);
-# ifndef USE_IPHONE
+# ifndef HAVE_IPHONE
if (nsimg_p) {
CFRelease (cgsrc);
CGImageRelease (cgi);
}
-# endif // USE_IPHONE
+# endif // HAVE_IPHONE
if (geom_ret) {
geom_ret->x = dst.origin.x;
@@ -1507,7 +1505,7 @@ jwxyz_png_to_ximage (Display *dpy, Visual *visual,
[NSData dataWithBytes:png_data
length:data_size]];
if (! img) return 0;
-#ifndef USE_IPHONE
+#ifndef HAVE_IPHONE
NSBitmapImageRep *bm = [NSBitmapImageRep
imageRepWithData:
[NSBitmapImageRep
@@ -1525,7 +1523,7 @@ jwxyz_png_to_ximage (Display *dpy, Visual *visual,
convert_mode_t mode = (([bm bitmapFormat] & NSAlphaFirstBitmapFormat)
? CONVERT_MODE_ROTATE_MASK
: 0);
-#else // USE_IPHONE
+#else // HAVE_IPHONE
CGImageRef cgi = [img CGImage];
if (!cgi) {
[img release];
@@ -1547,7 +1545,7 @@ jwxyz_png_to_ximage (Display *dpy, Visual *visual,
convert_mode_t mode = convert_mode_to_rgba (bitmap_info);
-#endif // USE_IPHONE
+#endif // HAVE_IPHONE
XImage *image = XCreateImage (dpy, visual, 32, ZPixmap, 0, 0,
width, height, 8, 0);
@@ -1567,7 +1565,7 @@ jwxyz_png_to_ximage (Display *dpy, Visual *visual,
[img release];
-#ifndef USE_IPHONE
+#ifndef HAVE_IPHONE
// [bm release];
# else
CGContextRelease (cgc);