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.66 by sf-exg, Mon Oct 4 20:46:20 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}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines