X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=jwxyz%2FjwxyzI.h;h=f82d6148a857a816bf688cbbc7fe4656cddd1bb4;hp=61b654f37eee6a8b0857984599664f0ad4ab97aa;hb=4361b69d3178d7fc98d0388f9a223af6c2651aba;hpb=d6b0217f2417bd19187f0ebc389d6c5c2233b11c diff --git a/jwxyz/jwxyzI.h b/jwxyz/jwxyzI.h index 61b654f3..f82d6148 100644 --- a/jwxyz/jwxyzI.h +++ b/jwxyz/jwxyzI.h @@ -18,7 +18,20 @@ #define Assert(C, ...) do { if (!(C)) jwxyz_abort (__VA_ARGS__); } while(0) -/* OSX/jwxyz.m, utils/jwxyz-gl.c */ +#undef MAX +#undef MIN +#define MAX(a,b) ((a)>(b)?(a):(b)) +#define MIN(a,b) ((a)<(b)?(a):(b)) + +#define JWXYZ_FONT_FAMILY 0 /* i.e. -[NSFont familyName] via XLFD */ +#define JWXYZ_FONT_FACE 1 /* -[NSFont fontName] via native */ +#define JWXYZ_FONT_RANDOM 2 + +#define JWXYZ_STYLE_BOLD 1 +#define JWXYZ_STYLE_ITALIC 2 +#define JWXYZ_STYLE_MONOSPACE 4 + +/* jwxyz.m, jwxyz-gl.c */ extern Display *jwxyz_make_display (Window w); extern void jwxyz_free_display (Display *); extern void jwxyz_window_resized (Display *); @@ -36,10 +49,30 @@ extern void jwxyz_fill_rects (Display *dpy, Drawable d, GC gc, unsigned long pixel); extern XGCValues *jwxyz_gc_gcv (GC gc); extern unsigned int jwxyz_gc_depth (GC gc); +extern int jwxyz_draw_string (Display *dpy, Drawable d, GC gc, int x, int y, + const char *str, size_t len, Bool utf8); -/* OSX/jwxyz-cocoa.m, android/jwxyz-android.c */ +/* jwxyz-cocoa.m, jwxyz-android.c */ extern const XRectangle *jwxyz_frame (Drawable d); /* XGetGeometry sux. */ extern unsigned int jwxyz_drawable_depth (Drawable d); + +/* 'scale' is pixels per point, with 72 points per inch. This matches the + meaning of -[UIView contentScaleFactor] on iOS. + */ +extern float jwxyz_scale (Window main_window); + +extern const char *jwxyz_default_font_family (int require); +extern void *jwxyz_load_native_font (Window main_window, + int traits_jwxyz, int mask_jwxyz, + const char *font_name_ptr, + size_t font_name_length, + int font_name_type, float size, + char **family_name_ret, + int *ascent_ret, int *descent_ret); +extern void jwxyz_release_native_font (Display *, void *native_font); +extern void jwxyz_render_text (Display *, void *native_font, + const char *str, size_t len, int utf8_p, + XCharStruct *cs_ret, char **pixmap_ret); extern void jwxyz_get_pos (Window w, XPoint *vpos, XPoint *p); extern void jwxyz_copy_area (Display *dpy, Drawable src, Drawable dst, GC gc, int src_x, int src_y, @@ -50,7 +83,7 @@ extern double current_device_rotation (void); extern Bool ignore_rotation_p (Display *); #endif -/* utils/jwxyz-common.c */ +/* jwxyz-common.c */ extern void jwxyz_validate_pixel (Display *dpy, unsigned long pixel, unsigned int depth, Bool alpha_allowed_p); extern Bool jwxyz_dumb_drawing_mode(Display *dpy, Drawable d, GC gc, @@ -61,6 +94,7 @@ extern void jwxyz_fill_rect (Display *, Drawable, GC, unsigned int width, unsigned int height, unsigned long pixel); extern void jwxyz_gcv_defaults (Display *dpy, XGCValues *gcv, int depth); +extern void *jwxyz_native_font (Font f); # if defined JWXYZ_QUARTZ @@ -90,6 +124,16 @@ extern CGPoint map_point (Drawable d, int x, int y); # elif defined JWXYZ_GL +# if defined(USE_IPHONE) +# include +# elif defined(HAVE_COCOA) +# include +# elif defined(HAVE_ANDROID) +# include +# else +# include +# endif + /* utils/jwxyz-gl.c */ extern void jwxyz_prepare_context (Display *dpy); extern void jwxyz_set_matrices (Display *dpy, unsigned width, unsigned height, @@ -100,12 +144,22 @@ extern void jwxyz_set_matrices (Display *dpy, unsigned width, unsigned height, also work with FBOs and one context for everything. Surprisingly slow and unreliable. */ -extern void jwxyz_gl_copy_area_copy_tex_image (Display *dpy, Drawable src, - Drawable dst, GC gc, +extern void jwxyz_gl_copy_area_read_tex_image (Display *dpy, + unsigned src_height, int src_x, int src_y, unsigned int width, unsigned int height, int dst_x, int dst_y); +extern void jwxyz_gl_copy_area_write_tex_image (Display *dpy, GC gc, + int src_x, int src_y, + unsigned int width, + unsigned int height, + int dst_x, int dst_y); +extern void jwxyz_gl_draw_image (GLenum target, + unsigned int tex_w, unsigned int tex_h, + int src_x, int src_y, + unsigned int width, unsigned int height, + int dst_x, int dst_y); /* glReadPixels followed by glTexImage2D. This is terrible, so only use this if nothing else works. @@ -123,14 +177,6 @@ extern void jwxyz_assert_display (Display *); extern void jwxyz_assert_drawable (Window main_window, Drawable d); extern void jwxyz_assert_gl (void); -extern void *jwxyz_load_native_font (Display *, const char *name, - char **native_name_ret, float *size_ret, - int *ascent_ret, int *descent_ret); -extern void jwxyz_release_native_font (Display *, void *native_font); -extern void jwxyz_render_text (Display *, void *native_font, - const char *str, size_t len, int utf8_p, - XCharStruct *cs_ret, char **pixmap_ret); - # endif /* JWXYZ_GL */ #endif