[seam-issues] [JBoss JIRA] Commented: (JBSEAM-4833) Erroneous integer divisions in Image.scaleToFit()

Marek Novotny (JIRA) jira-events at lists.jboss.org
Mon Aug 8 07:34:24 EDT 2011


    [ https://issues.jboss.org/browse/JBSEAM-4833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619334#comment-12619334 ] 

Marek Novotny commented on JBSEAM-4833:
---------------------------------------

I looked at the org.jboss.seam.ui.graphicImage.Image source and you're right, divisions of integers should be fixed by casting one operand in that method. 
Something like:

float hratio = (float) height/getHeight();
float wratio = (float) width/getWidth();

> Erroneous integer divisions in Image.scaleToFit()
> -------------------------------------------------
>
>                 Key: JBSEAM-4833
>                 URL: https://issues.jboss.org/browse/JBSEAM-4833
>             Project: Seam 2
>          Issue Type: Bug
>          Components: JSF Controls
>    Affects Versions: 2.2.0.GA
>            Reporter: Nicholas Oxhøj
>            Priority: Minor
>             Fix For: 2.3.0.ALPHA
>
>
> org.jboss.seam.ui.graphicImage.Image.scaleToFit(int height, int width) will most of the time just scale to the specified width, because it contains an error. The
> ratios are calculated using integer division and will most likely both be 0.
> Instead of
>   float hratio = height/getHeight();
>   float wratio = width/getWidth();
> it should be
>   float hratio = (float) height/image.getHeight();
>   float wratio = (float) width/image.getWidth();

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the seam-issues mailing list