… | |
… | |
138 | # endif |
138 | # endif |
139 | |
139 | |
140 | # ifdef BG_IMAGE_FROM_FILE |
140 | # ifdef BG_IMAGE_FROM_FILE |
141 | if (have_image) |
141 | if (have_image) |
142 | { |
142 | { |
143 | if (h_scale != 0 || v_scale != 0 |
143 | if (flags & sizeSensitive) |
144 | || h_align != 0 || v_align != 0) |
|
|
145 | return true; |
144 | return true; |
146 | } |
145 | } |
147 | # endif |
146 | # endif |
148 | |
147 | |
149 | return false; |
148 | return false; |
… | |
… | |
247 | make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) |
246 | make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) |
248 | { |
247 | { |
249 | int src_pos = 0; |
248 | int src_pos = 0; |
250 | dst_pos = 0; |
249 | dst_pos = 0; |
251 | dst_size = size; |
250 | dst_size = size; |
252 | if (pos < 0 && size > target_size) |
251 | if (pos < 0) |
253 | { |
252 | { |
254 | src_pos = -pos; |
253 | src_pos = -pos; |
255 | dst_size += pos; |
254 | dst_size += pos; |
256 | } |
255 | } |
257 | else if (pos > 0) |
256 | else if (pos > 0) |
… | |
… | |
451 | //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
450 | //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
452 | // flags, h_scale, v_scale, h_align, v_align); |
451 | // flags, h_scale, v_scale, h_align, v_align); |
453 | return (changed > 0); |
452 | return (changed > 0); |
454 | } |
453 | } |
455 | |
454 | |
|
|
455 | void |
|
|
456 | bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
|
|
457 | { |
|
|
458 | int target_width = target->szHint.width; |
|
|
459 | int target_height = target->szHint.height; |
|
|
460 | |
|
|
461 | w = h_scale * target_width / 100; |
|
|
462 | h = v_scale * target_height / 100; |
|
|
463 | |
|
|
464 | if (h_align == rootAlign || v_align == rootAlign) |
|
|
465 | { |
|
|
466 | target->get_window_origin (x, y); |
|
|
467 | x = -x; |
|
|
468 | y = -y; |
|
|
469 | } |
|
|
470 | |
|
|
471 | if (h_align != rootAlign) |
|
|
472 | x = make_align_position (h_align, target_width, w > 0 ? w : image_width); |
|
|
473 | |
|
|
474 | if (v_align != rootAlign) |
|
|
475 | y = make_align_position (v_align, target_height, h > 0 ? h : image_height); |
|
|
476 | |
|
|
477 | flags &= ~sizeSensitive; |
|
|
478 | if (h_scale != 0 || v_scale != 0 |
|
|
479 | || h_align != 0 || v_align != 0 |
|
|
480 | || image_width > target_width || image_height > target_height) |
|
|
481 | flags |= sizeSensitive; |
|
|
482 | } |
|
|
483 | |
456 | # ifdef HAVE_AFTERIMAGE |
484 | # ifdef HAVE_AFTERIMAGE |
457 | bool |
485 | bool |
458 | bgPixmap_t::render_image (unsigned long background_flags) |
486 | bgPixmap_t::render_image (unsigned long background_flags) |
459 | { |
487 | { |
460 | if (target == NULL) |
488 | if (target == NULL) |
… | |
… | |
504 | int new_pmap_width = target_width; |
532 | int new_pmap_width = target_width; |
505 | int new_pmap_height = target_height; |
533 | int new_pmap_height = target_height; |
506 | |
534 | |
507 | int x = 0; |
535 | int x = 0; |
508 | int y = 0; |
536 | int y = 0; |
509 | int w = h_scale * target_width / 100; |
537 | int w = 0; |
510 | int h = v_scale * target_height / 100; |
538 | int h = 0; |
511 | |
539 | |
512 | TIMING_TEST_START (asim); |
540 | TIMING_TEST_START (asim); |
513 | |
541 | |
514 | if (original_asim) |
542 | if (original_asim) |
515 | { |
543 | 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 | |
544 | |
530 | if (!original_asim |
545 | if (!original_asim |
531 | || x >= target_width |
546 | || x >= target_width |
532 | || y >= target_height |
547 | || y >= target_height |
533 | || (w > 0 && x + w <= 0) |
548 | || (w > 0 && x + w <= 0) |
… | |
… | |
741 | int new_pmap_width = target_width; |
756 | int new_pmap_width = target_width; |
742 | int new_pmap_height = target_height; |
757 | int new_pmap_height = target_height; |
743 | |
758 | |
744 | int x = 0; |
759 | int x = 0; |
745 | int y = 0; |
760 | int y = 0; |
746 | int w = h_scale * target_width / 100; |
761 | int w = 0; |
747 | int h = v_scale * target_height / 100; |
762 | int h = 0; |
748 | |
763 | |
749 | if (h_align == rootAlign || v_align == rootAlign) |
764 | 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 | |
765 | |
762 | if (x >= target_width |
766 | if (x >= target_width |
763 | || y >= target_height |
767 | || y >= target_height |
764 | || (w > 0 && x + w <= 0) |
768 | || (w > 0 && x + w <= 0) |
765 | || (h > 0 && y + h <= 0)) |
769 | || (h > 0 && y + h <= 0)) |