comparison src/video/x11/SDL_x11render.c @ 4600:8b22d33d8260

Remove experimental cruft.
author Sunny Sachanandani <sunnysachanandani@gmail.com>
date Sun, 18 Jul 2010 18:45:30 +0530
parents 66e13a224bd6
children 4fbf64d504cf
comparison
equal deleted inserted replaced
4598:66e13a224bd6 4600:8b22d33d8260
28 28
29 #include "SDL_x11video.h" 29 #include "SDL_x11video.h"
30 #include "../SDL_rect_c.h" 30 #include "../SDL_rect_c.h"
31 #include "../SDL_pixels_c.h" 31 #include "../SDL_pixels_c.h"
32 #include "../SDL_yuv_sw_c.h" 32 #include "../SDL_yuv_sw_c.h"
33 #include "SDL_surface.h"
34
35 //#define EXPT
36 33
37 /* X11 renderer implementation */ 34 /* X11 renderer implementation */
38 35
39 static SDL_Renderer *X11_CreateRenderer(SDL_Window * window, Uint32 flags); 36 static SDL_Renderer *X11_CreateRenderer(SDL_Window * window, Uint32 flags);
40 static int X11_DisplayModeChanged(SDL_Renderer * renderer); 37 static int X11_DisplayModeChanged(SDL_Renderer * renderer);
101 Pixmap pixmaps[3]; 98 Pixmap pixmaps[3];
102 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 99 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
103 Pixmap stencil; 100 Pixmap stencil;
104 Pixmap brush; 101 Pixmap brush;
105 Picture brush_pict; 102 Picture brush_pict;
106 #ifndef NO_SHARED_MEMORY
107 #ifdef EXPT
108 XImage *stencil_image;
109 SDL_Surface *stencil_surface;
110 XShmSegmentInfo stencil_shminfo;
111 #endif
112 #endif
113 Picture xwindow_pict; 103 Picture xwindow_pict;
114 Picture pixmap_picts[3]; 104 Picture pixmap_picts[3];
115 Picture drawable_pict; 105 Picture drawable_pict;
116 Picture stencil_pict; 106 Picture stencil_pict;
117 int blend_op; 107 int blend_op;
318 data->brush_pict = 308 data->brush_pict =
319 XRenderCreatePicture(data->display, data->brush, 309 XRenderCreatePicture(data->display, data->brush,
320 XRenderFindStandardFormat(data->display, 310 XRenderFindStandardFormat(data->display,
321 PictStandardARGB32), 311 PictStandardARGB32),
322 CPRepeat, &brush_attr); 312 CPRepeat, &brush_attr);
323 #ifndef NO_SHARED_MEMORY
324 #ifdef EXPT
325 /* Create a mask image using MIT-SHM */
326 data->stencil_image = NULL;
327 data->stencil_surface = NULL;
328 XShmSegmentInfo *shminfo = &data->stencil_shminfo;
329 while (SDL_X11_HAVE_SHM) {
330 data->stencil_image =
331 XShmCreateImage(data->display, data->visual, 8, ZPixmap,
332 NULL, shminfo, window->w, window->h);
333 shminfo->shmid = shmget(IPC_PRIVATE,
334 data->stencil_image->bytes_per_line *
335 data->stencil_image->height,
336 IPC_CREAT|0777);
337 shminfo->shmaddr = data->stencil_image->data = shmat(shminfo->shmid, 0, 0);
338 shminfo->readOnly = False;
339 XShmAttach(data->display, shminfo);
340 XSync(data->display, False);
341 shmctl(shminfo->shmid, IPC_RMID, NULL);
342 data->stencil_surface =
343 SDL_CreateRGBSurfaceFrom(shminfo->shmaddr,
344 data->stencil_image->width,
345 data->stencil_image->height,
346 8,
347 data->stencil_image->bytes_per_line,
348 0, 0, 0, 0xFF);
349 break;
350 }
351 #endif
352 #endif
353 // Set the default blending mode. 313 // Set the default blending mode.
354 renderer->blendMode = SDL_BLENDMODE_BLEND; 314 renderer->blendMode = SDL_BLENDMODE_BLEND;
355 data->blend_op = PictOpOver; 315 data->blend_op = PictOpOver;
356 } 316 }
357 #endif 317 #endif
1057 /* Nothing to draw */ 1017 /* Nothing to draw */
1058 return 0; 1018 return 0;
1059 } 1019 }
1060 SDL_AddDirtyRect(&data->dirty, &rect); 1020 SDL_AddDirtyRect(&data->dirty, &rect);
1061 } 1021 }
1062 /*
1063 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
1064 #ifndef NO_SHARED_MEMORY
1065 #ifdef EXPT
1066 if (data->use_xrender && data->stencil_image && data->stencil_surface) {
1067 SDL_FillRect(data->stencil_surface, &rect, 0x00);
1068
1069 SDL_SetClipRect(data->stencil_surface, NULL);
1070
1071 SDL_DrawPoints(data->stencil_surface, points, count, 0xFF);
1072
1073 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image,
1074 rect.x, rect.y, rect.x, rect.y, rect.w, rect.h, False);
1075
1076 XSync(data->display, False);
1077 } else
1078 #endif
1079 #endif
1080 #endif
1081 */
1082 { 1022 {
1083 xpoint = xpoints = SDL_stack_alloc(XPoint, count); 1023 xpoint = xpoints = SDL_stack_alloc(XPoint, count);
1084 xcount = 0; 1024 xcount = 0;
1085 for (i = 0; i < count; ++i) { 1025 for (i = 0; i < count; ++i) {
1086 int x = points[i].x; 1026 int x = points[i].x;
1150 1090
1151 clip.x = 0; 1091 clip.x = 0;
1152 clip.y = 0; 1092 clip.y = 0;
1153 clip.w = window->w; 1093 clip.w = window->w;
1154 clip.h = window->h; 1094 clip.h = window->h;
1155 /*
1156 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
1157 #ifndef NO_SHARED_MEMORY
1158 #ifdef EXPT
1159 if (data->use_xrender && data->stencil_image && data->stencil_surface) {
1160 SDL_FillRect(data->stencil_surface, NULL, 0x00);
1161
1162 SDL_DrawLines(data->stencil_surface, points, count, 0xFF);
1163
1164 SDL_SetClipRect(data->stencil_surface, NULL);
1165
1166 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image,
1167 0, 0, 0, 0, window->w, window->h, False);
1168
1169 XSync(data->display, False);
1170 } else
1171 #endif
1172 #endif
1173 #endif
1174 */
1175 { 1095 {
1176 Pixmap drawable; 1096 Pixmap drawable;
1177 GC gc; 1097 GC gc;
1178 /* 1098 /*
1179 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 1099 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
1340 1260
1341 clip.x = 0; 1261 clip.x = 0;
1342 clip.y = 0; 1262 clip.y = 0;
1343 clip.w = window->w; 1263 clip.w = window->w;
1344 clip.h = window->h; 1264 clip.h = window->h;
1345 /*
1346 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
1347 #ifndef NO_SHARED_MEMORY
1348 #ifdef EXPT
1349 if (data->use_xrender && data->stencil_image && data->stencil_surface) {
1350 SDL_FillRect(data->stencil_surface, NULL, 0x00);
1351
1352 SDL_SetClipRect(data->stencil_surface, NULL);
1353
1354 SDL_DrawRects(data->stencil_surface, rects, count, 1);
1355
1356 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image,
1357 0, 0, 0, 0, window->w, window->h, False);
1358
1359 XSync(data->display, False);
1360 }
1361 else
1362 #endif
1363 #endif
1364 #endif
1365 */
1366 { 1265 {
1367 1266
1368 for (i = 0; i < count; ++i) { 1267 for (i = 0; i < count; ++i) {
1369 if (!SDL_IntersectRect(rects[i], &clip, &rect)) { 1268 if (!SDL_IntersectRect(rects[i], &clip, &rect)) {
1370 continue; 1269 continue;