Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11render.c @ 4598:66e13a224bd6
Major changes to drawing. Reverted back to core X11 functions due to regressions.
author | Sunny Sachanandani <sunnysachanandani@gmail.com> |
---|---|
date | Sun, 18 Jul 2010 18:27:38 +0530 |
parents | 95be206b3cb7 |
children | ce0643707bb0 8b22d33d8260 |
comparison
equal
deleted
inserted
replaced
4597:95be206b3cb7 | 4598:66e13a224bd6 |
---|---|
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" | 33 #include "SDL_surface.h" |
34 | |
35 //#define EXPT | |
34 | 36 |
35 /* X11 renderer implementation */ | 37 /* X11 renderer implementation */ |
36 | 38 |
37 static SDL_Renderer *X11_CreateRenderer(SDL_Window * window, Uint32 flags); | 39 static SDL_Renderer *X11_CreateRenderer(SDL_Window * window, Uint32 flags); |
38 static int X11_DisplayModeChanged(SDL_Renderer * renderer); | 40 static int X11_DisplayModeChanged(SDL_Renderer * renderer); |
100 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 102 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
101 Pixmap stencil; | 103 Pixmap stencil; |
102 Pixmap brush; | 104 Pixmap brush; |
103 Picture brush_pict; | 105 Picture brush_pict; |
104 #ifndef NO_SHARED_MEMORY | 106 #ifndef NO_SHARED_MEMORY |
107 #ifdef EXPT | |
105 XImage *stencil_image; | 108 XImage *stencil_image; |
106 SDL_Surface *stencil_surface; | 109 SDL_Surface *stencil_surface; |
107 XShmSegmentInfo stencil_shminfo; | 110 XShmSegmentInfo stencil_shminfo; |
111 #endif | |
108 #endif | 112 #endif |
109 Picture xwindow_pict; | 113 Picture xwindow_pict; |
110 Picture pixmap_picts[3]; | 114 Picture pixmap_picts[3]; |
111 Picture drawable_pict; | 115 Picture drawable_pict; |
112 Picture stencil_pict; | 116 Picture stencil_pict; |
133 GC gc; | 137 GC gc; |
134 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 138 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
135 Picture picture; | 139 Picture picture; |
136 XRenderPictFormat* picture_fmt; | 140 XRenderPictFormat* picture_fmt; |
137 int blend_op; | 141 int blend_op; |
138 // SDL_bool use_xrender; | |
139 #endif | 142 #endif |
140 XImage *image; | 143 XImage *image; |
141 #ifndef NO_SHARED_MEMORY | 144 #ifndef NO_SHARED_MEMORY |
142 /* MIT shared memory extension information */ | 145 /* MIT shared memory extension information */ |
143 XShmSegmentInfo shminfo; | 146 XShmSegmentInfo shminfo; |
316 XRenderCreatePicture(data->display, data->brush, | 319 XRenderCreatePicture(data->display, data->brush, |
317 XRenderFindStandardFormat(data->display, | 320 XRenderFindStandardFormat(data->display, |
318 PictStandardARGB32), | 321 PictStandardARGB32), |
319 CPRepeat, &brush_attr); | 322 CPRepeat, &brush_attr); |
320 #ifndef NO_SHARED_MEMORY | 323 #ifndef NO_SHARED_MEMORY |
324 #ifdef EXPT | |
321 /* Create a mask image using MIT-SHM */ | 325 /* Create a mask image using MIT-SHM */ |
322 data->stencil_image = NULL; | 326 data->stencil_image = NULL; |
323 data->stencil_surface = NULL; | 327 data->stencil_surface = NULL; |
324 XShmSegmentInfo *shminfo = &data->stencil_shminfo; | 328 XShmSegmentInfo *shminfo = &data->stencil_shminfo; |
325 while (SDL_X11_HAVE_SHM) { | 329 while (SDL_X11_HAVE_SHM) { |
326 data->stencil_image = | 330 data->stencil_image = |
327 XShmCreateImage(data->display, data->visual, 8, ZPixmap, | 331 XShmCreateImage(data->display, data->visual, 8, ZPixmap, |
328 NULL, shminfo, window->w, window->h); | 332 NULL, shminfo, window->w, window->h); |
329 if (!data->stencil_image) { | |
330 printf("XShmCreateImage() failed"); | |
331 break; | |
332 } else { | |
333 printf("image created\n"); | |
334 } | |
335 shminfo->shmid = shmget(IPC_PRIVATE, | 333 shminfo->shmid = shmget(IPC_PRIVATE, |
336 data->stencil_image->bytes_per_line * | 334 data->stencil_image->bytes_per_line * |
337 data->stencil_image->height, | 335 data->stencil_image->height, |
338 IPC_CREAT|0777); | 336 IPC_CREAT|0777); |
339 if (!shminfo->shmid) { | |
340 printf("shmget() failed"); | |
341 break; | |
342 } else { | |
343 printf("shmid aquired\n"); | |
344 } | |
345 shminfo->shmaddr = data->stencil_image->data = shmat(shminfo->shmid, 0, 0); | 337 shminfo->shmaddr = data->stencil_image->data = shmat(shminfo->shmid, 0, 0); |
346 shminfo->readOnly = False; | 338 shminfo->readOnly = False; |
347 XShmAttach(data->display, shminfo); | 339 XShmAttach(data->display, shminfo); |
348 XSync(data->display, False); | 340 XSync(data->display, False); |
349 shmctl(shminfo->shmid, IPC_RMID, NULL); | 341 shmctl(shminfo->shmid, IPC_RMID, NULL); |
352 data->stencil_image->width, | 344 data->stencil_image->width, |
353 data->stencil_image->height, | 345 data->stencil_image->height, |
354 8, | 346 8, |
355 data->stencil_image->bytes_per_line, | 347 data->stencil_image->bytes_per_line, |
356 0, 0, 0, 0xFF); | 348 0, 0, 0, 0xFF); |
357 if (!data->stencil_surface) { | |
358 printf("SDL_CreateRGBSurfaceFrom() failed"); | |
359 break; | |
360 } else { | |
361 printf("surface created\n"); | |
362 } | |
363 break; | 349 break; |
364 } | 350 } |
351 #endif | |
365 #endif | 352 #endif |
366 // Set the default blending mode. | 353 // Set the default blending mode. |
367 renderer->blendMode = SDL_BLENDMODE_BLEND; | 354 renderer->blendMode = SDL_BLENDMODE_BLEND; |
368 data->blend_op = PictOpOver; | 355 data->blend_op = PictOpOver; |
369 } | 356 } |
459 SDL_InitFormat(&data->format, bpp, Rmask, Gmask, Bmask, Amask); | 446 SDL_InitFormat(&data->format, bpp, Rmask, Gmask, Bmask, Amask); |
460 | 447 |
461 /* Create the drawing context */ | 448 /* Create the drawing context */ |
462 gcv.graphics_exposures = False; | 449 gcv.graphics_exposures = False; |
463 data->gc = | 450 data->gc = |
464 XCreateGC(data->display, data->xwindow, GCGraphicsExposures, &gcv); | 451 XCreateGC(data->display, data->drawable, GCGraphicsExposures, &gcv); |
465 if (!data->gc) { | 452 if (!data->gc) { |
466 X11_DestroyRenderer(renderer); | 453 X11_DestroyRenderer(renderer); |
467 SDL_SetError("XCreateGC() failed"); | 454 SDL_SetError("XCreateGC() failed"); |
468 return NULL; | 455 return NULL; |
469 } | 456 } |
1057 | 1044 |
1058 clip.x = 0; | 1045 clip.x = 0; |
1059 clip.y = 0; | 1046 clip.y = 0; |
1060 clip.w = window->w; | 1047 clip.w = window->w; |
1061 clip.h = window->h; | 1048 clip.h = window->h; |
1062 | 1049 if (data->makedirty) { |
1050 | |
1051 /* Get the smallest rectangle that contains everything */ | |
1052 rect.x = 0; | |
1053 rect.y = 0; | |
1054 rect.w = window->w; | |
1055 rect.h = window->h; | |
1056 if (!SDL_EnclosePoints(points, count, &rect, &rect)) { | |
1057 /* Nothing to draw */ | |
1058 return 0; | |
1059 } | |
1060 SDL_AddDirtyRect(&data->dirty, &rect); | |
1061 } | |
1062 /* | |
1063 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1063 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1064 #ifndef NO_SHARED_MEMORY | 1064 #ifndef NO_SHARED_MEMORY |
1065 #ifdef EXPT | |
1065 if (data->use_xrender && data->stencil_image && data->stencil_surface) { | 1066 if (data->use_xrender && data->stencil_image && data->stencil_surface) { |
1066 SDL_FillRect(data->stencil_surface, NULL, 0x00); | 1067 SDL_FillRect(data->stencil_surface, &rect, 0x00); |
1067 | 1068 |
1068 SDL_SetClipRect(data->stencil_surface, NULL); | 1069 SDL_SetClipRect(data->stencil_surface, NULL); |
1070 | |
1069 SDL_DrawPoints(data->stencil_surface, points, count, 0xFF); | 1071 SDL_DrawPoints(data->stencil_surface, points, count, 0xFF); |
1070 | 1072 |
1071 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image, | 1073 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image, |
1072 0, 0, 0, 0, window->w, window->h, False); | 1074 rect.x, rect.y, rect.x, rect.y, rect.w, rect.h, False); |
1075 | |
1076 XSync(data->display, False); | |
1073 } else | 1077 } else |
1074 #endif | 1078 #endif |
1075 #endif | 1079 #endif |
1080 #endif | |
1081 */ | |
1076 { | 1082 { |
1077 if (data->makedirty) { | |
1078 | |
1079 /* Get the smallest rectangle that contains everything */ | |
1080 rect.x = 0; | |
1081 rect.y = 0; | |
1082 rect.w = window->w; | |
1083 rect.h = window->h; | |
1084 if (!SDL_EnclosePoints(points, count, &rect, &rect)) { | |
1085 /* Nothing to draw */ | |
1086 return 0; | |
1087 } | |
1088 SDL_AddDirtyRect(&data->dirty, &rect); | |
1089 } | |
1090 | |
1091 xpoint = xpoints = SDL_stack_alloc(XPoint, count); | 1083 xpoint = xpoints = SDL_stack_alloc(XPoint, count); |
1092 xcount = 0; | 1084 xcount = 0; |
1093 for (i = 0; i < count; ++i) { | 1085 for (i = 0; i < count; ++i) { |
1094 int x = points[i].x; | 1086 int x = points[i].x; |
1095 int y = points[i].y; | 1087 int y = points[i].y; |
1099 xpoint->x = (short)x; | 1091 xpoint->x = (short)x; |
1100 xpoint->y = (short)y; | 1092 xpoint->y = (short)y; |
1101 ++xpoint; | 1093 ++xpoint; |
1102 ++xcount; | 1094 ++xcount; |
1103 } | 1095 } |
1096 /* | |
1104 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1097 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1105 if (data->use_xrender) { | 1098 if (data->use_xrender) { |
1106 XSetForeground(data->display, data->stencil_gc, 0x00); | 1099 XSetForeground(data->display, data->stencil_gc, 0x00); |
1107 XFillRectangle(data->display, data->stencil, data->stencil_gc, | 1100 XFillRectangle(data->display, data->stencil, data->stencil_gc, |
1108 0, 0, window->w, window->h); | 1101 rect.x, rect.y, rect.w, rect.h); |
1109 XSetForeground(data->display, data->stencil_gc, 0xFF); | 1102 XSetForeground(data->display, data->stencil_gc, 0xFF); |
1110 XDrawPoints(data->display, data->stencil, data->stencil_gc, xpoints, xcount, | 1103 XDrawPoints(data->display, data->stencil, data->stencil_gc, xpoints, xcount, |
1111 CoordModeOrigin); | 1104 CoordModeOrigin); |
1112 } | 1105 } |
1113 #endif | 1106 #endif*/ |
1114 } | 1107 } |
1108 /* | |
1115 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1109 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1116 if (data->use_xrender) { | 1110 if (data->use_xrender) { |
1117 XRenderColor foreground; | 1111 XRenderColor foreground; |
1118 foreground = xrenderdrawcolor(renderer); | 1112 foreground = xrenderdrawcolor(renderer); |
1119 XRenderFillRectangle(data->display, PictOpSrc, data->brush_pict, | 1113 XRenderFillRectangle(data->display, PictOpSrc, data->brush_pict, |
1120 &foreground, 0, 0, 1, 1); | 1114 &foreground, 0, 0, 1, 1); |
1121 XRenderComposite(data->display, data->blend_op, data->brush_pict, | 1115 XRenderComposite(data->display, data->blend_op, data->brush_pict, |
1122 data->stencil_pict, data->drawable_pict, | 1116 data->stencil_pict, data->drawable_pict, |
1123 0, 0, 0, 0, 0, 0, window->w, window->h); | 1117 rect.x, rect.y, rect.x, rect.y, rect.x, rect.y, rect.w, rect.h); |
1124 } | 1118 } |
1125 else | 1119 else |
1126 #endif | 1120 #endif |
1121 */ | |
1127 { | 1122 { |
1128 unsigned long foreground = renderdrawcolor(renderer, 1); | 1123 unsigned long foreground = renderdrawcolor(renderer, 1); |
1129 XSetForeground(data->display, data->gc, foreground); | 1124 XSetForeground(data->display, data->gc, foreground); |
1130 | 1125 |
1131 | 1126 |
1155 | 1150 |
1156 clip.x = 0; | 1151 clip.x = 0; |
1157 clip.y = 0; | 1152 clip.y = 0; |
1158 clip.w = window->w; | 1153 clip.w = window->w; |
1159 clip.h = window->h; | 1154 clip.h = window->h; |
1155 /* | |
1160 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1156 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1161 #ifndef NO_SHARED_MEMORY | 1157 #ifndef NO_SHARED_MEMORY |
1158 #ifdef EXPT | |
1162 if (data->use_xrender && data->stencil_image && data->stencil_surface) { | 1159 if (data->use_xrender && data->stencil_image && data->stencil_surface) { |
1163 SDL_FillRect(data->stencil_surface, NULL, 0x00); | 1160 SDL_FillRect(data->stencil_surface, NULL, 0x00); |
1164 | 1161 |
1162 SDL_DrawLines(data->stencil_surface, points, count, 0xFF); | |
1163 | |
1165 SDL_SetClipRect(data->stencil_surface, NULL); | 1164 SDL_SetClipRect(data->stencil_surface, NULL); |
1166 SDL_DrawLines(data->stencil_surface, points, count, 0xFF); | |
1167 | 1165 |
1168 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image, | 1166 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image, |
1169 0, 0, 0, 0, window->w, window->h, False); | 1167 0, 0, 0, 0, window->w, window->h, False); |
1168 | |
1169 XSync(data->display, False); | |
1170 } else | 1170 } else |
1171 #endif | 1171 #endif |
1172 #endif | 1172 #endif |
1173 #endif | |
1174 */ | |
1173 { | 1175 { |
1174 Pixmap drawable; | 1176 Pixmap drawable; |
1175 GC gc; | 1177 GC gc; |
1178 /* | |
1176 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1179 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1177 if (data->use_xrender) { | 1180 if (data->use_xrender) { |
1178 drawable = data->stencil; | 1181 drawable = data->stencil; |
1179 gc = data->stencil_gc; | 1182 gc = data->stencil_gc; |
1180 XSetForeground(data->display, data->stencil_gc, 0x00); | 1183 XSetForeground(data->display, data->stencil_gc, 0x00); |
1182 0, 0, window->w, window->h); | 1185 0, 0, window->w, window->h); |
1183 XSetForeground(data->display, data->stencil_gc, 0xFF); | 1186 XSetForeground(data->display, data->stencil_gc, 0xFF); |
1184 } | 1187 } |
1185 else | 1188 else |
1186 #endif | 1189 #endif |
1190 */ | |
1187 { | 1191 { |
1188 drawable = data->drawable; | 1192 drawable = data->drawable; |
1189 gc = data->gc; | 1193 gc = data->gc; |
1190 } | 1194 } |
1191 | 1195 |
1304 rect.h = (maxy - miny) + 1; | 1308 rect.h = (maxy - miny) + 1; |
1305 SDL_AddDirtyRect(&data->dirty, &rect); | 1309 SDL_AddDirtyRect(&data->dirty, &rect); |
1306 } | 1310 } |
1307 } | 1311 } |
1308 } | 1312 } |
1313 /* | |
1309 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1314 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1310 if (data->use_xrender) { | 1315 if (data->use_xrender) { |
1311 XRenderColor xrforeground = xrenderdrawcolor(renderer); | 1316 XRenderColor xrforeground = xrenderdrawcolor(renderer); |
1312 XRenderFillRectangle(data->display, PictOpSrc, data->brush_pict, | 1317 XRenderFillRectangle(data->display, PictOpSrc, data->brush_pict, |
1313 &xrforeground, 0, 0, 1, 1); | 1318 &xrforeground, 0, 0, 1, 1); |
1314 XRenderComposite(data->display, data->blend_op, data->brush_pict, | 1319 XRenderComposite(data->display, data->blend_op, data->brush_pict, |
1315 data->stencil_pict, data->drawable_pict, | 1320 data->stencil_pict, data->drawable_pict, |
1316 0, 0, 0, 0, 0, 0, window->w, window->h); | 1321 0, 0, 0, 0, 0, 0, window->w, window->h); |
1317 } | 1322 } |
1318 #endif | 1323 #endif |
1324 */ | |
1319 SDL_stack_free(xpoints); | 1325 SDL_stack_free(xpoints); |
1320 | 1326 |
1321 return 0; | 1327 return 0; |
1322 } | 1328 } |
1323 | 1329 |
1334 | 1340 |
1335 clip.x = 0; | 1341 clip.x = 0; |
1336 clip.y = 0; | 1342 clip.y = 0; |
1337 clip.w = window->w; | 1343 clip.w = window->w; |
1338 clip.h = window->h; | 1344 clip.h = window->h; |
1339 | 1345 /* |
1340 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1346 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1341 #ifndef NO_SHARED_MEMORY | 1347 #ifndef NO_SHARED_MEMORY |
1348 #ifdef EXPT | |
1342 if (data->use_xrender && data->stencil_image && data->stencil_surface) { | 1349 if (data->use_xrender && data->stencil_image && data->stencil_surface) { |
1343 SDL_FillRect(data->stencil_surface, NULL, 0x00); | 1350 SDL_FillRect(data->stencil_surface, NULL, 0x00); |
1344 | 1351 |
1345 SDL_SetClipRect(data->stencil_surface, NULL); | 1352 SDL_SetClipRect(data->stencil_surface, NULL); |
1353 | |
1346 SDL_DrawRects(data->stencil_surface, rects, count, 1); | 1354 SDL_DrawRects(data->stencil_surface, rects, count, 1); |
1347 | 1355 |
1348 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image, | 1356 XShmPutImage(data->display, data->stencil, data->stencil_gc, data->stencil_image, |
1349 0, 0, 0, 0, window->w, window->h, False); | 1357 0, 0, 0, 0, window->w, window->h, False); |
1358 | |
1359 XSync(data->display, False); | |
1350 } | 1360 } |
1351 else | 1361 else |
1352 #endif | 1362 #endif |
1353 #endif | 1363 #endif |
1364 #endif | |
1365 */ | |
1354 { | 1366 { |
1355 | 1367 |
1356 for (i = 0; i < count; ++i) { | 1368 for (i = 0; i < count; ++i) { |
1357 if (!SDL_IntersectRect(rects[i], &clip, &rect)) { | 1369 if (!SDL_IntersectRect(rects[i], &clip, &rect)) { |
1358 continue; | 1370 continue; |
1367 | 1379 |
1368 if (data->makedirty) { | 1380 if (data->makedirty) { |
1369 SDL_AddDirtyRect(&data->dirty, &rect); | 1381 SDL_AddDirtyRect(&data->dirty, &rect); |
1370 } | 1382 } |
1371 } | 1383 } |
1384 /* | |
1372 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1385 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1373 if (data->use_xrender) { | 1386 if (data->use_xrender) { |
1374 XSetForeground(data->display, data->stencil_gc, 0x00); | 1387 XSetForeground(data->display, data->stencil_gc, 0x00); |
1375 XFillRectangle(data->display, data->stencil, data->stencil_gc, | 1388 XFillRectangle(data->display, data->stencil, data->stencil_gc, |
1376 0, 0, window->w, window->h); | 1389 0, 0, window->w, window->h); |
1377 XSetForeground(data->display, data->stencil_gc, 0xFF); | 1390 XSetForeground(data->display, data->stencil_gc, 0xFF); |
1378 | 1391 |
1379 XDrawRectangles(data->display, data->stencil, data->stencil_gc, xrects, xcount); | 1392 XDrawRectangles(data->display, data->stencil, data->stencil_gc, xrects, xcount); |
1380 } | 1393 } |
1381 #endif | 1394 #endif |
1382 } | 1395 */ |
1396 } | |
1397 /* | |
1383 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1398 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1384 if (data->use_xrender) { | 1399 if (data->use_xrender) { |
1385 XRenderColor foreground; | 1400 XRenderColor foreground; |
1386 foreground = xrenderdrawcolor(renderer); | 1401 foreground = xrenderdrawcolor(renderer); |
1387 | 1402 |
1388 XRenderFillRectangle(data->display, PictOpSrc, data->brush_pict, | 1403 XRenderFillRectangle(data->display, PictOpSrc, data->brush_pict, |
1389 &foreground, 0, 0, 1, 1); | 1404 &foreground, 0, 0, 1, 1); |
1390 | |
1391 XRenderComposite(data->display, data->blend_op, data->brush_pict, | 1405 XRenderComposite(data->display, data->blend_op, data->brush_pict, |
1392 data->stencil_pict, data->drawable_pict, | 1406 data->stencil_pict, data->drawable_pict, |
1393 0, 0, 0, 0, 0, 0, window->w, window->h); | 1407 0, 0, 0, 0, 0, 0, window->w, window->h); |
1394 } | 1408 } |
1395 else | 1409 else |
1396 #endif | 1410 #endif |
1411 */ | |
1397 { | 1412 { |
1398 unsigned long foreground; | 1413 unsigned long foreground; |
1399 | 1414 |
1400 foreground = renderdrawcolor(renderer, 1); | 1415 foreground = renderdrawcolor(renderer, 1); |
1401 XSetForeground(data->display, data->gc, foreground); | 1416 XSetForeground(data->display, data->gc, foreground); |
1445 | 1460 |
1446 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1461 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1447 if (data->use_xrender) { | 1462 if (data->use_xrender) { |
1448 XRenderColor foreground; | 1463 XRenderColor foreground; |
1449 foreground = xrenderdrawcolor(renderer); | 1464 foreground = xrenderdrawcolor(renderer); |
1450 XRenderFillRectangles(data->display, data->blend_op, data->drawable_pict, | 1465 if (xcount == 1) { |
1451 &foreground, xrects, xcount); | 1466 XRenderFillRectangle(data->display, data->blend_op, data->drawable_pict, |
1467 &foreground, xrects[0].x, xrects[0].y, | |
1468 xrects[0].width, xrects[0].height); | |
1469 } | |
1470 else if (xcount > 1) { | |
1471 XRenderFillRectangles(data->display, data->blend_op, data->drawable_pict, | |
1472 &foreground, xrects, xcount); | |
1473 } | |
1452 } | 1474 } |
1453 else | 1475 else |
1454 #endif | 1476 #endif |
1455 { | 1477 { |
1456 unsigned long foreground; | 1478 unsigned long foreground; |
1703 /* Send the data to the display */ | 1725 /* Send the data to the display */ |
1704 if (!(renderer->info.flags & SDL_RENDERER_SINGLEBUFFER)) { | 1726 if (!(renderer->info.flags & SDL_RENDERER_SINGLEBUFFER)) { |
1705 for (dirty = data->dirty.list; dirty; dirty = dirty->next) { | 1727 for (dirty = data->dirty.list; dirty; dirty = dirty->next) { |
1706 const SDL_Rect *rect = &dirty->rect; | 1728 const SDL_Rect *rect = &dirty->rect; |
1707 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER | 1729 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER |
1708 if(data->use_xrender == SDL_TRUE) | 1730 if (data->use_xrender) |
1709 { | 1731 { |
1710 XRenderComposite(data->display, | 1732 XRenderComposite(data->display, |
1711 data->blend_op, | 1733 data->blend_op, |
1712 data->drawable_pict, | 1734 data->drawable_pict, |
1713 None, | 1735 None, |
1724 data->gc, rect->x, rect->y, rect->w, rect->h, | 1746 data->gc, rect->x, rect->y, rect->w, rect->h, |
1725 rect->x, rect->y); | 1747 rect->x, rect->y); |
1726 } | 1748 } |
1727 } | 1749 } |
1728 SDL_ClearDirtyRects(&data->dirty); | 1750 SDL_ClearDirtyRects(&data->dirty); |
1729 } | 1751 } |
1730 XSync(data->display, False); | 1752 XSync(data->display, False); |
1731 | 1753 |
1732 /* Update the flipping chain, if any */ | 1754 /* Update the flipping chain, if any */ |
1733 if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) { | 1755 if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) { |
1734 data->current_pixmap = (data->current_pixmap + 1) % 2; | 1756 data->current_pixmap = (data->current_pixmap + 1) % 2; |