https://issues.apache.org/bugzilla/show_bug.cgi?id=46197

           Summary: rounding bugs in HSSFPicture.getPreferredSize
           Product: POI
           Version: 3.2-FINAL
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


In HSSFPicture.getPreferredSize().  This line:

 h += (1 - anchor.dy1/256)* getRowHeightInPixels(anchor.row1);

doesn't work right.  It computes (1 - anchor.dy1/256) as an integer before
applying it as a fraction to getRowHeightInPixels.  So you always get h
incremented by 1 full row height (anchor.dy/256 evaluates to 0).  It works if I
change it to:

 h += ((float)1 - (float)anchor.dy1/256)* getRowHeightInPixels(anchor.row1);

Same problem with the code to apply an initial x-offset to the image width:

 //space in the leftmost cell
 w += getColumnWidthInPixels(anchor.col1)*(1 - anchor.dx1/1024);

should be:
 w += getColumnWidthInPixels(anchor.col1)*((float)1 - (float)anchor.dx1/1024);


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to