< prev index next >

src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java

Print this page


   1 /*
   2  * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1898     protected void validateCompClip() {
1899         int origClipState = clipState;
1900         if (usrClip == null) {
1901             clipState = CLIP_DEVICE;
1902             clipRegion = devClip;
1903         } else if (usrClip instanceof Rectangle2D) {
1904             clipState = CLIP_RECTANGULAR;
1905             if (usrClip instanceof Rectangle) {
1906                 clipRegion = devClip.getIntersection((Rectangle)usrClip);
1907             } else {
1908                 clipRegion = devClip.getIntersection(usrClip.getBounds());
1909             }
1910         } else {
1911             PathIterator cpi = usrClip.getPathIterator(null);
1912             int box[] = new int[4];
1913             ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
1914             try {
1915                 sr.setOutputArea(devClip);
1916                 sr.appendPath(cpi);
1917                 sr.getPathBox(box);
1918                 Region r = Region.getInstance(box);
1919                 r.appendSpans(sr);
1920                 clipRegion = r;
1921                 clipState =
1922                     r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
1923             } finally {
1924                 sr.dispose();
1925             }
1926         }
1927         if (origClipState != clipState &&
1928             (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
1929         {
1930             validFontInfo = false;
1931             invalidatePipe();
1932         }
1933     }
1934 
1935     static final int NON_RECTILINEAR_TRANSFORM_MASK =
1936         (AffineTransform.TYPE_GENERAL_TRANSFORM |
1937          AffineTransform.TYPE_GENERAL_ROTATION);
1938 
1939     protected Shape transformShape(Shape s) {


   1 /*
   2  * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


1898     protected void validateCompClip() {
1899         int origClipState = clipState;
1900         if (usrClip == null) {
1901             clipState = CLIP_DEVICE;
1902             clipRegion = devClip;
1903         } else if (usrClip instanceof Rectangle2D) {
1904             clipState = CLIP_RECTANGULAR;
1905             if (usrClip instanceof Rectangle) {
1906                 clipRegion = devClip.getIntersection((Rectangle)usrClip);
1907             } else {
1908                 clipRegion = devClip.getIntersection(usrClip.getBounds());
1909             }
1910         } else {
1911             PathIterator cpi = usrClip.getPathIterator(null);
1912             int box[] = new int[4];
1913             ShapeSpanIterator sr = LoopPipe.getFillSSI(this);
1914             try {
1915                 sr.setOutputArea(devClip);
1916                 sr.appendPath(cpi);
1917                 sr.getPathBox(box);
1918                 Region r = Region.getInstance(box, sr);

1919                 clipRegion = r;
1920                 clipState =
1921                     r.isRectangular() ? CLIP_RECTANGULAR : CLIP_SHAPE;
1922             } finally {
1923                 sr.dispose();
1924             }
1925         }
1926         if (origClipState != clipState &&
1927             (clipState == CLIP_SHAPE || origClipState == CLIP_SHAPE))
1928         {
1929             validFontInfo = false;
1930             invalidatePipe();
1931         }
1932     }
1933 
1934     static final int NON_RECTILINEAR_TRANSFORM_MASK =
1935         (AffineTransform.TYPE_GENERAL_TRANSFORM |
1936          AffineTransform.TYPE_GENERAL_ROTATION);
1937 
1938     protected Shape transformShape(Shape s) {


< prev index next >