changeset 2886:ad5cee5bfad6

Fixed RT-28939: ScrollBar arrows are rendering with unexpected antialising
author "Jasper Potts"
date Tue, 12 Mar 2013 12:07:14 -0700
parents c9d36dae8a70
children 70612d9f2f28
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollBarSkin.java
diffstat 1 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollBarSkin.java	Tue Mar 12 14:04:23 2013 -0400
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollBarSkin.java	Tue Mar 12 12:07:14 2013 -0700
@@ -586,17 +586,14 @@
 
         @Override protected void layoutChildren() {
             final Insets insets = getInsets();
-            final double top = insets.getTop();
-            final double left = insets.getLeft();
-            final double bottom = insets.getBottom();
-            final double right = insets.getRight();
-            
-            double aw = arrow.prefWidth(-1);
-            double ah = arrow.prefHeight(-1);
-            
-            double yPos = (getHeight() - (top + bottom + ah)) / 2.0;
-            double xPos = (getWidth() - (left + right + aw)) / 2.0;
-
+            final double top = snapSize(insets.getTop());
+            final double left = snapSize(insets.getLeft());
+            final double bottom = snapSize(insets.getBottom());
+            final double right = snapSize(insets.getRight());
+            final double aw = snapSize(arrow.prefWidth(-1));
+            final double ah = snapSize(arrow.prefHeight(-1));
+            final double yPos = snapPosition((getHeight() - (top + bottom + ah)) / 2.0);
+            final double xPos = snapPosition((getWidth() - (left + right + aw)) / 2.0);
             arrow.resizeRelocate(xPos + left, yPos + top, aw, ah);
         }
 
@@ -609,11 +606,19 @@
         }
 
         @Override protected double computePrefWidth(double height) {
-            return arrow.prefWidth(height) + getInsets().getLeft() + getInsets().getRight();
+            final Insets insets = getInsets();
+            final double left = snapSize(insets.getLeft());
+            final double right = snapSize(insets.getRight());
+            final double aw = snapSize(arrow.prefWidth(-1));
+            return left + aw + right;
         }
         
         @Override protected double computePrefHeight(double width) {
-            return arrow.prefHeight(width) + getInsets().getTop() + getInsets().getBottom();
+            final Insets insets = getInsets();
+            final double top = snapSize(insets.getTop());
+            final double bottom = snapSize(insets.getBottom());
+            final double ah = snapSize(arrow.prefHeight(-1));
+            return top + ah + bottom;
         }
     }
 }