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.12 by ayin, Thu Nov 15 11:36:15 2007 UTC vs.
Revision 1.13 by sasha, Thu Nov 15 18:40:10 2007 UTC

113} 113}
114 114
115bool 115bool
116bgPixmap_t::window_size_sensitive () 116bgPixmap_t::window_size_sensitive ()
117{ 117{
118# ifdef ENABLE_TRANSPARENCY
119 if (flags & isTransparent)
120 return true;
121# endif
122
118# ifdef BG_IMAGE_FROM_FILE 123# ifdef BG_IMAGE_FROM_FILE
119# ifdef HAVE_AFTERIMAGE 124# ifdef HAVE_AFTERIMAGE
120 if (original_asim != NULL) 125 if (original_asim != NULL)
121# endif 126# endif
122 { 127 {
123 if (h_scale != 0 || v_scale != 0 128 if (h_scale != 0 || v_scale != 0
124 || h_align != 0 || v_align != 0) 129 || h_align != 0 || v_align != 0)
125 return true; 130 return true;
126 } 131 }
127# endif 132# endif
133
134 return false;
135}
136
137bool
138bgPixmap_t::window_position_sensitive ()
139{
128# ifdef ENABLE_TRANSPARENCY 140# ifdef ENABLE_TRANSPARENCY
129 if (flags & isTransparent) 141 if (flags & isTransparent)
130 return true; 142 return true;
131# endif 143# endif
144
145# ifdef BG_IMAGE_FROM_FILE
146# ifdef HAVE_AFTERIMAGE
147 if (original_asim != NULL)
148# endif
149 {
150 if (h_align == rootAlign || v_align == rootAlign)
151 return true;
152 }
153# endif
154
132 return false; 155 return false;
133} 156};
134 157
135bool bgPixmap_t::need_client_side_rendering () 158bool bgPixmap_t::need_client_side_rendering ()
136{ 159{
137# ifdef HAVE_AFTERIMAGE 160# ifdef HAVE_AFTERIMAGE
138 if (original_asim != NULL) 161 if (original_asim != NULL)
172static inline bool 195static inline bool
173check_set_align_value (int geom_flags, int flag, int &align, int new_value) 196check_set_align_value (int geom_flags, int flag, int &align, int new_value)
174{ 197{
175 if (geom_flags & flag) 198 if (geom_flags & flag)
176 { 199 {
200 if (new_value != bgPixmap_t::rootAlign)
201 {
177 if (new_value < -100) 202 if (new_value < -100)
178 new_value = -100; 203 new_value = -100;
179 else if (new_value > 200) 204 else if (new_value > 200)
180 new_value = 200; 205 new_value = 200;
206 }
181 if (new_value != align) 207 if (new_value != align)
182 { 208 {
183 align = new_value; 209 align = new_value;
184 return true; 210 return true;
185 } 211 }
339 { 365 {
340 while (*ops == ':' || isspace(*ops)) ++ops; 366 while (*ops == ':' || isspace(*ops)) ++ops;
341# define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) 367# define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0)
342 if (CHECK_GEOM_OPS("tile")) 368 if (CHECK_GEOM_OPS("tile"))
343 { 369 {
344 w = h = 0; 370 w = h = noScale;
345 geom_flags |= WidthValue|HeightValue; 371 geom_flags |= WidthValue|HeightValue;
346 } 372 }
347 else if (CHECK_GEOM_OPS("propscale")) 373 else if (CHECK_GEOM_OPS("propscale"))
348 { 374 {
349 if (w == 0 && h == 0) 375 if (w == 0 && h == 0)
350 { 376 {
351 w = 100; 377 w = windowScale;
352 geom_flags |= WidthValue; 378 geom_flags |= WidthValue;
353 } 379 }
354 new_flags |= propScale; 380 new_flags |= propScale;
355 } 381 }
356 else if (CHECK_GEOM_OPS("hscale")) 382 else if (CHECK_GEOM_OPS("hscale"))
357 { 383 {
358 if (w == 0) 384 if (w == 0)
359 w = 100; 385 w = windowScale;
360 h = 0; 386 h = noScale;
361 geom_flags |= WidthValue|HeightValue; 387 geom_flags |= WidthValue|HeightValue;
362 } 388 }
363 else if (CHECK_GEOM_OPS("vscale")) 389 else if (CHECK_GEOM_OPS("vscale"))
364 { 390 {
365 if (h == 0) 391 if (h == 0)
366 h = 100; 392 h = windowScale;
367 w = 0; 393 w = noScale;
368 geom_flags |= WidthValue|HeightValue; 394 geom_flags |= WidthValue|HeightValue;
369 } 395 }
370 else if (CHECK_GEOM_OPS("scale")) 396 else if (CHECK_GEOM_OPS("scale"))
371 { 397 {
372 if (h == 0) 398 if (h == 0)
373 h = 100; 399 h = windowScale;
374 if (w == 0) 400 if (w == 0)
375 w = 100; 401 w = windowScale;
376 geom_flags |= WidthValue|HeightValue; 402 geom_flags |= WidthValue|HeightValue;
377 } 403 }
378 else if (CHECK_GEOM_OPS("auto")) 404 else if (CHECK_GEOM_OPS("auto"))
379 { 405 {
406 w = h = windowScale;
407 x = y = centerAlign;
408 geom_flags |= WidthValue|HeightValue|XValue|YValue;
409 }
410 else if (CHECK_GEOM_OPS("root"))
411 {
380 w = h = 100; 412 w = h = noScale;
381 x = y = 50; 413 x = y = rootAlign;
382 geom_flags |= WidthValue|HeightValue|XValue|YValue; 414 geom_flags |= WidthValue|HeightValue|XValue|YValue;
383 } 415 }
384# undef CHECK_GEOM_OPS 416# undef CHECK_GEOM_OPS
385 while (*ops != ':' && *ops != '\0') ++ops; 417 while (*ops != ':' && *ops != '\0') ++ops;
386 } /* done parsing ops */ 418 } /* done parsing ops */
425 457
426 TIMING_TEST_START (asim); 458 TIMING_TEST_START (asim);
427 459
428 if (original_asim) 460 if (original_asim)
429 { 461 {
462 if (h_align == rootAlign || v_align == rootAlign)
463 {
464 target->get_window_origin(x, y);
465 x = -x;
466 y = -y;
467 }
468 if (h_align != rootAlign)
430 x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width); 469 x = make_align_position (h_align, target_width, w > 0 ? w : (int)original_asim->width);
470 if (v_align != rootAlign)
431 y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height); 471 y = make_align_position (v_align, target_height, h > 0 ? h : (int)original_asim->height);
432 } 472 }
433 473
434 if (original_asim == NULL 474 if (original_asim == NULL
435 || x >= target_width 475 || x >= target_width
436 || y >= target_height 476 || y >= target_height
465 h > 0 ? h : original_asim->height, 505 h > 0 ? h : original_asim->height,
466 background ? ASA_ASImage : ASA_XImage, 506 background ? ASA_ASImage : ASA_XImage,
467 100, ASIMAGE_QUALITY_DEFAULT); 507 100, ASIMAGE_QUALITY_DEFAULT);
468 } 508 }
469 if (background == NULL) 509 if (background == NULL)
470 {/* if tiling - pixmap has to be sized exactly as the image */ 510 {/* if tiling - pixmap has to be sized exactly as the image,
511 but there is no need to make it bigger then the window! */
471 if (h_scale == 0) 512 if (h_scale == 0)
472 new_pmap_width = result->width; 513 new_pmap_width = min (result->width, target_width);
473 if (v_scale == 0) 514 if (v_scale == 0)
474 new_pmap_height = result->height; 515 new_pmap_height = min (result->height, target_height);
475 /* we also need to tile our image in one or both directions */ 516 /* we also need to tile our image in one or both directions */
476 if (h_scale == 0 || v_scale == 0) 517 if (h_scale == 0 || v_scale == 0)
477 { 518 {
478 ASImage *tmp = tile_asimage (target->asv, result, 519 ASImage *tmp = tile_asimage (target->asv, result,
479 (h_scale > 0) ? 0 : (int)result->width - x, 520 (h_scale > 0) ? 0 : (int)result->width - x,
480 (v_scale > 0) ? 0 : (int)result->height - y, 521 (v_scale > 0) ? 0 : (int)result->height - y,
522 new_pmap_width,
481 result->width, result->height, 523 new_pmap_height,
482 TINT_LEAVE_SAME, ASA_XImage, 524 TINT_LEAVE_SAME, ASA_XImage,
483 100, ASIMAGE_QUALITY_DEFAULT); 525 100, ASIMAGE_QUALITY_DEFAULT);
484 if (tmp) 526 if (tmp)
485 { 527 {
486 if (result != original_asim) 528 if (result != original_asim)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines