… | |
… | |
729 | return false; |
729 | return false; |
730 | |
730 | |
731 | if (!pixbuf) |
731 | if (!pixbuf) |
732 | return false; |
732 | return false; |
733 | |
733 | |
734 | #if !XRENDER |
|
|
735 | if (background_flags) |
734 | if (background_flags |
|
|
735 | && !(flags & HAS_RENDER)) |
736 | return false; |
736 | return false; |
737 | #endif |
|
|
738 | |
737 | |
739 | GdkPixbuf *result; |
738 | GdkPixbuf *result; |
740 | |
739 | |
741 | int image_width = gdk_pixbuf_get_width (pixbuf); |
740 | int image_width = gdk_pixbuf_get_width (pixbuf); |
742 | int image_height = gdk_pixbuf_get_height (pixbuf); |
741 | int image_height = gdk_pixbuf_get_height (pixbuf); |
… | |
… | |
998 | if (v_blurRadius == 0 && h_blurRadius == 0) |
997 | if (v_blurRadius == 0 && h_blurRadius == 0) |
999 | flags &= ~blurNeeded; |
998 | flags &= ~blurNeeded; |
1000 | else |
999 | else |
1001 | flags |= blurNeeded; |
1000 | flags |= blurNeeded; |
1002 | |
1001 | |
1003 | #if XRENDER |
|
|
1004 | XFilters *filters = XRenderQueryFilters (target->dpy, target->vt); |
|
|
1005 | if (filters) |
|
|
1006 | { |
|
|
1007 | for (int i = 0; i < filters->nfilter; i++) |
|
|
1008 | if (!strcmp (filters->filter[i], FilterConvolution)) |
|
|
1009 | flags |= bgPixmap_t::blurServerSide; |
|
|
1010 | |
|
|
1011 | XFree (filters); |
|
|
1012 | } |
|
|
1013 | #endif |
|
|
1014 | |
|
|
1015 | return (changed > 0); |
1002 | return (changed > 0); |
1016 | } |
1003 | } |
1017 | |
1004 | |
1018 | static inline unsigned long |
1005 | static inline unsigned long |
1019 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
1006 | compute_tint_shade_flags (rxvt_color *tint, int shade) |
… | |
… | |
1039 | { |
1026 | { |
1040 | if ((c.r > 0x000700 || c.g > 0x000700 || c.b > 0x000700) |
1027 | if ((c.r > 0x000700 || c.g > 0x000700 || c.b > 0x000700) |
1041 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
1028 | && (c.r < 0x00f700 || c.g < 0x00f700 || c.b < 0x00f700)) |
1042 | { |
1029 | { |
1043 | flags |= bgPixmap_t::tintNeeded; |
1030 | flags |= bgPixmap_t::tintNeeded; |
1044 | } |
|
|
1045 | } |
|
|
1046 | |
|
|
1047 | if (flags & bgPixmap_t::tintNeeded) |
|
|
1048 | { |
|
|
1049 | if (flags & bgPixmap_t::tintWholesome) |
|
|
1050 | flags |= bgPixmap_t::tintServerSide; |
|
|
1051 | else |
|
|
1052 | { |
|
|
1053 | #if XRENDER |
|
|
1054 | flags |= bgPixmap_t::tintServerSide; |
|
|
1055 | #endif |
|
|
1056 | } |
1031 | } |
1057 | } |
1032 | } |
1058 | |
1033 | |
1059 | return flags; |
1034 | return flags; |
1060 | } |
1035 | } |
… | |
… | |
1336 | Pixmap recoded_root_pmap = root_pixmap; |
1311 | Pixmap recoded_root_pmap = root_pixmap; |
1337 | |
1312 | |
1338 | if (root_pixmap != None && root_depth != target->depth) |
1313 | if (root_pixmap != None && root_depth != target->depth) |
1339 | { |
1314 | { |
1340 | #if XRENDER |
1315 | #if XRENDER |
|
|
1316 | if (flags & HAS_RENDER) |
|
|
1317 | { |
1341 | XRenderPictureAttributes pa; |
1318 | XRenderPictureAttributes pa; |
1342 | |
1319 | |
1343 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); |
1320 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); |
1344 | Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, &pa); |
1321 | Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, &pa); |
1345 | |
1322 | |
1346 | recoded_root_pmap = XCreatePixmap (dpy, target->vt, root_pmap_width, root_pmap_height, target->depth); |
1323 | recoded_root_pmap = XCreatePixmap (dpy, target->vt, root_pmap_width, root_pmap_height, target->depth); |
1347 | XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, target->visual); |
1324 | XRenderPictFormat *dst_format = XRenderFindVisualFormat (dpy, target->visual); |
1348 | Picture dst = XRenderCreatePicture (dpy, recoded_root_pmap, dst_format, 0, &pa); |
1325 | Picture dst = XRenderCreatePicture (dpy, recoded_root_pmap, dst_format, 0, &pa); |
1349 | |
1326 | |
1350 | if (src && dst) |
1327 | if (src && dst) |
1351 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, root_pmap_width, root_pmap_height); |
1328 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, root_pmap_width, root_pmap_height); |
|
|
1329 | else |
|
|
1330 | { |
|
|
1331 | XFreePixmap (dpy, recoded_root_pmap); |
|
|
1332 | root_pixmap = None; |
|
|
1333 | } |
|
|
1334 | |
|
|
1335 | XRenderFreePicture (dpy, src); |
|
|
1336 | XRenderFreePicture (dpy, dst); |
|
|
1337 | } |
1352 | else |
1338 | else |
1353 | { |
1339 | #endif |
1354 | XFreePixmap (dpy, recoded_root_pmap); |
|
|
1355 | root_pixmap = None; |
|
|
1356 | } |
|
|
1357 | |
|
|
1358 | XRenderFreePicture (dpy, src); |
|
|
1359 | XRenderFreePicture (dpy, dst); |
|
|
1360 | #else |
|
|
1361 | root_pixmap = None; |
1340 | root_pixmap = None; |
1362 | #endif |
|
|
1363 | } |
1341 | } |
1364 | |
1342 | |
1365 | if (root_pixmap == None) |
1343 | if (root_pixmap == None) |
1366 | return 0; |
1344 | return 0; |
1367 | |
1345 | |
… | |
… | |
1391 | if (tiled_root_pmap != None) |
1369 | if (tiled_root_pmap != None) |
1392 | { |
1370 | { |
1393 | if (!need_client_side_rendering ()) |
1371 | if (!need_client_side_rendering ()) |
1394 | { |
1372 | { |
1395 | if ((flags & blurNeeded) |
1373 | if ((flags & blurNeeded) |
1396 | && (flags & blurServerSide)) |
1374 | && (flags & HAS_RENDER_CONV)) |
1397 | { |
1375 | { |
1398 | if (blur_pixmap (tiled_root_pmap, target->visual, window_width, window_height)) |
1376 | if (blur_pixmap (tiled_root_pmap, target->visual, window_width, window_height)) |
1399 | result |= transpPmapBlurred; |
1377 | result |= transpPmapBlurred; |
1400 | } |
1378 | } |
1401 | if ((flags & tintNeeded) |
1379 | if ((flags & tintNeeded) |
1402 | && (flags & tintServerSide)) |
1380 | && (flags & (tintWholesome | HAS_RENDER))) |
1403 | { |
1381 | { |
1404 | if (tint_pixmap (tiled_root_pmap, target->visual, window_width, window_height)) |
1382 | if (tint_pixmap (tiled_root_pmap, target->visual, window_width, window_height)) |
1405 | result |= transpPmapTinted; |
1383 | result |= transpPmapTinted; |
1406 | } |
1384 | } |
1407 | } /* server side rendering completed */ |
1385 | } /* server side rendering completed */ |
… | |
… | |
1517 | |
1495 | |
1518 | void |
1496 | void |
1519 | bgPixmap_t::set_target (rxvt_term *new_target) |
1497 | bgPixmap_t::set_target (rxvt_term *new_target) |
1520 | { |
1498 | { |
1521 | target = new_target; |
1499 | target = new_target; |
|
|
1500 | |
|
|
1501 | flags &= ~(HAS_RENDER | HAS_RENDER_CONV); |
|
|
1502 | #if XRENDER |
|
|
1503 | int major, minor; |
|
|
1504 | if (XRenderQueryVersion (target->dpy, &major, &minor)) |
|
|
1505 | flags |= HAS_RENDER; |
|
|
1506 | XFilters *filters = XRenderQueryFilters (target->dpy, target->vt); |
|
|
1507 | if (filters) |
|
|
1508 | { |
|
|
1509 | for (int i = 0; i < filters->nfilter; i++) |
|
|
1510 | if (!strcmp (filters->filter[i], FilterConvolution)) |
|
|
1511 | flags |= HAS_RENDER_CONV; |
|
|
1512 | |
|
|
1513 | XFree (filters); |
|
|
1514 | } |
|
|
1515 | #endif |
1522 | } |
1516 | } |
1523 | |
1517 | |
1524 | void |
1518 | void |
1525 | bgPixmap_t::apply () |
1519 | bgPixmap_t::apply () |
1526 | { |
1520 | { |