| 608 | | /* Force cropping if requested */ |
|---|
| 609 | | if( p_spu->b_force_crop ) |
|---|
| 610 | | { |
|---|
| 611 | | video_format_t *p_fmt = &p_spu->p_blend->fmt_in.video; |
|---|
| 612 | | |
|---|
| 613 | | /* Find the intersection */ |
|---|
| 614 | | if( p_spu->i_crop_x + p_spu->i_crop_width <= i_x_offset || |
|---|
| 615 | | i_x_offset + (int)p_fmt->i_visible_width < |
|---|
| 616 | | p_spu->i_crop_x || |
|---|
| 617 | | p_spu->i_crop_y + p_spu->i_crop_height <= i_y_offset || |
|---|
| 618 | | i_y_offset + (int)p_fmt->i_visible_height < |
|---|
| 619 | | p_spu->i_crop_y ) |
|---|
| 620 | | { |
|---|
| 621 | | /* No intersection */ |
|---|
| 622 | | p_fmt->i_visible_width = p_fmt->i_visible_height = 0; |
|---|
| 623 | | } |
|---|
| 624 | | else |
|---|
| 625 | | { |
|---|
| 626 | | int i_x, i_y, i_x_end, i_y_end; |
|---|
| 627 | | i_x = __MAX( p_spu->i_crop_x, i_x_offset ); |
|---|
| 628 | | i_y = __MAX( p_spu->i_crop_y, i_y_offset ); |
|---|
| 629 | | i_x_end = __MIN( p_spu->i_crop_x + p_spu->i_crop_width, |
|---|
| 630 | | i_x_offset + (int)p_fmt->i_visible_width ); |
|---|
| 631 | | i_y_end = __MIN( p_spu->i_crop_y + p_spu->i_crop_height, |
|---|
| 632 | | i_y_offset + (int)p_fmt->i_visible_height ); |
|---|
| 633 | | |
|---|
| 634 | | p_fmt->i_x_offset = i_x - i_x_offset; |
|---|
| 635 | | p_fmt->i_y_offset = i_y - i_y_offset; |
|---|
| 636 | | p_fmt->i_visible_width = i_x_end - i_x; |
|---|
| 637 | | p_fmt->i_visible_height = i_y_end - i_y; |
|---|
| 638 | | |
|---|
| 639 | | i_x_offset = i_x; |
|---|
| 640 | | i_y_offset = i_y; |
|---|
| 641 | | } |
|---|
| 642 | | } |
|---|
| 643 | | |
|---|
| 646 | | p_spu->p_blend->fmt_in.video.i_chroma ) |
|---|
| 647 | | { |
|---|
| 648 | | p_spu->p_blend->fmt_in.video.p_palette->palette[0][3] = |
|---|
| 649 | | p_spu->pi_alpha[0]; |
|---|
| 650 | | p_spu->p_blend->fmt_in.video.p_palette->palette[1][3] = |
|---|
| 651 | | p_spu->pi_alpha[1]; |
|---|
| 652 | | p_spu->p_blend->fmt_in.video.p_palette->palette[2][3] = |
|---|
| 653 | | p_spu->pi_alpha[2]; |
|---|
| 654 | | p_spu->p_blend->fmt_in.video.p_palette->palette[3][3] = |
|---|
| 655 | | p_spu->pi_alpha[3]; |
|---|
| | 610 | p_region->fmt.i_chroma ) |
|---|
| | 611 | { |
|---|
| | 612 | p_region->fmt.p_palette->palette[0][3] = p_spu->pi_alpha[0]; |
|---|
| | 613 | p_region->fmt.p_palette->palette[1][3] = p_spu->pi_alpha[1]; |
|---|
| | 614 | p_region->fmt.p_palette->palette[2][3] = p_spu->pi_alpha[2]; |
|---|
| | 615 | p_region->fmt.p_palette->palette[3][3] = p_spu->pi_alpha[3]; |
|---|
| | 683 | |
|---|
| | 684 | /* Force cropping if requested */ |
|---|
| | 685 | if( p_spu->b_force_crop ) |
|---|
| | 686 | { |
|---|
| | 687 | video_format_t *p_fmt = &p_spu->p_blend->fmt_in.video; |
|---|
| | 688 | int i_crop_x = p_spu->i_crop_x * i_scale_width / 1000; |
|---|
| | 689 | int i_crop_y = p_spu->i_crop_y * i_scale_height / 1000; |
|---|
| | 690 | int i_crop_width = p_spu->i_crop_width * i_scale_width / 1000; |
|---|
| | 691 | int i_crop_height = p_spu->i_crop_height * i_scale_height/1000; |
|---|
| | 692 | |
|---|
| | 693 | /* Find the intersection */ |
|---|
| | 694 | if( i_crop_x + i_crop_width <= i_x_offset || |
|---|
| | 695 | i_x_offset + (int)p_fmt->i_visible_width < i_crop_x || |
|---|
| | 696 | i_crop_y + i_crop_height <= i_y_offset || |
|---|
| | 697 | i_y_offset + (int)p_fmt->i_visible_height < i_crop_y ) |
|---|
| | 698 | { |
|---|
| | 699 | /* No intersection */ |
|---|
| | 700 | p_fmt->i_visible_width = p_fmt->i_visible_height = 0; |
|---|
| | 701 | } |
|---|
| | 702 | else |
|---|
| | 703 | { |
|---|
| | 704 | int i_x, i_y, i_x_end, i_y_end; |
|---|
| | 705 | i_x = __MAX( i_crop_x, i_x_offset ); |
|---|
| | 706 | i_y = __MAX( i_crop_y, i_y_offset ); |
|---|
| | 707 | i_x_end = __MIN( i_crop_x + i_crop_width, |
|---|
| | 708 | i_x_offset + (int)p_fmt->i_visible_width ); |
|---|
| | 709 | i_y_end = __MIN( i_crop_y + i_crop_height, |
|---|
| | 710 | i_y_offset + (int)p_fmt->i_visible_height ); |
|---|
| | 711 | |
|---|
| | 712 | p_fmt->i_x_offset = i_x - i_x_offset; |
|---|
| | 713 | p_fmt->i_y_offset = i_y - i_y_offset; |
|---|
| | 714 | p_fmt->i_visible_width = i_x_end - i_x; |
|---|
| | 715 | p_fmt->i_visible_height = i_y_end - i_y; |
|---|
| | 716 | |
|---|
| | 717 | i_x_offset = i_x; |
|---|
| | 718 | i_y_offset = i_y; |
|---|
| | 719 | } |
|---|
| | 720 | } |
|---|