comparison src/video/x11/SDL_x11modes.c @ 4590:1ad70fb49fcb

Fix so many things that there is little place in this column to list them all but the result is that blending modes just work now for drawing primitives. Fixes involved: 1. Fix handling of alpha channel when SDL_BLENDMODE_NONE is set. 2. Make xrendercolor use floating-point values for color channels and then convert to 16 bit ints. 3. Fix handling of visuals in SDL_x11modes.c so that a 32 bit ARGB visual is used. 4. Fix the background pixel value in SDL_x11window.c so that the window background has an alpha value of 0xFF and not 0.
author Sunny Sachanandani <sunnysachanandani@gmail.com>
date Fri, 09 Jul 2010 21:36:41 +0530
parents f7b03b6838cb
children 1e998db9b597
comparison
equal deleted inserted replaced
4589:8d8a889530eb 4590:1ad70fb49fcb
21 */ 21 */
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 #include "SDL_x11video.h" 24 #include "SDL_x11video.h"
25 25
26 //#define X11MODES_DEBUG 26 #define X11MODES_DEBUG
27 #undef SDL_VIDEO_DRIVER_X11_XINERAMA 27 #undef SDL_VIDEO_DRIVER_X11_XINERAMA
28 #undef SDL_VIDEO_DRIVER_X11_XRANDR 28 #undef SDL_VIDEO_DRIVER_X11_XRANDR
29 #undef SDL_VIDEO_DRIVER_X11_VIDMODE 29 #undef SDL_VIDEO_DRIVER_X11_VIDMODE
30 30
31 static int 31 static int
32 get_visualinfo(Display * display, int screen, XVisualInfo * vinfo) 32 get_visualinfo(Display * display, int screen, XVisualInfo * vinfo)
33 { 33 {
34 const char *visual_id = SDL_getenv("SDL_VIDEO_X11_VISUALID"); 34 const char *visual_id = SDL_getenv("SDL_VIDEO_X11_VISUALID");
35 int depth; 35 int depth;
36 XVisualInfo *vi;
37 int nvis;
36 38
37 /* Look for an exact visual, if requested */ 39 /* Look for an exact visual, if requested */
38 if (visual_id) { 40 if (visual_id) {
39 XVisualInfo *vi, template; 41 XVisualInfo template;
40 int nvis;
41 42
42 SDL_zero(template); 43 SDL_zero(template);
43 template.visualid = SDL_strtol(visual_id, NULL, 0); 44 template.visualid = SDL_strtol(visual_id, NULL, 0);
44 vi = XGetVisualInfo(display, VisualIDMask, &template, &nvis); 45 vi = XGetVisualInfo(display, VisualIDMask, &template, &nvis);
45 if (vi) { 46 if (vi) {
46 *vinfo = *vi; 47 *vinfo = *vi;
47 XFree(vi); 48 XFree(vi);
48 return 0; 49 return 0;
49 } 50 }
50 } 51 }
51 52 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
53 depth = 32;
54 long vinfo_mask;
55 XVisualInfo vinfo_templ;
56 vinfo_mask = (VisualDepthMask | VisualRedMaskMask | VisualGreenMaskMask | VisualBlueMaskMask);
57 vinfo_templ.depth = 32;
58 vinfo_templ.red_mask = 0xFF0000;
59 vinfo_templ.green_mask = 0xFF00;
60 vinfo_templ.blue_mask = 0xFF;
61 vi = XGetVisualInfo(display, vinfo_mask, &vinfo_templ, &nvis);
62 if(vi) {
63 *vinfo = *vi;
64 XFree(vi);
65 return 0;
66 }
67 #endif
52 depth = DefaultDepth(display, screen); 68 depth = DefaultDepth(display, screen);
53 if ((X11_UseDirectColorVisuals() && 69 if ((X11_UseDirectColorVisuals() &&
54 XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) || 70 XMatchVisualInfo(display, screen, depth, DirectColor, vinfo)) ||
55 XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) || 71 XMatchVisualInfo(display, screen, depth, TrueColor, vinfo) ||
56 XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) || 72 XMatchVisualInfo(display, screen, depth, PseudoColor, vinfo) ||