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.59 by sf-exg, Wed Sep 8 22:17:06 2010 UTC vs.
Revision 1.62 by sf-exg, Sun Oct 3 21:44:13 2010 UTC

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;
247make_clip_rectangle (int pos, int size, int target_size, int &dst_pos, int &dst_size) 246make_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)
388 w = h = noScale; 387 w = h = noScale;
389 geom_flags |= WidthValue|HeightValue; 388 geom_flags |= WidthValue|HeightValue;
390 } 389 }
391 else if (CHECK_GEOM_OPS ("propscale")) 390 else if (CHECK_GEOM_OPS ("propscale"))
392 { 391 {
393 if (w == 0 && h == 0)
394 {
395 w = windowScale;
396 geom_flags |= WidthValue;
397 }
398 new_flags |= propScale; 392 new_flags |= propScale;
399 } 393 }
400 else if (CHECK_GEOM_OPS ("hscale")) 394 else if (CHECK_GEOM_OPS ("hscale"))
401 { 395 {
402 if (w == 0) w = windowScale; 396 if (w == 0) w = windowScale;
457bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) 451bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y)
458{ 452{
459 int target_width = target->szHint.width; 453 int target_width = target->szHint.width;
460 int target_height = target->szHint.height; 454 int target_height = target->szHint.height;
461 455
456 if (flags & propScale)
457 {
458 float scale = (float)target_width / image_width;
459 min_it (scale, (float)target_height / image_height);
460 w = image_width * scale + 0.5;
461 h = image_height * scale + 0.5;
462 }
463 else
464 {
462 w = h_scale * target_width / 100; 465 w = h_scale * target_width / 100;
463 h = v_scale * target_height / 100; 466 h = v_scale * target_height / 100;
467 }
464 468
465 if (h_align == rootAlign || v_align == rootAlign) 469 if (h_align == rootAlign || v_align == rootAlign)
466 { 470 {
467 target->get_window_origin (x, y); 471 target->get_window_origin (x, y);
468 x = -x; 472 x = -x;
472 if (h_align != rootAlign) 476 if (h_align != rootAlign)
473 x = make_align_position (h_align, target_width, w > 0 ? w : image_width); 477 x = make_align_position (h_align, target_width, w > 0 ? w : image_width);
474 478
475 if (v_align != rootAlign) 479 if (v_align != rootAlign)
476 y = make_align_position (v_align, target_height, h > 0 ? h : image_height); 480 y = make_align_position (v_align, target_height, h > 0 ? h : image_height);
481
482 flags &= ~sizeSensitive;
483 if (h_scale != 0 || v_scale != 0
484 || h_align != 0 || v_align != 0
485 || image_width > target_width || image_height > target_height)
486 flags |= sizeSensitive;
477} 487}
478 488
479# ifdef HAVE_AFTERIMAGE 489# ifdef HAVE_AFTERIMAGE
480bool 490bool
481bgPixmap_t::render_image (unsigned long background_flags) 491bgPixmap_t::render_image (unsigned long background_flags)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines