ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/background.C
(Generate patch)

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.58 by sf-exg, Fri Sep 3 22:57:31 2010 UTC vs.
Revision 1.60 by sf-exg, Sun Oct 3 20:41:32 2010 UTC

247make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) 247make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size)
248{ 248{
249 int src_pos = 0; 249 int src_pos = 0;
250 dst_pos = 0; 250 dst_pos = 0;
251 dst_size = size; 251 dst_size = size;
252 if (pos < 0 && size > target_size) 252 if (pos < 0)
253 { 253 {
254 src_pos = -pos; 254 src_pos = -pos;
255 dst_size += pos; 255 dst_size += pos;
256 } 256 }
257 else if (pos > 0) 257 else if (pos > 0)
451 //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", 451 //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n",
452 // flags, h_scale, v_scale, h_align, v_align); 452 // flags, h_scale, v_scale, h_align, v_align);
453 return (changed > 0); 453 return (changed > 0);
454} 454}
455 455
456void
457bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y)
458{
459 int target_width = target->szHint.width;
460 int target_height = target->szHint.height;
461
462 w = h_scale * target_width / 100;
463 h = v_scale * target_height / 100;
464
465 if (h_align == rootAlign || v_align == rootAlign)
466 {
467 target->get_window_origin (x, y);
468 x = -x;
469 y = -y;
470 }
471
472 if (h_align != rootAlign)
473 x = make_align_position (h_align, target_width, w > 0 ? w : image_width);
474
475 if (v_align != rootAlign)
476 y = make_align_position (v_align, target_height, h > 0 ? h : image_height);
477}
478
456# ifdef HAVE_AFTERIMAGE 479# ifdef HAVE_AFTERIMAGE
457bool 480bool
458bgPixmap_t::render_image (unsigned long background_flags) 481bgPixmap_t::render_image (unsigned long background_flags)
459{ 482{
460 if (target == NULL) 483 if (target == NULL)
504 int new_pmap_width = target_width; 527 int new_pmap_width = target_width;
505 int new_pmap_height = target_height; 528 int new_pmap_height = target_height;
506 529
507 int x = 0; 530 int x = 0;
508 int y = 0; 531 int y = 0;
509 int w = h_scale * target_width / 100; 532 int w = 0;
510 int h = v_scale * target_height / 100; 533 int h = 0;
511 534
512 TIMING_TEST_START (asim); 535 TIMING_TEST_START (asim);
513 536
514 if (original_asim) 537 if (original_asim)
515 { 538 get_image_geometry (original_asim->width, original_asim->height, w, h, x, y);
516 if (h_align == rootAlign || v_align == rootAlign)
517 {
518 target->get_window_origin (x, y);
519 x = -x;
520 y = -y;
521 }
522
523 if (h_align != rootAlign)
524 x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width);
525
526 if (v_align != rootAlign)
527 y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height);
528 }
529 539
530 if (!original_asim 540 if (!original_asim
531 || x >= target_width 541 || x >= target_width
532 || y >= target_height 542 || y >= target_height
533 || (w > 0 && x + w <= 0) 543 || (w > 0 && x + w <= 0)
741 int new_pmap_width = target_width; 751 int new_pmap_width = target_width;
742 int new_pmap_height = target_height; 752 int new_pmap_height = target_height;
743 753
744 int x = 0; 754 int x = 0;
745 int y = 0; 755 int y = 0;
746 int w = h_scale * target_width / 100; 756 int w = 0;
747 int h = v_scale * target_height / 100; 757 int h = 0;
748 758
749 if (h_align == rootAlign || v_align == rootAlign) 759 get_image_geometry (image_width, image_height, w, h, x, y);
750 {
751 target->get_window_origin (x, y);
752 x = -x;
753 y = -y;
754 }
755
756 if (h_align != rootAlign)
757 x = make_align_position (h_align, target_width, w > 0 ? w : image_width);
758
759 if (v_align != rootAlign)
760 y = make_align_position (v_align, target_height, h > 0 ? h : image_height);
761 760
762 if (x >= target_width 761 if (x >= target_width
763 || y >= target_height 762 || y >= target_height
764 || (w > 0 && x + w <= 0) 763 || (w > 0 && x + w <= 0)
765 || (h > 0 && y + h <= 0)) 764 || (h > 0 && y + h <= 0))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines