src/macosx/classes/sun/lwawt/LWComponentPeer.java

Print this page

        

@@ -461,39 +461,12 @@
 
     }
 
     private void applyConstrain(final Graphics g) {
         final SunGraphics2D sg2d = (SunGraphics2D) g;
-        final Rectangle constr = localToWindow(getSize());
-        // translate and set rectangle constrain.
-        sg2d.constrain(constr.x, constr.y, constr.width, constr.height);
-        // set region constrain.
-        //sg2d.constrain(getVisibleRegion());
-        SG2DConstraint(sg2d, getVisibleRegion());
-    }
-
-    //TODO Move this method to SG2D?
-    void SG2DConstraint(final SunGraphics2D sg2d, Region r) {
-        sg2d.constrainX = sg2d.transX;
-        sg2d.constrainY = sg2d.transY;
-
-        Region c = sg2d.constrainClip;
-        if ((sg2d.constrainX | sg2d.constrainY) != 0) {
-            r = r.getTranslatedRegion(sg2d.constrainX, sg2d.constrainY);
-        }
-        if (c == null) {
-            c = r;
-        } else {
-            c = c.getIntersection(r);
-            if (c == sg2d.constrainClip) {
-                // Common case to ignore
-                return;
-            }
-        }
-        sg2d.constrainClip = c;
-        //validateCompClip() forced call.
-        sg2d.setDevClip(r.getLoX(), r.getLoY(), r.getWidth(), r.getHeight());
+        final Rectangle size = localToWindow(getSize());
+        sg2d.constrain(size.x, size.y, size.width, size.height, getVisibleRegion());
     }
 
     public Region getVisibleRegion() {
         return computeVisibleRect(this, getRegion());
     }