[classlib][swing] Slider code is probably uneffective
-----------------------------------------------------
Key: HARMONY-4481
URL: https://issues.apache.org/jira/browse/HARMONY-4481
Project: Harmony
Issue Type: Improvement
Components: Classlib
Reporter: Dmitry Irlyanov
Priority: Trivial
JSlider code is quite uneffective.
Let's see for example the following function:
protected void calculateTrackBuffer() {
if (slider.getPaintLabels()) {
if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
? getWidthOfHighValueLabel() / 2
: getWidthOfLowValueLabel() / 2;
/**skipped**/
}
it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel()
twice:
protected int getWidthOfHighValueLabel() {
return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
}
Of course, without performance test results it's nothing. But performance test results definitely
won't become worse if my patch have been applied.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|