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.65 by sf-exg, Mon Oct 4 20:45:45 2010 UTC vs.
Revision 1.67 by sf-exg, Mon Oct 4 21:56:42 2010 UTC

226make_align_position (int align, int window_size, int image_size) 226make_align_position (int align, int window_size, int image_size)
227{ 227{
228 int diff = window_size - image_size; 228 int diff = window_size - image_size;
229 int smaller = min (image_size, window_size); 229 int smaller = min (image_size, window_size);
230 230
231 if (align >= 0 && align <= 50) 231 if (align >= 0 && align <= 100)
232 return diff * align / 100; 232 return diff * align / 100;
233 else if (align > 50 && align <= 100)
234 return window_size - image_size - diff * (100 - align) / 100;
235 else if (align > 100 && align <= 200 ) 233 else if (align > 100 && align <= 200 )
236 return ((align - 100) * smaller / 100) + window_size - smaller; 234 return ((align - 100) * smaller / 100) + window_size - smaller;
237 else if (align >= -100 && align < 0) 235 else if (align >= -100 && align < 0)
238 return ((align + 100) * smaller / 100) - image_size; 236 return ((align + 100) * smaller / 100) - image_size;
239 return 0; 237 return 0;
241 239
242static inline int 240static inline int
243make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) 241make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size)
244{ 242{
245 int src_pos = 0; 243 int src_pos = 0;
246 dst_pos = 0; 244 dst_pos = pos;
247 dst_size = size; 245 dst_size = size;
248 if (pos < 0) 246 if (pos < 0)
249 { 247 {
250 src_pos = -pos; 248 src_pos = -pos;
249 dst_pos = 0;
251 dst_size += pos; 250 dst_size += pos;
252 } 251 }
253 else if (pos > 0)
254 dst_pos = pos;
255 252
256 if (dst_pos + dst_size > target_size) 253 if (dst_pos + dst_size > target_size)
257 dst_size = target_size - dst_pos; 254 dst_size = target_size - dst_pos;
258 return src_pos; 255 return src_pos;
259} 256}
542 539
543 if (original_asim) 540 if (original_asim)
544 get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); 541 get_image_geometry (original_asim->width, original_asim->height, w, h, x, y);
545 542
546 if (!original_asim 543 if (!original_asim
544 || (!(flags & rootAlign)
547 || x >= target_width 545 && (x >= target_width
548 || y >= target_height 546 || y >= target_height
549 || (w > 0 && x + w <= 0) 547 || (w > 0 && x + w <= 0)
550 || (h > 0 && y + h <= 0)) 548 || (h > 0 && y + h <= 0))))
551 { 549 {
552 if (background) 550 if (background)
553 { 551 {
554 new_pmap_width = background->width; 552 new_pmap_width = background->width;
555 new_pmap_height = background->height; 553 new_pmap_height = background->height;
762 int w = 0; 760 int w = 0;
763 int h = 0; 761 int h = 0;
764 762
765 get_image_geometry (image_width, image_height, w, h, x, y); 763 get_image_geometry (image_width, image_height, w, h, x, y);
766 764
765 if (!(flags & rootAlign)
767 if (x >= target_width 766 && (x >= target_width
768 || y >= target_height 767 || y >= target_height
769 || (w > 0 && x + w <= 0) 768 || (w > 0 && x + w <= 0)
770 || (h > 0 && y + h <= 0)) 769 || (h > 0 && y + h <= 0)))
771 return false; 770 return false;
772 771
773 result = pixbuf; 772 result = pixbuf;
774 773
775 if ((w > 0 && w != image_width) 774 if ((w > 0 && w != image_width)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines