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.203 by sf-exg, Tue Apr 10 15:08:47 2012 UTC vs.
Revision 1.206 by sf-exg, Thu Apr 12 10:22:50 2012 UTC

123 123
124# ifdef BG_IMAGE_FROM_FILE 124# ifdef BG_IMAGE_FROM_FILE
125static inline int 125static inline int
126make_align_position (int align, int window_size, int image_size) 126make_align_position (int align, int window_size, int image_size)
127{ 127{
128 int diff = window_size - image_size;
129 int smaller = min (image_size, window_size);
130
131 if (align >= 0 && align <= 100) 128 if (align >= 0 && align <= 100)
132 return diff * align / 100; 129 return lerp (0, window_size - image_size, align);
133 else if (align > 100 && align <= 200) 130 else if (align > 100)
134 return (align - 100) * smaller / 100 + window_size - smaller; 131 return lerp (window_size - image_size, window_size, align - 100);
135 else if (align >= -100 && align < 0) 132 else
136 return (align + 100) * smaller / 100 - image_size; 133 return lerp (-image_size, 0, align + 100);
137 return 0;
138} 134}
139 135
140static inline int 136static inline int
141make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) 137make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size)
142{ 138{
334 { 330 {
335 x = make_align_position (h_align, target_width, w); 331 x = make_align_position (h_align, target_width, w);
336 y = make_align_position (v_align, target_height, h); 332 y = make_align_position (v_align, target_height, h);
337 } 333 }
338 334
339 bg_flags &= ~BG_IS_SIZE_SENSITIVE;
340 if (!(bg_flags & BG_TILE) 335 if (!(bg_flags & BG_TILE)
341 || h_scale || v_scale 336 || h_scale || v_scale
342 || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align)) 337 || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align))
343 || w > target_width || h > target_height) 338 || image_width > target_width || image_height > target_height)
344 bg_flags |= BG_IS_SIZE_SENSITIVE; 339 bg_flags |= BG_IS_SIZE_SENSITIVE;
340 else
341 bg_flags &= ~BG_IS_SIZE_SENSITIVE;
345} 342}
346 343
347# ifdef HAVE_PIXBUF 344# ifdef HAVE_PIXBUF
348bool 345bool
349rxvt_term::pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, 346rxvt_term::pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc,
675 { 672 {
676 changed = true; 673 changed = true;
677 v_blurRadius = vr; 674 v_blurRadius = vr;
678 } 675 }
679 676
680 if (h_blurRadius == 0 || v_blurRadius == 0) 677 if (h_blurRadius && v_blurRadius)
678 bg_flags |= BG_NEEDS_BLUR;
679 else
681 bg_flags &= ~BG_NEEDS_BLUR; 680 bg_flags &= ~BG_NEEDS_BLUR;
682 else
683 bg_flags |= BG_NEEDS_BLUR;
684 681
685 return changed; 682 return changed;
686} 683}
687 684
688void 685void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines