[ 
https://issues.apache.org/jira/browse/PIVOT-633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908975#action_12908975
 ] 

Greg Brown edited comment on PIVOT-633 at 9/13/10 8:31 PM:
-----------------------------------------------------------

The problem is that these methods (presumably due to their reliance on integer 
values rather than floats) tend to produce rounding errors that affect 
presentation during scaling. When using the Java2D primitives, this is not an 
issue. Also, the GraphicUtilities methods can't be used to draw rounded 
rectangles, which we now use more heavily (specifically, in buttons).

It might be worth re-evaluating the performance of the Java2D primitives. As I 
recall, you did that benchmarking a while ago - it would be good to see some 
current numbers using more recent JDK releases.

It is also worth considering how often these methods are currently called. Does 
drawing straight lines and squared rectangles constitute a significant bulk of 
our rendering time, or is it other operations - for example, fills (especially 
gradients) and text, or drop shadow decorators? Those calls are likely to be 
heavier, and won't be affected by scaling, whereas line drawing will be.


      was (Author: gbrown):
    The problem is that these methods (presumably due to their reliance on 
integer values rather than floats) tend to produce rounding errors that affect 
presentation during scaling. When using the Java2D primitives, this is not an 
issue. Also, the GraphicUtilities methods can't be used to draw rounded 
rectangles, which we now use more heavily (specifically, in buttons).

It might be worth re-evaluating the performance of the Java2D primitives. As I 
recall, you did that benchmarking a while ago - it would be good to see some 
current numbers using more recent JDK releases.

It is also worth considering how often these methods are currently called. Is 
it still often enough that it will have a noticeable impact on performance? Is 
it enough to justify the existence of rendering inconsistencies when scaling?

  
> Eliminate use of GraphicsUtilities.drawRect() and drawLine()
> ------------------------------------------------------------
>
>                 Key: PIVOT-633
>                 URL: https://issues.apache.org/jira/browse/PIVOT-633
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk
>            Reporter: Greg Brown
>            Priority: Minor
>             Fix For: 2.0
>
>
> These methods were originally created to provide better rendering behavior 
> than the corresponding java.awt.Graphics#drawRect() and drawLine() classes. 
> However, a better approach is to call Graphics2D#draw() with a Rectangle2D or 
> a Line2D. This produces much better results when the display is scaled, since 
> these primitives use true floating point values.
> A number of components including most buttons have already been updated to 
> use the java.awt.geom classes, but many skins are still using 
> GraphicsUtilities and should also be updated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to