comparison src/video/x11/SDL_x11render.c @ 4591:1e998db9b597

Implement blending modes for textures. Fix off-screen pixmaps to be ARGB rather than RGB to enable blending across frames. Clear the screen and off-screen pixmaps when the renderer is created.
author Sunny Sachanandani <sunnysachanandani@gmail.com>
date Wed, 14 Jul 2010 19:17:11 +0530
parents 1ad70fb49fcb
children 3892fe2f6537
comparison
equal deleted inserted replaced
4590:1ad70fb49fcb 4591:1e998db9b597
121 Uint32 format; 121 Uint32 format;
122 Pixmap pixmap; 122 Pixmap pixmap;
123 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 123 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
124 Picture picture; 124 Picture picture;
125 XRenderPictFormat* picture_fmt; 125 XRenderPictFormat* picture_fmt;
126 SDL_bool use_xrender; 126 int blend_op;
127 // SDL_bool use_xrender;
127 #endif 128 #endif
128 XImage *image; 129 XImage *image;
129 #ifndef NO_SHARED_MEMORY 130 #ifndef NO_SHARED_MEMORY
130 /* MIT shared memory extension information */ 131 /* MIT shared memory extension information */
131 XShmSegmentInfo shminfo; 132 XShmSegmentInfo shminfo;
241 242
242 renderer->info.flags = SDL_RENDERER_ACCELERATED; 243 renderer->info.flags = SDL_RENDERER_ACCELERATED;
243 244
244 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 245 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
245 int event_basep, error_basep; 246 int event_basep, error_basep;
246 if(XRenderQueryExtension(data->display, &event_basep, &error_basep) == True) { 247 if(XRenderQueryExtension(data->display,
248 &event_basep,
249 &error_basep) == True) {
247 data->use_xrender = SDL_TRUE; 250 data->use_xrender = SDL_TRUE;
248 data->xwindow_pict_fmt = XRenderFindStandardFormat(data->display, PictStandardARGB32); 251 data->xwindow_pict_fmt = XRenderFindVisualFormat(data->display,
249 if(!data->xwindow_pict_fmt) { 252 data->visual);
250 data->use_xrender = SDL_FALSE; 253 data->xwindow_pict = XRenderCreatePicture(data->display,
251 goto fallback; 254 data->xwindow,
252 } 255 data->xwindow_pict_fmt,
253 data->xwindow_pict = XRenderCreatePicture(data->display, data->xwindow, data->xwindow_pict_fmt,
254 0, NULL); 256 0, NULL);
255 if(!data->xwindow_pict) { 257 XRenderComposite(data->display,
256 data->use_xrender = SDL_FALSE; 258 PictOpClear,
257 goto fallback; 259 data->xwindow_pict,
258 } 260 None,
261 data->xwindow_pict,
262 0, 0,
263 0, 0,
264 0, 0,
265 window->w, window->h);
259 renderer->info.blend_modes |= 266 renderer->info.blend_modes |=
260 (SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MASK); 267 (SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MASK);
261 // Create a 1 bit depth mask 268 // Create a 1 bit depth mask
262 data->mask = XCreatePixmap(data->display, data->xwindow, 269 data->mask = XCreatePixmap(data->display, data->xwindow,
263 window->w, window->h, 1); 270 window->w, window->h, 1);
264 data->mask_pict = XRenderCreatePicture(data->display, data->mask, 271 data->mask_pict =
265 XRenderFindStandardFormat(data->display, 272 XRenderCreatePicture(data->display, data->mask,
266 PictStandardA1), 273 XRenderFindStandardFormat(data->display,
267 0, NULL); 274 PictStandardA1),
275 0, NULL);
268 XGCValues gcv_mask; 276 XGCValues gcv_mask;
269 gcv_mask.foreground = 1; 277 gcv_mask.foreground = 1;
270 gcv_mask.background = 0; 278 gcv_mask.background = 0;
271 data->mask_gc = XCreateGC(data->display, data->mask, GCBackground | GCForeground, &gcv_mask); 279 data->mask_gc = XCreateGC(data->display, data->mask,
280 GCBackground | GCForeground, &gcv_mask);
272 renderer->blendMode = SDL_BLENDMODE_BLEND; 281 renderer->blendMode = SDL_BLENDMODE_BLEND;
273 data->blend_op = PictOpOver; 282 data->blend_op = PictOpOver;
274 } 283 }
275 else { 284 else {
276 data->use_xrender = SDL_FALSE; 285 data->use_xrender = SDL_FALSE;
277 } 286 }
278 fallback:
279 #endif 287 #endif
280 288
281 if (flags & SDL_RENDERER_SINGLEBUFFER) { 289 if (flags & SDL_RENDERER_SINGLEBUFFER) {
282 renderer->info.flags |= 290 renderer->info.flags |=
283 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY); 291 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY);
291 } else { 299 } else {
292 renderer->info.flags |= SDL_RENDERER_PRESENTCOPY; 300 renderer->info.flags |= SDL_RENDERER_PRESENTCOPY;
293 n = 1; 301 n = 1;
294 } 302 }
295 for (i = 0; i < n; ++i) { 303 for (i = 0; i < n; ++i) {
296 data->pixmaps[i] = 304 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
297 XCreatePixmap(data->display, data->xwindow, window->w, window->h, 305 if (data->use_xrender) {
298 displaydata->depth); 306 data->pixmaps[i] = XCreatePixmap(data->display,
307 data->xwindow,
308 window->w,
309 window->h,
310 32);
311 }
312 else
313 #endif
314 {
315 data->pixmaps[i] =
316 XCreatePixmap(data->display, data->xwindow, window->w, window->h,
317 displaydata->depth);
318 }
299 if (data->pixmaps[i] == None) { 319 if (data->pixmaps[i] == None) {
300 X11_DestroyRenderer(renderer); 320 X11_DestroyRenderer(renderer);
301 SDL_SetError("XCreatePixmap() failed"); 321 SDL_SetError("XCreatePixmap() failed");
302 return NULL; 322 return NULL;
303 } 323 }
304 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 324 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
305 if(data->use_xrender == SDL_TRUE) { 325 if(data->use_xrender == SDL_TRUE) {
306 data->pixmap_picts[i] = 326 data->pixmap_picts[i] =
307 XRenderCreatePicture(data->display, data->pixmaps[i], data->xwindow_pict_fmt, 327 XRenderCreatePicture(data->display,
328 data->pixmaps[i],
329 XRenderFindStandardFormat(data->display,
330 PictStandardARGB32),
308 0, None); 331 0, None);
309 if(!data->pixmap_picts[i]) { 332 XRenderComposite(data->display,
310 data->use_xrender = SDL_FALSE; 333 PictOpClear,
311 } 334 data->pixmap_picts[i],
312 XRenderComposite(data->display, PictOpClear, 335 None,
313 data->pixmap_picts[i], None, data->pixmap_picts[i], 336 data->pixmap_picts[i],
314 0, 0, 0, 0, 0, 0, window->w, window->h); 337 0, 0,
338 0, 0,
339 0, 0,
340 window->w, window->h);
341
315 } 342 }
316 #endif 343 #endif
317 } 344 }
318 if (n > 0) { 345 if (n > 0) {
319 data->drawable = data->pixmaps[0]; 346 data->drawable = data->pixmaps[0];
379 data->pixmap_picts[i] = None; 406 data->pixmap_picts[i] = None;
380 #endif 407 #endif
381 } 408 }
382 } 409 }
383 for (i = 0; i < n; ++i) { 410 for (i = 0; i < n; ++i) {
384 data->pixmaps[i] = 411 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
385 XCreatePixmap(data->display, data->xwindow, window->w, window->h, 412 if (data->use_xrender) {
386 data->depth); 413 data->pixmaps[i] =
414 XCreatePixmap(data->display,
415 data->xwindow,
416 window->w,
417 window->h,
418 32);
419 }
420 else
421 #endif
422 {
423 data->pixmaps[i] =
424 XCreatePixmap(data->display, data->xwindow, window->w, window->h,
425 data->depth);
426 }
387 if (data->pixmaps[i] == None) { 427 if (data->pixmaps[i] == None) {
388 SDL_SetError("XCreatePixmap() failed"); 428 SDL_SetError("XCreatePixmap() failed");
389 return -1; 429 return -1;
390 } 430 }
391 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 431 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
392 if(data->use_xrender == SDL_TRUE) { 432 if(data->use_xrender == SDL_TRUE) {
393 data->pixmap_picts[i] = 433 data->pixmap_picts[i] =
394 XRenderCreatePicture(data->display, data->pixmaps[i], data->xwindow_pict_fmt, 434 XRenderCreatePicture(data->display,
435 data->pixmaps[i],
436 XRenderFindStandardFormat(data->display,
437 PictStandardARGB32),
395 0, None); 438 0, None);
396 if(!data->pixmap_picts[i]) { 439 XRenderComposite(data->display,
397 data->use_xrender = SDL_FALSE; 440 PictOpClear,
398 } 441 data->pixmap_picts[i],
399 XRenderComposite(data->display, PictOpClear, 442 None,
400 data->pixmap_picts[i], None, data->pixmap_picts[i], 443 data->pixmap_picts[i],
401 0, 0, 0, 0, 0, 0, window->w, window->h); 444 0, 0,
402 } 445 0, 0,
446 0, 0,
447 window->w, window->h);
448
449 }
403 #endif 450 #endif
404 } 451 }
405 if (n > 0) { 452 if (n > 0) {
406 data->drawable = data->pixmaps[0]; 453 data->drawable = data->pixmaps[0];
407 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 454 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
440 /* If Xrender support is builtin we only need to check whether 487 /* If Xrender support is builtin we only need to check whether
441 Xrender is available at runtime. If it is available there 488 Xrender is available at runtime. If it is available there
442 can be no BadMatch error since Xrender takes care of that. 489 can be no BadMatch error since Xrender takes care of that.
443 */ 490 */
444 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 491 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
445 // Assume the texture is supported by Xrender
446 data->use_xrender = SDL_TRUE;
447 if (renderdata->use_xrender == SDL_FALSE) { 492 if (renderdata->use_xrender == SDL_FALSE) {
448 if (texture->format != display->current_mode.format) { 493 if (texture->format != display->current_mode.format) {
449 SDL_SetError("Texture format doesn't match window format"); 494 SDL_SetError("Texture format doesn't match window format");
450 return -1; 495 return -1;
451 } 496 }
576 SDL_SetError("XCreateImage() failed"); 621 SDL_SetError("XCreateImage() failed");
577 return -1; 622 return -1;
578 } 623 }
579 } 624 }
580 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 625 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
581 if(renderdata->use_xrender && data->pixmap) { 626 if(renderdata->use_xrender) {
582 data->use_xrender = SDL_TRUE; 627 data->picture_fmt = renderdata->xwindow_pict_fmt;
583 data->picture_fmt =
584 XRenderFindVisualFormat(renderdata->display, renderdata->visual);
585 if(!data->picture_fmt) {
586 printf("XRenderFindFormat failed!\n");
587 data->use_xrender = SDL_FALSE;
588 }
589 data->picture = 628 data->picture =
590 XRenderCreatePicture(renderdata->display, data->pixmap, 629 XRenderCreatePicture(renderdata->display, data->pixmap,
591 data->picture_fmt, 0, NULL); 630 data->picture_fmt, 0, NULL);
592 if(!data->picture) {
593 data->use_xrender = SDL_FALSE;
594 }
595 } 631 }
596 /* We thought we could render the texture with Xrender but this was 632 /* We thought we could render the texture with Xrender but this was
597 not possible for some reason. Now we must ensure that texture 633 not possible for some reason. Now we must ensure that texture
598 format and window format match to avoid a BadMatch error when 634 format and window format match to avoid a BadMatch error when
599 rendering using the old pipeline. 635 rendering using the old pipeline.
600 */
601 if(data->use_xrender == SDL_FALSE) { 636 if(data->use_xrender == SDL_FALSE) {
602 if (texture->format != display->current_mode.format) { 637 if (texture->format != display->current_mode.format) {
603 SDL_SetError("Texture format doesn't match window format"); 638 SDL_SetError("Texture format doesn't match window format");
604 return -1; 639 return -1;
605 } 640 }
606 } 641 }*/
607 #endif 642 #endif
608 return 0; 643 return 0;
609 } 644 }
610 645
611 static int 646 static int
624 } 659 }
625 660
626 static int 661 static int
627 X11_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) 662 X11_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
628 { 663 {
664 X11_TextureData *data = (X11_TextureData *) texture->driverdata;
629 switch (texture->blendMode) { 665 switch (texture->blendMode) {
630 case SDL_BLENDMODE_NONE: 666 case SDL_BLENDMODE_NONE:
667 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
668 data->blend_op = PictOpSrc;
631 return 0; 669 return 0;
670 case SDL_BLENDMODE_BLEND:
671 data->blend_op = PictOpOver;
672 return 0;
673 case SDL_BLENDMODE_ADD:
674 data->blend_op = PictOpAdd;
675 return 0;
676 #endif
632 default: 677 default:
633 SDL_Unsupported(); 678 SDL_Unsupported();
634 texture->blendMode = SDL_BLENDMODE_NONE; 679 texture->blendMode = SDL_BLENDMODE_NONE;
680 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
681 texture->blendMode = SDL_BLENDMODE_BLEND;
682 data->blend_op = PictOpOver;
683 #endif
635 return -1; 684 return -1;
636 } 685 }
637 } 686 }
638 687
639 static int 688 static int
793 if(renderer->blendMode == SDL_BLENDMODE_NONE) 842 if(renderer->blendMode == SDL_BLENDMODE_NONE)
794 alphad = 1.0; 843 alphad = 1.0;
795 else 844 else
796 alphad = (renderer->a) / 255.0; 845 alphad = (renderer->a) / 255.0;
797 846
798 xrender_color.alpha = (unsigned short) (alphad * 0xFFFF); 847 xrender_color.alpha = (unsigned short) ((renderer->a / 255.0) * 0xFFFF);
799 848
800 xrender_color.red = 849 xrender_color.red =
801 (unsigned short) ((renderer->r / 255.0) * alphad * 0xFFFF); 850 (unsigned short) ((renderer->r / 255.0) * alphad * 0xFFFF);
802 xrender_color.green = 851 xrender_color.green =
803 (unsigned short) ((renderer->g / 255.0) * alphad * 0xFFFF); 852 (unsigned short) ((renderer->g / 255.0) * alphad * 0xFFFF);
1168 1217
1169 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 1218 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
1170 if(data->use_xrender == SDL_TRUE) { 1219 if(data->use_xrender == SDL_TRUE) {
1171 XRenderColor foreground; 1220 XRenderColor foreground;
1172 XRenderPictureAttributes attributes; 1221 XRenderPictureAttributes attributes;
1173 unsigned long valuemask;
1174 1222
1175 foreground = xrenderdrawcolor(renderer); 1223 foreground = xrenderdrawcolor(renderer);
1176 valuemask = CPClipMask;
1177 attributes.clip_mask = data->mask; 1224 attributes.clip_mask = data->mask;
1178 1225
1179 XRenderComposite(data->display, PictOpClear, data->mask_pict, None, data->mask_pict, 1226 XRenderComposite(data->display, PictOpClear, data->mask_pict, None, data->mask_pict,
1180 0, 0, 0, 0, 0, 0, window->w, window->h); 1227 0, 0, 0, 0, 0, 0, window->w, window->h);
1181 XFillRectangles(data->display, data->mask, data->mask_gc, 1228 XFillRectangles(data->display, data->mask, data->mask_gc,
1182 xrects, xcount); 1229 xrects, xcount);
1183 1230
1184 XRenderChangePicture(data->display, data->drawable_pict, valuemask, &attributes); 1231 XRenderChangePicture(data->display, data->drawable_pict, CPClipMask, &attributes);
1185 1232 Picture fill_pict = XRenderCreateSolidFill(data->display,
1186 Picture fill = 1233 &foreground);
1187 XRenderCreateSolidFill(data->display, &foreground); 1234 XRenderComposite(data->display, data->blend_op, fill_pict, None,
1188 XRenderComposite(data->display, data->blend_op, fill, data->mask_pict,
1189 data->drawable_pict, 0, 0, 0, 0, 0, 0, window->w, window->h); 1235 data->drawable_pict, 0, 0, 0, 0, 0, 0, window->w, window->h);
1190 attributes.clip_mask = None; 1236 attributes.clip_mask = None;
1191 XRenderChangePicture(data->display, data->drawable_pict, valuemask, &attributes); 1237 XRenderChangePicture(data->display, data->drawable_pict, CPClipMask, &attributes);
1192 XRenderFreePicture(data->display, fill); 1238 XRenderFreePicture(data->display, fill_pict);
1193 } 1239 }
1194 else 1240 else
1195 #endif 1241 #endif
1196 { 1242 {
1197 unsigned long foreground; 1243 unsigned long foreground;
1217 1263
1218 if (data->makedirty) { 1264 if (data->makedirty) {
1219 SDL_AddDirtyRect(&data->dirty, dstrect); 1265 SDL_AddDirtyRect(&data->dirty, dstrect);
1220 } 1266 }
1221 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 1267 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
1222 if (data->use_xrender && texturedata->use_xrender) { 1268 if (data->use_xrender) {
1223 if(texture->access == SDL_TEXTUREACCESS_STREAMING) { 1269 if(texture->access == SDL_TEXTUREACCESS_STREAMING) {
1224 #ifndef NO_SHARED_MEMORY 1270 #ifndef NO_SHARED_MEMORY
1225 if(texturedata->shminfo.shmaddr) { 1271 if(texturedata->shminfo.shmaddr) {
1226 XShmPutImage(data->display, texturedata->pixmap, data->gc, 1272 XShmPutImage(data->display, texturedata->pixmap, data->gc,
1227 texturedata->image, srcrect->x, srcrect->y, 1273 texturedata->image, srcrect->x, srcrect->y,
1234 XPutImage(data->display, texturedata->pixmap, data->gc, 1280 XPutImage(data->display, texturedata->pixmap, data->gc,
1235 texturedata->image, srcrect->x, srcrect->y, dstrect->x, 1281 texturedata->image, srcrect->x, srcrect->y, dstrect->x,
1236 dstrect->y, srcrect->w, srcrect->h); 1282 dstrect->y, srcrect->w, srcrect->h);
1237 } 1283 }
1238 } 1284 }
1285 Picture pict;
1286 if(texture->blendMode == SDL_BLENDMODE_NONE)
1287 pict = None;
1288 else
1289 pict = texturedata->picture;
1239 if(srcrect->w == dstrect->w && srcrect->h == dstrect->h) { 1290 if(srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
1240 XRenderComposite(data->display, PictOpOver, texturedata->picture, None, data->drawable_pict, 1291 XRenderComposite(data->display, texturedata->blend_op, texturedata->picture,
1241 srcrect->x, srcrect->y, 0, 0, dstrect->x, dstrect->y, srcrect->w, srcrect->h); 1292 pict, data->drawable_pict, srcrect->x, srcrect->y,
1293 srcrect->x, srcrect->y, dstrect->x, dstrect->y,
1294 srcrect->w, srcrect->h);
1242 } else { 1295 } else {
1243 Pixmap scaling_pixmap = 1296 Pixmap scaling_pixmap =
1244 XCreatePixmap(data->display, texturedata->pixmap, dstrect->w, dstrect->h, 1297 XCreatePixmap(data->display, texturedata->pixmap, dstrect->w, dstrect->h,
1245 data->depth); 1298 data->depth);
1246 Picture scaling_picture = 1299 Picture scaling_picture =
1247 XRenderCreatePicture(data->display, scaling_pixmap, texturedata->picture_fmt, 1300 XRenderCreatePicture(data->display, scaling_pixmap, texturedata->picture_fmt,
1248 0, NULL); 1301 0, NULL);
1249 XRenderComposite(data->display, PictOpClear, scaling_picture, None, scaling_picture, 1302 XRenderComposite(data->display, PictOpClear, scaling_picture, None, scaling_picture,
1250 0, 0, 0, 0, 0, 0, dstrect->w, dstrect->h); 1303 0, 0, 0, 0, 0, 0, dstrect->w, dstrect->h);
1251 XRenderComposite(data->display, PictOpSrc, texturedata->picture, None, scaling_picture, 1304 XRenderComposite(data->display, PictOpSrc, texturedata->picture, pict, scaling_picture,
1252 srcrect->x, srcrect->y, 0, 0, 0, 0, srcrect->w, srcrect->h); 1305 srcrect->x, srcrect->y, 0, 0, 0, 0, srcrect->w, srcrect->h);
1253 double xscale = ((double) dstrect->w) / srcrect->w; 1306 double xscale = ((double) dstrect->w) / srcrect->w;
1254 double yscale = ((double) dstrect->h) / srcrect->h; 1307 double yscale = ((double) dstrect->h) / srcrect->h;
1255 XTransform xform = 1308 XTransform xform =
1256 {{{XDoubleToFixed(xscale), XDoubleToFixed(0), XDoubleToFixed(0)}, 1309 {{{XDoubleToFixed(xscale), XDoubleToFixed(0), XDoubleToFixed(0)},
1257 {XDoubleToFixed(0), XDoubleToFixed(yscale), XDoubleToFixed(0)}, 1310 {XDoubleToFixed(0), XDoubleToFixed(yscale), XDoubleToFixed(0)},
1258 {XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(xscale * yscale)}}}; 1311 {XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(xscale * yscale)}}};
1259 XRenderSetPictureTransform(data->display, scaling_picture, &xform); 1312 XRenderSetPictureTransform(data->display, scaling_picture, &xform);
1260 XRenderComposite(data->display, PictOpOver, scaling_picture, None, data->drawable_pict, 1313 XRenderComposite(data->display, texturedata->blend_op, scaling_picture, None, data->drawable_pict,
1261 0, 0, 0, 0, dstrect->x, dstrect->y, dstrect->w, dstrect->h); 1314 0, 0, 0, 0, dstrect->x, dstrect->y, dstrect->w, dstrect->h);
1262 XRenderFreePicture(data->display, scaling_picture); 1315 XRenderFreePicture(data->display, scaling_picture);
1263 XFreePixmap(data->display, scaling_pixmap); 1316 XFreePixmap(data->display, scaling_pixmap);
1264 } 1317 }
1265 } 1318 }
1443 for (dirty = data->dirty.list; dirty; dirty = dirty->next) { 1496 for (dirty = data->dirty.list; dirty; dirty = dirty->next) {
1444 const SDL_Rect *rect = &dirty->rect; 1497 const SDL_Rect *rect = &dirty->rect;
1445 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 1498 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
1446 if(data->use_xrender == SDL_TRUE) 1499 if(data->use_xrender == SDL_TRUE)
1447 { 1500 {
1448 XRenderComposite(data->display, PictOpOver, data->drawable_pict, None, 1501 XRenderComposite(data->display,
1449 data->xwindow_pict, rect->x, rect->y, 0, 0, rect->x, rect->y, 1502 data->blend_op,
1450 rect->w+1, rect->h+1); 1503 data->drawable_pict,
1504 None,
1505 data->xwindow_pict,
1506 rect->x, rect->y,
1507 0, 0,
1508 rect->x, rect->y,
1509 rect->w, rect->h);
1451 } 1510 }
1452 else 1511 else
1453 #endif 1512 #endif
1454 { 1513 {
1455 XCopyArea(data->display, data->drawable, data->xwindow, 1514 XCopyArea(data->display, data->drawable, data->xwindow,
1534 #endif 1593 #endif
1535 } 1594 }
1536 if (data->gc) { 1595 if (data->gc) {
1537 XFreeGC(data->display, data->gc); 1596 XFreeGC(data->display, data->gc);
1538 } 1597 }
1539 if (data->drawable) {
1540 XFreePixmap(data->display, data->drawable);
1541 }
1542 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER 1598 #ifdef SDL_VIDEO_DRIVER_X11_XRENDER
1543 if (data->mask_gc) { 1599 if (data->mask_gc) {
1544 XFreeGC(data->display, data->gc); 1600 XFreeGC(data->display, data->mask_gc);
1545 } 1601 }
1546 if (data->mask_pict) { 1602 if (data->mask_pict) {
1547 XRenderFreePicture(data->display, data->mask_pict); 1603 XRenderFreePicture(data->display, data->mask_pict);
1548 } 1604 }
1549 if (data->mask) { 1605 if (data->mask) {