… | |
… | |
370 | if (ops) |
370 | if (ops) |
371 | { |
371 | { |
372 | while (*ops) |
372 | while (*ops) |
373 | { |
373 | { |
374 | while (*ops == ':' || isspace(*ops)) ++ops; |
374 | while (*ops == ':' || isspace(*ops)) ++ops; |
|
|
375 | |
375 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof(op_str)-1) == 0) |
376 | # define CHECK_GEOM_OPS(op_str) (strncasecmp (ops, (op_str), sizeof (op_str) - 1) == 0) |
376 | if (CHECK_GEOM_OPS("tile")) |
377 | if (CHECK_GEOM_OPS ("tile")) |
377 | { |
378 | { |
378 | w = h = noScale; |
379 | w = h = noScale; |
379 | geom_flags |= WidthValue|HeightValue; |
380 | geom_flags |= WidthValue|HeightValue; |
380 | } |
381 | } |
381 | else if (CHECK_GEOM_OPS("propscale")) |
382 | else if (CHECK_GEOM_OPS ("propscale")) |
382 | { |
383 | { |
383 | if (w == 0 && h == 0) |
384 | if (w == 0 && h == 0) |
384 | { |
385 | { |
385 | w = windowScale; |
386 | w = windowScale; |
386 | geom_flags |= WidthValue; |
387 | geom_flags |= WidthValue; |
387 | } |
388 | } |
388 | new_flags |= propScale; |
389 | new_flags |= propScale; |
389 | } |
390 | } |
390 | else if (CHECK_GEOM_OPS("hscale")) |
391 | else if (CHECK_GEOM_OPS ("hscale")) |
391 | { |
392 | { |
392 | if (w == 0) |
|
|
393 | w = windowScale; |
393 | if (w == 0) w = windowScale; |
|
|
394 | |
394 | h = noScale; |
395 | h = noScale; |
395 | geom_flags |= WidthValue|HeightValue; |
396 | geom_flags |= WidthValue|HeightValue; |
396 | } |
397 | } |
397 | else if (CHECK_GEOM_OPS("vscale")) |
398 | else if (CHECK_GEOM_OPS ("vscale")) |
398 | { |
399 | { |
399 | if (h == 0) |
|
|
400 | h = windowScale; |
400 | if (h == 0) h = windowScale; |
|
|
401 | |
401 | w = noScale; |
402 | w = noScale; |
402 | geom_flags |= WidthValue|HeightValue; |
403 | geom_flags |= WidthValue|HeightValue; |
403 | } |
404 | } |
404 | else if (CHECK_GEOM_OPS("scale")) |
405 | else if (CHECK_GEOM_OPS ("scale")) |
405 | { |
406 | { |
406 | if (h == 0) |
|
|
407 | h = windowScale; |
407 | if (h == 0) h = windowScale; |
408 | if (w == 0) |
|
|
409 | w = windowScale; |
408 | if (w == 0) w = windowScale; |
|
|
409 | |
410 | geom_flags |= WidthValue|HeightValue; |
410 | geom_flags |= WidthValue|HeightValue; |
411 | } |
411 | } |
412 | else if (CHECK_GEOM_OPS("auto")) |
412 | else if (CHECK_GEOM_OPS ("auto")) |
413 | { |
413 | { |
414 | w = h = windowScale; |
414 | w = h = windowScale; |
415 | x = y = centerAlign; |
415 | x = y = centerAlign; |
416 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
416 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
417 | } |
417 | } |
418 | else if (CHECK_GEOM_OPS("root")) |
418 | else if (CHECK_GEOM_OPS ("root")) |
419 | { |
419 | { |
420 | w = h = noScale; |
420 | w = h = noScale; |
421 | x = y = rootAlign; |
421 | x = y = rootAlign; |
422 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
422 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
423 | } |
423 | } |
424 | # undef CHECK_GEOM_OPS |
424 | # undef CHECK_GEOM_OPS |
|
|
425 | |
425 | while (*ops != ':' && *ops != '\0') ++ops; |
426 | while (*ops != ':' && *ops != '\0') ++ops; |
426 | } /* done parsing ops */ |
427 | } /* done parsing ops */ |
427 | } |
428 | } |
428 | |
429 | |
429 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) |
430 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) ++changed; |
430 | ++changed; |
|
|
431 | if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) |
431 | if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) ++changed; |
432 | ++changed; |
|
|
433 | if (check_set_align_value (geom_flags, XValue, h_align, x)) |
432 | if (check_set_align_value (geom_flags, XValue, h_align, x)) ++changed; |
434 | ++changed; |
|
|
435 | if (check_set_align_value (geom_flags, YValue, v_align, y)) |
433 | if (check_set_align_value (geom_flags, YValue, v_align, y)) ++changed; |
436 | ++changed; |
|
|
437 | } |
434 | } |
438 | |
435 | |
439 | if (new_flags != flags) |
436 | if (new_flags != flags) |
440 | { |
437 | { |
441 | flags = new_flags; |
438 | flags = new_flags; |
442 | changed++; |
439 | changed++; |
443 | } |
440 | } |
|
|
441 | |
444 | //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
442 | //fprintf (stderr, "flags = %lX, scale = %ux%u, align=%+d%+d\n", |
445 | // flags, h_scale, v_scale, h_align, v_align); |
443 | // flags, h_scale, v_scale, h_align, v_align); |
446 | return (changed > 0); |
444 | return (changed > 0); |
447 | } |
445 | } |
448 | |
446 | |
… | |
… | |
638 | |
636 | |
639 | int src_x = 0, src_y = 0, dst_x = 0, dst_y = 0; |
637 | int src_x = 0, src_y = 0, dst_x = 0, dst_y = 0; |
640 | int dst_width = result->width, dst_height = result->height; |
638 | int dst_width = result->width, dst_height = result->height; |
641 | if (background == NULL) |
639 | if (background == NULL) |
642 | { |
640 | { |
643 | if (h_scale > 0) |
|
|
644 | src_x = make_clip_rectangle (x, result->width, new_pmap_width, dst_x, dst_width); |
641 | if (h_scale > 0) src_x = make_clip_rectangle (x, result->width , new_pmap_width , dst_x, dst_width ); |
645 | if (v_scale > 0) |
|
|
646 | src_y = make_clip_rectangle (y, result->height, new_pmap_height, dst_y, dst_height); |
642 | if (v_scale > 0) src_y = make_clip_rectangle (y, result->height, new_pmap_height, dst_y, dst_height); |
647 | |
643 | |
648 | if (dst_x > 0 || dst_y > 0 |
644 | if (dst_x > 0 || dst_y > 0 |
649 | || dst_x + dst_width < new_pmap_width |
645 | || dst_x + dst_width < new_pmap_width |
650 | || dst_y + dst_height < new_pmap_height) |
646 | || dst_y + dst_height < new_pmap_height) |
651 | { |
|
|
652 | XFillRectangle (target->dpy, pixmap, gc, 0, 0, new_pmap_width, new_pmap_height); |
647 | XFillRectangle (target->dpy, pixmap, gc, 0, 0, new_pmap_width, new_pmap_height); |
653 | } |
|
|
654 | } |
648 | } |
655 | |
649 | |
656 | /* put result on pixmap */ |
650 | /* put result on pixmap */ |
657 | if (dst_x < new_pmap_width && dst_y < new_pmap_height) |
651 | if (dst_x < new_pmap_width && dst_y < new_pmap_height) |
658 | asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |
652 | asimage2drawable (target->asv, pixmap, result, gc, src_x, src_y, dst_x, dst_y, dst_width, dst_height, True); |