diff options
author | Servaas Vandenberghe <vdb128@picaros.org> | 2011-02-13 15:51:09 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:32:22 -0400 |
commit | 6188a0f151204d6f895822e8c0059b8951879a42 (patch) | |
tree | ff8c4847220a215f0415868eb0be82837eb8c636 | |
parent | 35fa5d4c48fbb02d637c3659f00331aa33f0f029 (diff) |
[media] pvrusb2: width and height maximum values
pvrusb2: The origin of the capability bounds rectangle may differ from
(left=0,top=0) so the calculation should use absolute coordinates,
here below, or use relative coordinates like
cropl_val-cap->bounds.left and cropt_val-cap->bounds.top.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 5e6437dd91df..48859370c57b 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -499,31 +499,35 @@ static int ctrl_cropt_max_get(struct pvr2_ctrl *cptr, int *top) | |||
499 | return 0; | 499 | return 0; |
500 | } | 500 | } |
501 | 501 | ||
502 | static int ctrl_cropw_max_get(struct pvr2_ctrl *cptr, int *val) | 502 | static int ctrl_cropw_max_get(struct pvr2_ctrl *cptr, int *width) |
503 | { | 503 | { |
504 | struct v4l2_cropcap *cap = &cptr->hdw->cropcap_info; | 504 | struct v4l2_cropcap *cap = &cptr->hdw->cropcap_info; |
505 | int stat = pvr2_hdw_check_cropcap(cptr->hdw); | 505 | int stat, bleftend, cleft; |
506 | |||
507 | stat = pvr2_hdw_check_cropcap(cptr->hdw); | ||
506 | if (stat != 0) { | 508 | if (stat != 0) { |
507 | return stat; | 509 | return stat; |
508 | } | 510 | } |
509 | *val = 0; | 511 | bleftend = cap->bounds.left+cap->bounds.width; |
510 | if (cap->bounds.width > cptr->hdw->cropl_val) { | 512 | cleft = cptr->hdw->cropl_val; |
511 | *val = cap->bounds.width - cptr->hdw->cropl_val; | 513 | |
512 | } | 514 | *width = cleft < bleftend ? bleftend-cleft : 0; |
513 | return 0; | 515 | return 0; |
514 | } | 516 | } |
515 | 517 | ||
516 | static int ctrl_croph_max_get(struct pvr2_ctrl *cptr, int *val) | 518 | static int ctrl_croph_max_get(struct pvr2_ctrl *cptr, int *height) |
517 | { | 519 | { |
518 | struct v4l2_cropcap *cap = &cptr->hdw->cropcap_info; | 520 | struct v4l2_cropcap *cap = &cptr->hdw->cropcap_info; |
519 | int stat = pvr2_hdw_check_cropcap(cptr->hdw); | 521 | int stat, btopend, ctop; |
522 | |||
523 | stat = pvr2_hdw_check_cropcap(cptr->hdw); | ||
520 | if (stat != 0) { | 524 | if (stat != 0) { |
521 | return stat; | 525 | return stat; |
522 | } | 526 | } |
523 | *val = 0; | 527 | btopend = cap->bounds.top+cap->bounds.height; |
524 | if (cap->bounds.height > cptr->hdw->cropt_val) { | 528 | ctop = cptr->hdw->cropt_val; |
525 | *val = cap->bounds.height - cptr->hdw->cropt_val; | 529 | |
526 | } | 530 | *height = ctop < btopend ? btopend-ctop : 0; |
527 | return 0; | 531 | return 0; |
528 | } | 532 | } |
529 | 533 | ||