… | |
… | |
428 | { |
428 | { |
429 | flags = new_flags; |
429 | flags = new_flags; |
430 | changed++; |
430 | changed++; |
431 | } |
431 | } |
432 | |
432 | |
433 | //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
|
|
434 | // flags, h_scale, v_scale, h_align, v_align); |
|
|
435 | return (changed > 0); |
433 | return (changed > 0); |
436 | } |
434 | } |
437 | |
435 | |
438 | void |
436 | void |
439 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
437 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
… | |
… | |
529 | |
527 | |
530 | int x = 0; |
528 | int x = 0; |
531 | int y = 0; |
529 | int y = 0; |
532 | int w = 0; |
530 | int w = 0; |
533 | int h = 0; |
531 | int h = 0; |
534 | |
|
|
535 | TIMING_TEST_START (asim); |
|
|
536 | |
532 | |
537 | if (original_asim) |
533 | if (original_asim) |
538 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
534 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
539 | |
535 | |
540 | if (!original_asim |
536 | if (!original_asim |
… | |
… | |
657 | } |
653 | } |
658 | |
654 | |
659 | free (layers); |
655 | free (layers); |
660 | } |
656 | } |
661 | } |
657 | } |
662 | TIMING_TEST_PRINT_RESULT (asim); |
|
|
663 | |
658 | |
664 | bool ret = false; |
659 | bool ret = false; |
665 | |
660 | |
666 | if (result) |
661 | if (result) |
667 | { |
662 | { |
… | |
… | |
713 | |
708 | |
714 | if (result != background && result != original_asim) |
709 | if (result != background && result != original_asim) |
715 | destroy_asimage (&result); |
710 | destroy_asimage (&result); |
716 | |
711 | |
717 | XFreeGC (target->dpy, gc); |
712 | XFreeGC (target->dpy, gc); |
718 | TIMING_TEST_PRINT_RESULT (asim); |
|
|
719 | |
713 | |
720 | ret = true; |
714 | ret = true; |
721 | } |
715 | } |
722 | |
716 | |
723 | if (background) |
717 | if (background) |
… | |
… | |
1283 | } |
1277 | } |
1284 | |
1278 | |
1285 | XRenderFreePicture (dpy, mask_pic); |
1279 | XRenderFreePicture (dpy, mask_pic); |
1286 | XRenderFreePicture (dpy, overlay_pic); |
1280 | XRenderFreePicture (dpy, overlay_pic); |
1287 | XRenderFreePicture (dpy, back_pic); |
1281 | XRenderFreePicture (dpy, back_pic); |
1288 | # if DO_TIMING_TEST |
|
|
1289 | XSync (dpy, False); |
|
|
1290 | # endif |
|
|
1291 | # endif |
1282 | # endif |
1292 | } |
1283 | } |
1293 | |
1284 | |
1294 | return ret; |
1285 | return ret; |
1295 | } |
1286 | } |
… | |
… | |
1313 | Window root = target->display->root; |
1304 | Window root = target->display->root; |
1314 | int screen = target->display->screen; |
1305 | int screen = target->display->screen; |
1315 | Display *dpy = target->dpy; |
1306 | Display *dpy = target->dpy; |
1316 | int root_width = DisplayWidth (dpy, screen); |
1307 | int root_width = DisplayWidth (dpy, screen); |
1317 | int root_height = DisplayHeight (dpy, screen); |
1308 | int root_height = DisplayHeight (dpy, screen); |
1318 | unsigned int root_pmap_width, root_pmap_height; |
|
|
1319 | int window_width = target->szHint.width; |
1309 | int window_width = target->szHint.width; |
1320 | int window_height = target->szHint.height; |
1310 | int window_height = target->szHint.height; |
1321 | int sx, sy; |
1311 | int sx, sy; |
1322 | XGCValues gcv; |
1312 | XGCValues gcv; |
1323 | GC gc; |
1313 | GC gc; |
1324 | |
1314 | |
1325 | TIMING_TEST_START (tp); |
|
|
1326 | target->get_window_origin (sx, sy); |
1315 | target->get_window_origin (sx, sy); |
1327 | |
1316 | |
1328 | /* check if we are outside of the visible part of the virtual screen : */ |
1317 | /* check if we are outside of the visible part of the virtual screen : */ |
1329 | if (sx + window_width <= 0 || sy + window_height <= 0 |
1318 | if (sx + window_width <= 0 || sy + window_height <= 0 |
1330 | || sx >= root_width || sy >= root_height) |
1319 | || sx >= root_width || sy >= root_height) |
1331 | return 0; |
1320 | return 0; |
1332 | |
1321 | |
1333 | if (root_pixmap != None) |
|
|
1334 | { |
|
|
1335 | /* we want to validate the pixmap and get its size at the same time : */ |
|
|
1336 | int junk; |
|
|
1337 | unsigned int ujunk; |
|
|
1338 | /* root pixmap may be bad - allow a error */ |
|
|
1339 | target->allowedxerror = -1; |
|
|
1340 | |
|
|
1341 | if (!XGetGeometry (dpy, root_pixmap, &root, &junk, &junk, &root_pmap_width, &root_pmap_height, &ujunk, &ujunk)) |
|
|
1342 | root_pixmap = None; |
|
|
1343 | |
|
|
1344 | target->allowedxerror = 0; |
|
|
1345 | } |
|
|
1346 | |
|
|
1347 | if (root_pixmap == None) |
1322 | if (root_pixmap == None) |
1348 | return 0; |
1323 | return 0; |
1349 | |
1324 | |
1350 | Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); |
1325 | Pixmap tiled_root_pmap = XCreatePixmap (dpy, root, window_width, window_height, root_depth); |
1351 | |
1326 | |
… | |
… | |
1367 | { |
1342 | { |
1368 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
1343 | XFillRectangle (dpy, tiled_root_pmap, gc, 0, 0, window_width, window_height); |
1369 | result |= transpPmapTiled; |
1344 | result |= transpPmapTiled; |
1370 | XFreeGC (dpy, gc); |
1345 | XFreeGC (dpy, gc); |
1371 | } |
1346 | } |
1372 | TIMING_TEST_PRINT_RESULT (tp); |
|
|
1373 | |
1347 | |
1374 | if (tiled_root_pmap != None) |
1348 | if (tiled_root_pmap != None) |
1375 | { |
1349 | { |
1376 | if (!need_client_side_rendering ()) |
1350 | if (!need_client_side_rendering ()) |
1377 | { |
1351 | { |
… | |
… | |
1394 | pmap_width = window_width; |
1368 | pmap_width = window_width; |
1395 | pmap_height = window_height; |
1369 | pmap_height = window_height; |
1396 | pmap_depth = root_depth; |
1370 | pmap_depth = root_depth; |
1397 | } |
1371 | } |
1398 | |
1372 | |
1399 | TIMING_TEST_PRINT_RESULT (tp); |
|
|
1400 | |
|
|
1401 | return result; |
1373 | return result; |
1402 | } |
1374 | } |
1403 | |
1375 | |
1404 | bool |
1376 | void |
1405 | bgPixmap_t::set_root_pixmap () |
1377 | bgPixmap_t::set_root_pixmap () |
1406 | { |
1378 | { |
1407 | Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1379 | Pixmap new_root_pixmap = target->get_pixmap_property (XA_XROOTPMAP_ID); |
1408 | if (new_root_pixmap == None) |
1380 | if (new_root_pixmap == None) |
1409 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1381 | new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID); |
1410 | |
1382 | |
1411 | if (new_root_pixmap != root_pixmap) |
|
|
1412 | { |
|
|
1413 | root_pixmap = new_root_pixmap; |
1383 | root_pixmap = new_root_pixmap; |
1414 | return true; |
1384 | |
|
|
1385 | // validate root pixmap |
|
|
1386 | if (root_pixmap != None) |
1415 | } |
1387 | { |
|
|
1388 | unsigned int width, height; |
|
|
1389 | Window wdummy; |
|
|
1390 | int idummy; |
|
|
1391 | unsigned int udummy; |
1416 | |
1392 | |
1417 | return false; |
1393 | target->allowedxerror = -1; |
|
|
1394 | |
|
|
1395 | if (!XGetGeometry (target->dpy, root_pixmap, &wdummy, &idummy, &idummy, &width, &height, &udummy, &udummy)) |
|
|
1396 | root_pixmap = None; |
|
|
1397 | |
|
|
1398 | target->allowedxerror = 0; |
|
|
1399 | } |
1418 | } |
1400 | } |
1419 | # endif /* ENABLE_TRANSPARENCY */ |
1401 | # endif /* ENABLE_TRANSPARENCY */ |
1420 | |
1402 | |
1421 | # ifndef HAVE_AFTERIMAGE |
1403 | # ifndef HAVE_AFTERIMAGE |
1422 | static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm); |
1404 | static void ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm); |
… | |
… | |
1427 | { |
1409 | { |
1428 | unsigned long background_flags = 0; |
1410 | unsigned long background_flags = 0; |
1429 | |
1411 | |
1430 | if (target == NULL) |
1412 | if (target == NULL) |
1431 | return false; |
1413 | return false; |
1432 | |
|
|
1433 | TIMING_TEST_START (tp); |
|
|
1434 | |
1414 | |
1435 | invalidate (); |
1415 | invalidate (); |
1436 | # ifdef ENABLE_TRANSPARENCY |
1416 | # ifdef ENABLE_TRANSPARENCY |
1437 | if (flags & isTransparent) |
1417 | if (flags & isTransparent) |
1438 | { |
1418 | { |
… | |
… | |
1527 | } |
1507 | } |
1528 | } |
1508 | } |
1529 | |
1509 | |
1530 | apply (); |
1510 | apply (); |
1531 | |
1511 | |
1532 | XSync (target->dpy, False); |
|
|
1533 | valid_since = ev::now (); |
1512 | valid_since = ev::now (); |
1534 | |
|
|
1535 | TIMING_TEST_PRINT_RESULT (tp); |
|
|
1536 | |
1513 | |
1537 | return true; |
1514 | return true; |
1538 | } |
1515 | } |
1539 | |
1516 | |
1540 | bool |
1517 | bool |
… | |
… | |
1556 | void |
1533 | void |
1557 | bgPixmap_t::apply () |
1534 | bgPixmap_t::apply () |
1558 | { |
1535 | { |
1559 | if (target) |
1536 | if (target) |
1560 | { |
1537 | { |
1561 | flags &= ~isVtOrigin; |
|
|
1562 | |
|
|
1563 | if (pixmap != None) |
1538 | if (pixmap != None) |
1564 | { |
1539 | { |
1565 | /* set target's background to pixmap */ |
1540 | /* set target's background to pixmap */ |
1566 | # ifdef ENABLE_TRANSPARENCY |
1541 | # ifdef ENABLE_TRANSPARENCY |
1567 | if (flags & isTransparent) |
1542 | if (flags & isTransparent) |
… | |
… | |
1573 | XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); |
1548 | XSetWindowBackgroundPixmap (target->dpy, target->scrollBar.win, ParentRelative); |
1574 | } |
1549 | } |
1575 | else |
1550 | else |
1576 | # endif |
1551 | # endif |
1577 | { |
1552 | { |
1578 | flags |= isVtOrigin; |
|
|
1579 | /* force old pixmap dereference in case it was transparent before :*/ |
1553 | /* force old pixmap dereference in case it was transparent before :*/ |
1580 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
1554 | XSetWindowBackground (target->dpy, target->parent[0], target->pix_colors[Color_border]); |
1581 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
1555 | XSetWindowBackgroundPixmap (target->dpy, target->vt, pixmap); |
1582 | /* do we also need to set scrollbar's background here ? */ |
1556 | /* do we also need to set scrollbar's background here ? */ |
1583 | |
1557 | |
… | |
… | |
1613 | #endif /* HAVE_BG_PIXMAP */ |
1587 | #endif /* HAVE_BG_PIXMAP */ |
1614 | |
1588 | |
1615 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1589 | #if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) && !XFT |
1616 | /* taken from aterm-0.4.2 */ |
1590 | /* taken from aterm-0.4.2 */ |
1617 | |
1591 | |
1618 | typedef uint32_t RUINT32T; |
|
|
1619 | |
|
|
1620 | static void |
1592 | static void |
1621 | ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm) |
1593 | ShadeXImage(Visual *visual, XImage *srcImage, int shade, int rm, int gm, int bm) |
1622 | { |
1594 | { |
1623 | int sh_r, sh_g, sh_b; |
1595 | int sh_r, sh_g, sh_b; |
1624 | RUINT32T mask_r, mask_g, mask_b; |
1596 | uint32_t mask_r, mask_g, mask_b; |
1625 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
1597 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1626 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
1598 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
1627 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
1599 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
1628 | int i; |
1600 | int i; |
|
|
1601 | int host_byte_order = byteorder.big_endian () ? MSBFirst : LSBFirst; |
1629 | |
1602 | |
1630 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return; |
1603 | if (visual->c_class != TrueColor || srcImage->format != ZPixmap) return; |
1631 | |
1604 | |
1632 | /* for convenience */ |
1605 | /* for convenience */ |
1633 | mask_r = visual->red_mask; |
1606 | mask_r = visual->red_mask; |
… | |
… | |
1640 | case 15: |
1613 | case 15: |
1641 | if ((mask_r != 0x7c00) || |
1614 | if ((mask_r != 0x7c00) || |
1642 | (mask_g != 0x03e0) || |
1615 | (mask_g != 0x03e0) || |
1643 | (mask_b != 0x001f)) |
1616 | (mask_b != 0x001f)) |
1644 | return; |
1617 | return; |
1645 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
1618 | lookup = (uint32_t *) malloc (sizeof (uint32_t)*(32+32+32)); |
1646 | lookup_r = lookup; |
1619 | lookup_r = lookup; |
1647 | lookup_g = lookup+32; |
1620 | lookup_g = lookup+32; |
1648 | lookup_b = lookup+32+32; |
1621 | lookup_b = lookup+32+32; |
1649 | sh_r = 10; |
1622 | sh_r = 10; |
1650 | sh_g = 5; |
1623 | sh_g = 5; |
… | |
… | |
1653 | case 16: |
1626 | case 16: |
1654 | if ((mask_r != 0xf800) || |
1627 | if ((mask_r != 0xf800) || |
1655 | (mask_g != 0x07e0) || |
1628 | (mask_g != 0x07e0) || |
1656 | (mask_b != 0x001f)) |
1629 | (mask_b != 0x001f)) |
1657 | return; |
1630 | return; |
1658 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
1631 | lookup = (uint32_t *) malloc (sizeof (uint32_t)*(32+64+32)); |
1659 | lookup_r = lookup; |
1632 | lookup_r = lookup; |
1660 | lookup_g = lookup+32; |
1633 | lookup_g = lookup+32; |
1661 | lookup_b = lookup+32+64; |
1634 | lookup_b = lookup+32+64; |
1662 | sh_r = 11; |
1635 | sh_r = 11; |
1663 | sh_g = 5; |
1636 | sh_g = 5; |
… | |
… | |
1666 | case 24: |
1639 | case 24: |
1667 | if ((mask_r != 0xff0000) || |
1640 | if ((mask_r != 0xff0000) || |
1668 | (mask_g != 0x00ff00) || |
1641 | (mask_g != 0x00ff00) || |
1669 | (mask_b != 0x0000ff)) |
1642 | (mask_b != 0x0000ff)) |
1670 | return; |
1643 | return; |
1671 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
1644 | lookup = (uint32_t *) malloc (sizeof (uint32_t)*(256+256+256)); |
1672 | lookup_r = lookup; |
1645 | lookup_r = lookup; |
1673 | lookup_g = lookup+256; |
1646 | lookup_g = lookup+256; |
1674 | lookup_b = lookup+256+256; |
1647 | lookup_b = lookup+256+256; |
1675 | sh_r = 16; |
1648 | sh_r = 16; |
1676 | sh_g = 8; |
1649 | sh_g = 8; |
… | |
… | |
1679 | case 32: |
1652 | case 32: |
1680 | if ((mask_r != 0xff0000) || |
1653 | if ((mask_r != 0xff0000) || |
1681 | (mask_g != 0x00ff00) || |
1654 | (mask_g != 0x00ff00) || |
1682 | (mask_b != 0x0000ff)) |
1655 | (mask_b != 0x0000ff)) |
1683 | return; |
1656 | return; |
1684 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
1657 | lookup = (uint32_t *) malloc (sizeof (uint32_t)*(256+256+256)); |
1685 | lookup_r = lookup; |
1658 | lookup_r = lookup; |
1686 | lookup_g = lookup+256; |
1659 | lookup_g = lookup+256; |
1687 | lookup_b = lookup+256+256; |
1660 | lookup_b = lookup+256+256; |
1688 | sh_r = 16; |
1661 | sh_r = 16; |
1689 | sh_g = 8; |
1662 | sh_g = 8; |
… | |
… | |
1700 | |
1673 | |
1701 | lower_lim_r = 65535-rm; |
1674 | lower_lim_r = 65535-rm; |
1702 | lower_lim_g = 65535-gm; |
1675 | lower_lim_g = 65535-gm; |
1703 | lower_lim_b = 65535-bm; |
1676 | lower_lim_b = 65535-bm; |
1704 | |
1677 | |
1705 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
1678 | lower_lim_r = 65535-(unsigned int)(((uint32_t)lower_lim_r)*((uint32_t)shade)/100); |
1706 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
1679 | lower_lim_g = 65535-(unsigned int)(((uint32_t)lower_lim_g)*((uint32_t)shade)/100); |
1707 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
1680 | lower_lim_b = 65535-(unsigned int)(((uint32_t)lower_lim_b)*((uint32_t)shade)/100); |
1708 | |
1681 | |
1709 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
1682 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
1710 | } |
1683 | } |
1711 | else |
1684 | else |
1712 | { |
1685 | { |
1713 | |
1686 | |
1714 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
1687 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
1715 | |
1688 | |
1716 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
1689 | upper_lim_r = (unsigned int)((((uint32_t)rm)*((uint32_t)shade))/100); |
1717 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
1690 | upper_lim_g = (unsigned int)((((uint32_t)gm)*((uint32_t)shade))/100); |
1718 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
1691 | upper_lim_b = (unsigned int)((((uint32_t)bm)*((uint32_t)shade))/100); |
1719 | } |
1692 | } |
1720 | |
1693 | |
1721 | /* fill our lookup tables */ |
1694 | /* fill our lookup tables */ |
1722 | for (i = 0; i <= mask_r>>sh_r; i++) |
1695 | for (i = 0; i <= mask_r>>sh_r; i++) |
1723 | { |
1696 | { |
1724 | RUINT32T tmp; |
1697 | uint32_t tmp; |
1725 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
1698 | tmp = ((uint32_t)i)*((uint32_t)(upper_lim_r-lower_lim_r)); |
1726 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
1699 | tmp += ((uint32_t)(mask_r>>sh_r))*((uint32_t)lower_lim_r); |
1727 | lookup_r[i] = (tmp/65535)<<sh_r; |
1700 | lookup_r[i] = (tmp/65535)<<sh_r; |
1728 | } |
1701 | } |
1729 | for (i = 0; i <= mask_g>>sh_g; i++) |
1702 | for (i = 0; i <= mask_g>>sh_g; i++) |
1730 | { |
1703 | { |
1731 | RUINT32T tmp; |
1704 | uint32_t tmp; |
1732 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
1705 | tmp = ((uint32_t)i)*((uint32_t)(upper_lim_g-lower_lim_g)); |
1733 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
1706 | tmp += ((uint32_t)(mask_g>>sh_g))*((uint32_t)lower_lim_g); |
1734 | lookup_g[i] = (tmp/65535)<<sh_g; |
1707 | lookup_g[i] = (tmp/65535)<<sh_g; |
1735 | } |
1708 | } |
1736 | for (i = 0; i <= mask_b>>sh_b; i++) |
1709 | for (i = 0; i <= mask_b>>sh_b; i++) |
1737 | { |
1710 | { |
1738 | RUINT32T tmp; |
1711 | uint32_t tmp; |
1739 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
1712 | tmp = ((uint32_t)i)*((uint32_t)(upper_lim_b-lower_lim_b)); |
1740 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
1713 | tmp += ((uint32_t)(mask_b>>sh_b))*((uint32_t)lower_lim_b); |
1741 | lookup_b[i] = (tmp/65535)<<sh_b; |
1714 | lookup_b[i] = (tmp/65535)<<sh_b; |
1742 | } |
1715 | } |
1743 | |
1716 | |
1744 | /* apply table to input image (replacing colors by newly calculated ones) */ |
1717 | /* apply table to input image (replacing colors by newly calculated ones) */ |
1745 | switch (srcImage->bits_per_pixel) |
1718 | if (srcImage->bits_per_pixel == 32 |
|
|
1719 | && (srcImage->depth == 24 || srcImage->depth == 32) |
|
|
1720 | && srcImage->byte_order == host_byte_order) |
1746 | { |
1721 | { |
1747 | case 32: |
|
|
1748 | { |
|
|
1749 | RUINT32T *p1, *pf, *p, *pl; |
1722 | uint32_t *p1, *pf, *p, *pl; |
1750 | p1 = (RUINT32T *) srcImage->data; |
1723 | p1 = (uint32_t *) srcImage->data; |
1751 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
1724 | pf = (uint32_t *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
1752 | |
1725 | |
1753 | while (p1 < pf) |
1726 | while (p1 < pf) |
1754 | { |
1727 | { |
1755 | p = p1; |
1728 | p = p1; |
1756 | pl = p1 + srcImage->width; |
1729 | pl = p1 + srcImage->width; |
1757 | for (; p < pl; p++) |
1730 | for (; p < pl; p++) |
1758 | { |
1731 | { |
1759 | *p = lookup_r[(*p & 0xff0000)>>16] | |
1732 | *p = lookup_r[(*p & 0xff0000) >> 16] | |
1760 | lookup_g[(*p & 0x00ff00)>> 8] | |
1733 | lookup_g[(*p & 0x00ff00) >> 8] | |
1761 | lookup_b[(*p & 0x0000ff)] | |
1734 | lookup_b[(*p & 0x0000ff)] | |
1762 | (*p & ~0xffffff); |
1735 | (*p & 0xff000000); |
1763 | } |
1736 | } |
1764 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
1737 | p1 = (uint32_t *) ((char *) p1 + srcImage->bytes_per_line); |
1765 | } |
1738 | } |
1766 | break; |
1739 | } |
1767 | } |
1740 | else |
1768 | default: |
1741 | { |
1769 | for (int y = 0; y < srcImage->height; y++) |
1742 | for (int y = 0; y < srcImage->height; y++) |
1770 | for (int x = 0; x < srcImage->width; x++) |
1743 | for (int x = 0; x < srcImage->width; x++) |
1771 | { |
1744 | { |
1772 | unsigned long pixel = XGetPixel (srcImage, x, y); |
1745 | unsigned long pixel = XGetPixel (srcImage, x, y); |
1773 | pixel = lookup_r[(pixel & mask_r) >> sh_r] | |
1746 | pixel = lookup_r[(pixel & mask_r) >> sh_r] | |
1774 | lookup_g[(pixel & mask_g) >> sh_g] | |
1747 | lookup_g[(pixel & mask_g) >> sh_g] | |
1775 | lookup_b[(pixel & mask_b) >> sh_b]; |
1748 | lookup_b[(pixel & mask_b) >> sh_b]; |
1776 | XPutPixel (srcImage, x, y, pixel); |
1749 | XPutPixel (srcImage, x, y, pixel); |
1777 | } |
1750 | } |
1778 | break; |
|
|
1779 | } |
1751 | } |
1780 | |
1752 | |
1781 | free (lookup); |
1753 | free (lookup); |
1782 | } |
1754 | } |
1783 | #endif /* defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) */ |
1755 | #endif /* defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) */ |