diff --git a/jdk/src/share/classes/java/awt/font/StyledParagraph.java b/jdk/src/share/classes/java/awt/font/StyledParagraph.java index 64ac10daa78..df231bf5300 100644 --- a/jdk/src/share/classes/java/awt/font/StyledParagraph.java +++ b/jdk/src/share/classes/java/awt/font/StyledParagraph.java @@ -34,6 +34,7 @@ import java.awt.Toolkit; import java.awt.im.InputMethodHighlight; import java.text.Annotation; import java.text.AttributedCharacterIterator; +import java.text.AttributedCharacterIterator.Attribute; import java.util.Vector; import java.util.HashMap; import java.util.Map; @@ -65,7 +66,7 @@ final class StyledParagraph { // If there are multiple Decorations in the paragraph, they are // stored in this Vector, in order. Otherwise this vector and // the decorationStarts array are null. - private Vector decorations; + private Vector decorations; // If there are multiple Decorations in the paragraph, // decorationStarts[i] contains the index where decoration i // starts. For convenience, there is an extra entry at the @@ -76,7 +77,7 @@ final class StyledParagraph { // they are // stored in this Vector, in order. Otherwise this vector and // the fontStarts array are null. - private Vector fonts; + private Vector fonts; // If there are multiple Fonts/GraphicAttributes in the paragraph, // fontStarts[i] contains the index where decoration i // starts. For convenience, there is an extra entry at the @@ -104,7 +105,7 @@ final class StyledParagraph { final int nextRunStart = aci.getRunLimit(); final int localIndex = index-start; - Map attributes = aci.getAttributes(); + Map attributes = aci.getAttributes(); attributes = addInputMethodAttrs(attributes); Decoration d = Decoration.getDecoration(attributes); addDecoration(d, localIndex); @@ -168,7 +169,8 @@ final class StyledParagraph { char ch = aci.setIndex(insertPos); int relativePos = Math.max(insertPos - aci.getBeginIndex() - 1, 0); - Map attributes = addInputMethodAttrs(aci.getAttributes()); + Map attributes = + addInputMethodAttrs(aci.getAttributes()); Decoration d = Decoration.getDecoration(attributes); if (!oldParagraph.getDecorationAt(relativePos).equals(d)) { return new StyledParagraph(aci, chars); @@ -297,7 +299,7 @@ final class StyledParagraph { return decoration; } int run = findRunContaining(index, decorationStarts); - return (Decoration) decorations.elementAt(run); + return decorations.elementAt(run); } /** @@ -339,6 +341,7 @@ final class StyledParagraph { * starts array does not have room for the index, a * new array is created and returned. */ + @SuppressWarnings({"rawtypes", "unchecked"}) private static int[] addToVector(Object obj, int index, Vector v, @@ -374,7 +377,7 @@ final class StyledParagraph { } else { if (!decoration.equals(d)) { - decorations = new Vector(INITIAL_SIZE); + decorations = new Vector(INITIAL_SIZE); decorations.addElement(decoration); decorations.addElement(d); decorationStarts = new int[INITIAL_SIZE]; @@ -398,7 +401,7 @@ final class StyledParagraph { } else { if (!font.equals(f)) { - fonts = new Vector(INITIAL_SIZE); + fonts = new Vector(INITIAL_SIZE); fonts.addElement(font); fonts.addElement(f); fontStarts = new int[INITIAL_SIZE]; @@ -412,7 +415,8 @@ final class StyledParagraph { * Resolve the given chars into Fonts using FontResolver, then add * font runs for each. */ - private void addFonts(char[] chars, Map attributes, int start, int limit) { + private void addFonts(char[] chars, Map attributes, + int start, int limit) { FontResolver resolver = FontResolver.getInstance(); CodePointIterator iter = CodePointIterator.create(chars, start, limit); @@ -426,7 +430,8 @@ final class StyledParagraph { * Return a Map with entries from oldStyles, as well as input * method entries, if any. */ - static Map addInputMethodAttrs(Map oldStyles) { + static Map + addInputMethodAttrs(Map oldStyles) { Object value = oldStyles.get(TextAttribute.INPUT_METHOD_HIGHLIGHT); @@ -439,7 +444,7 @@ final class StyledParagraph { InputMethodHighlight hl; hl = (InputMethodHighlight) value; - Map imStyles = null; + Map imStyles = null; try { imStyles = hl.getStyle(); } catch (NoSuchMethodError e) { @@ -451,7 +456,8 @@ final class StyledParagraph { } if (imStyles != null) { - HashMap newStyles = new HashMap(5, (float)0.9); + HashMap + newStyles = new HashMap<>(5, (float)0.9); newStyles.putAll(oldStyles); newStyles.putAll(imStyles); @@ -471,7 +477,8 @@ final class StyledParagraph { * If attributes does not contain a GraphicAttribute, Font, or * Font family entry this method returns null. */ - private static Object getGraphicOrFont(Map attributes) { + private static Object getGraphicOrFont( + Map attributes) { Object value = attributes.get(TextAttribute.CHAR_REPLACEMENT); if (value != null) { diff --git a/jdk/src/share/classes/java/awt/font/TextAttribute.java b/jdk/src/share/classes/java/awt/font/TextAttribute.java index 38808b7f3d6..50d47dace20 100644 --- a/jdk/src/share/classes/java/awt/font/TextAttribute.java +++ b/jdk/src/share/classes/java/awt/font/TextAttribute.java @@ -257,7 +257,8 @@ import java.util.HashMap; public final class TextAttribute extends Attribute { // table of all instances in this class, used by readResolve - private static final Map instanceMap = new HashMap(29); + private static final Map + instanceMap = new HashMap(29); /** * Constructs a TextAttribute with the specified name. @@ -280,7 +281,7 @@ public final class TextAttribute extends Attribute { "subclass didn't correctly implement readResolve"); } - TextAttribute instance = (TextAttribute) instanceMap.get(getName()); + TextAttribute instance = instanceMap.get(getName()); if (instance != null) { return instance; } else { diff --git a/jdk/src/share/classes/java/awt/font/TextLayout.java b/jdk/src/share/classes/java/awt/font/TextLayout.java index 51b0dc64e80..c09afd7e653 100644 --- a/jdk/src/share/classes/java/awt/font/TextLayout.java +++ b/jdk/src/share/classes/java/awt/font/TextLayout.java @@ -55,6 +55,7 @@ import java.awt.geom.Rectangle2D; import java.text.AttributedString; import java.text.AttributedCharacterIterator; import java.text.AttributedCharacterIterator.Attribute; +import java.text.CharacterIterator; import java.util.Map; import java.util.HashMap; import java.util.Hashtable; @@ -382,7 +383,7 @@ public final class TextLayout implements Cloneable { throw new IllegalArgumentException("Zero length string passed to TextLayout constructor."); } - Map attributes = null; + Map attributes = null; if (font.hasLayoutAttributes()) { attributes = font.getAttributes(); } @@ -451,7 +452,7 @@ public final class TextLayout implements Cloneable { private static Font singleFont(char[] text, int start, int limit, - Map attributes) { + Map attributes) { if (attributes.get(TextAttribute.CHAR_REPLACEMENT) != null) { return null; @@ -516,14 +517,17 @@ public final class TextLayout implements Cloneable { text.first(); char[] chars = new char[len]; int n = 0; - for (char c = text.first(); c != text.DONE; c = text.next()) { + for (char c = text.first(); + c != CharacterIterator.DONE; + c = text.next()) + { chars[n++] = c; } text.first(); if (text.getRunLimit() == limit) { - Map attributes = text.getAttributes(); + Map attributes = text.getAttributes(); Font font = singleFont(chars, 0, len, attributes); if (font != null) { fastInit(chars, font, attributes, frc); @@ -561,7 +565,9 @@ public final class TextLayout implements Cloneable { /** * Initialize the paragraph-specific data. */ - private void paragraphInit(byte aBaseline, CoreMetrics lm, Map paragraphAttrs, char[] text) { + private void paragraphInit(byte aBaseline, CoreMetrics lm, + Map paragraphAttrs, + char[] text) { baseline = aBaseline; @@ -581,7 +587,10 @@ public final class TextLayout implements Cloneable { * all renderable by one font (ie no embedded graphics) * all on one baseline */ - private void fastInit(char[] chars, Font font, Map attrs, FontRenderContext frc) { + private void fastInit(char[] chars, Font font, + Map attrs, + FontRenderContext frc) { + // Object vf = attrs.get(TextAttribute.ORIENTATION); // isVerticalLine = TextAttribute.ORIENTATION_VERTICAL.equals(vf); isVerticalLine = false; @@ -619,7 +628,7 @@ public final class TextLayout implements Cloneable { // and use it and its font to initialize the paragraph. // If not, use the first graphic to initialize. - Map paragraphAttrs = text.getAttributes(); + Map paragraphAttrs = text.getAttributes(); boolean haveFont = TextLine.advanceToFirstFont(text); diff --git a/jdk/src/share/classes/java/awt/font/TextLine.java b/jdk/src/share/classes/java/awt/font/TextLine.java index fd59d9fc6ef..3a4301ee92a 100644 --- a/jdk/src/share/classes/java/awt/font/TextLine.java +++ b/jdk/src/share/classes/java/awt/font/TextLine.java @@ -43,6 +43,7 @@ import java.awt.im.InputMethodHighlight; import java.awt.image.BufferedImage; import java.text.Annotation; import java.text.AttributedCharacterIterator; +import java.text.AttributedCharacterIterator.Attribute; import java.text.Bidi; import java.text.CharacterIterator; import java.util.Hashtable; @@ -318,7 +319,8 @@ final class TextLine { for (int i = 0, n = 0; i < fComponents.length; ++i, n += 2) { tlc = fComponents[getComponentLogicalIndex(i)]; AffineTransform at = tlc.getBaselineTransform(); - if (at != null && ((at.getType() & at.TYPE_TRANSLATION) != 0)) { + if (at != null && + ((at.getType() & AffineTransform.TYPE_TRANSLATION) != 0)) { double dx = at.getTranslateX(); double dy = at.getTranslateY(); builder.moveTo(tx += dx, ty += dy); @@ -903,7 +905,7 @@ final class TextLine { char[] chars, Font font, CoreMetrics lm, - Map attributes) { + Map attributes) { boolean isDirectionLTR = true; byte[] levels = null; @@ -1250,7 +1252,10 @@ final class TextLine { */ static boolean advanceToFirstFont(AttributedCharacterIterator aci) { - for (char ch = aci.first(); ch != aci.DONE; ch = aci.setIndex(aci.getRunLimit())) { + for (char ch = aci.first(); + ch != CharacterIterator.DONE; + ch = aci.setIndex(aci.getRunLimit())) + { if (aci.getAttribute(TextAttribute.CHAR_REPLACEMENT) == null) { return true; diff --git a/jdk/src/share/classes/java/awt/font/TextMeasurer.java b/jdk/src/share/classes/java/awt/font/TextMeasurer.java index ca052b36f34..b20afcd2c21 100644 --- a/jdk/src/share/classes/java/awt/font/TextMeasurer.java +++ b/jdk/src/share/classes/java/awt/font/TextMeasurer.java @@ -43,6 +43,7 @@ package java.awt.font; import java.awt.Font; import java.text.AttributedCharacterIterator; +import java.text.AttributedCharacterIterator.Attribute; import java.text.AttributedString; import java.text.Bidi; import java.text.BreakIterator; @@ -176,7 +177,7 @@ public final class TextMeasurer implements Cloneable { throw new Error(); } if (fComponents != null) { - other.fComponents = (TextLineComponent[]) fComponents.clone(); + other.fComponents = fComponents.clone(); } return other; } @@ -199,7 +200,10 @@ public final class TextMeasurer implements Cloneable { fChars = new char[text.getEndIndex() - fStart]; int n = 0; - for (char c = text.first(); c != text.DONE; c = text.next()) { + for (char c = text.first(); + c != CharacterIterator.DONE; + c = text.next()) + { fChars[n++] = c; } @@ -211,7 +215,7 @@ public final class TextMeasurer implements Cloneable { } text.first(); - Map paragraphAttrs = text.getAttributes(); + Map paragraphAttrs = text.getAttributes(); NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs); if (shaper != null) { shaper.shape(fChars, 0, fChars.length); @@ -243,7 +247,8 @@ public final class TextMeasurer implements Cloneable { GraphicAttribute graphic = (GraphicAttribute) paragraphAttrs.get(TextAttribute.CHAR_REPLACEMENT); fBaseline = TextLayout.getBaselineFromGraphic(graphic); - Font dummyFont = new Font(new Hashtable(5, (float)0.9)); + Hashtable fmap = new Hashtable<>(5, (float)0.9); + Font dummyFont = new Font(fmap); LineMetrics lm = dummyFont.getLineMetrics(" ", 0, 1, fFrc); fBaselineOffsets = lm.getBaselineOffsets(); } diff --git a/jdk/src/share/classes/java/awt/geom/Path2D.java b/jdk/src/share/classes/java/awt/geom/Path2D.java index 39f7d992b28..3aae874310c 100644 --- a/jdk/src/share/classes/java/awt/geom/Path2D.java +++ b/jdk/src/share/classes/java/awt/geom/Path2D.java @@ -667,7 +667,8 @@ public abstract class Path2D implements Shape, Cloneable { // Collapse out initial moveto/lineto break; } - // NO BREAK; + lineTo(coords[0], coords[1]); + break; case SEG_LINETO: lineTo(coords[0], coords[1]); break; @@ -1392,7 +1393,8 @@ public abstract class Path2D implements Shape, Cloneable { // Collapse out initial moveto/lineto break; } - // NO BREAK; + lineTo(coords[0], coords[1]); + break; case SEG_LINETO: lineTo(coords[0], coords[1]); break; @@ -2456,7 +2458,7 @@ public abstract class Path2D implements Shape, Cloneable { } } } - s.writeByte((byte) SERIAL_PATH_END); + s.writeByte(SERIAL_PATH_END); } final void readObject(java.io.ObjectInputStream s, boolean storedbl) diff --git a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java index 239f8834ac5..5910c4bb4a4 100644 --- a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java +++ b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java @@ -323,8 +323,8 @@ public class BufImgSurfaceData extends SurfaceData { } public RenderLoops getRenderLoops(SunGraphics2D sg2d) { - if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR && - sg2d.compositeState <= sg2d.COMP_ISCOPY) + if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && + sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY) { return solidloops; } diff --git a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java index 8d9c2ea233f..4571b81167f 100644 --- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java +++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java @@ -941,7 +941,7 @@ public final class SunGraphics2D } } } - Class paintClass = paint.getClass(); + Class paintClass = paint.getClass(); if (paintClass == GradientPaint.class) { paintState = PAINT_GRADIENT; } else if (paintClass == LinearGradientPaint.class) { @@ -1280,7 +1280,7 @@ public final class SunGraphics2D interpolationHint = -1; interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR; boolean customHintPresent = false; - Iterator iter = hints.keySet().iterator(); + Iterator iter = hints.keySet().iterator(); while (iter.hasNext()) { Object key = iter.next(); if (key == SunHints.KEY_RENDERING || @@ -1311,7 +1311,7 @@ public final class SunGraphics2D */ public void addRenderingHints(Map hints) { boolean customHintPresent = false; - Iterator iter = hints.keySet().iterator(); + Iterator iter = hints.keySet().iterator(); while (iter.hasNext()) { Object key = iter.next(); if (key == SunHints.KEY_RENDERING || diff --git a/jdk/src/share/classes/sun/java2d/SurfaceData.java b/jdk/src/share/classes/sun/java2d/SurfaceData.java index 9916c5b38a8..bd882343862 100644 --- a/jdk/src/share/classes/sun/java2d/SurfaceData.java +++ b/jdk/src/share/classes/sun/java2d/SurfaceData.java @@ -520,8 +520,8 @@ public abstract class SurfaceData } public boolean canRenderParallelograms(SunGraphics2D sg2d) { - if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) { - if (sg2d.compositeState == sg2d.COMP_XOR) { + if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) { + if (sg2d.compositeState == SunGraphics2D.COMP_XOR) { if (havePgramXORLoop == LOOP_UNKNOWN) { FillParallelogram loop = FillParallelogram.locate(SurfaceType.AnyColor, @@ -531,9 +531,9 @@ public abstract class SurfaceData (loop != null) ? LOOP_FOUND : LOOP_NOTFOUND; } return havePgramXORLoop == LOOP_FOUND; - } else if (sg2d.compositeState <= sg2d.COMP_ISCOPY && + } else if (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY && sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON && - sg2d.clipState != sg2d.CLIP_SHAPE) + sg2d.clipState != SunGraphics2D.CLIP_SHAPE) { if (havePgramSolidLoop == LOOP_UNKNOWN) { FillParallelogram loop = @@ -551,8 +551,8 @@ public abstract class SurfaceData public void validatePipe(SunGraphics2D sg2d) { sg2d.imagepipe = imagepipe; - if (sg2d.compositeState == sg2d.COMP_XOR) { - if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { + if (sg2d.compositeState == SunGraphics2D.COMP_XOR) { + if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { sg2d.drawpipe = paintViaShape; sg2d.fillpipe = paintViaShape; sg2d.shapepipe = paintShape; @@ -576,7 +576,7 @@ public abstract class SurfaceData converter = colorViaShape; sg2d.shapepipe = colorPrimitives; } - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { sg2d.drawpipe = converter; sg2d.fillpipe = converter; // REMIND: We should not be changing text strategies @@ -589,11 +589,11 @@ public abstract class SurfaceData // which is not defined for XOR. sg2d.textpipe = outlineTextRenderer; } else { - if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { sg2d.drawpipe = converter; sg2d.fillpipe = converter; } else { - if (sg2d.strokeState != sg2d.STROKE_THIN) { + if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) { sg2d.drawpipe = converter; } else { sg2d.drawpipe = colorPrimitives; @@ -604,9 +604,9 @@ public abstract class SurfaceData } // assert(sg2d.surfaceData == this); } - } else if (sg2d.compositeState == sg2d.COMP_CUSTOM) { + } else if (sg2d.compositeState == SunGraphics2D.COMP_CUSTOM) { if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON) { - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { sg2d.drawpipe = AAClipCompViaShape; sg2d.fillpipe = AAClipCompViaShape; sg2d.shapepipe = AAClipCompViaShape; @@ -621,7 +621,7 @@ public abstract class SurfaceData sg2d.drawpipe = compViaShape; sg2d.fillpipe = compViaShape; sg2d.shapepipe = compShape; - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { sg2d.textpipe = clipCompText; } else { sg2d.textpipe = compText; @@ -631,7 +631,7 @@ public abstract class SurfaceData sg2d.alphafill = getMaskFill(sg2d); // assert(sg2d.surfaceData == this); if (sg2d.alphafill != null) { - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { sg2d.drawpipe = AAClipColorViaShape; sg2d.fillpipe = AAClipColorViaShape; sg2d.shapepipe = AAClipColorViaShape; @@ -644,8 +644,8 @@ public abstract class SurfaceData sg2d.drawpipe = converter; sg2d.fillpipe = converter; sg2d.shapepipe = converter; - if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR || - sg2d.compositeState > sg2d.COMP_ISCOPY) + if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR || + sg2d.compositeState > SunGraphics2D.COMP_ISCOPY) { sg2d.textpipe = colorText; } else { @@ -653,7 +653,7 @@ public abstract class SurfaceData } } } else { - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { sg2d.drawpipe = AAClipPaintViaShape; sg2d.fillpipe = AAClipPaintViaShape; sg2d.shapepipe = AAClipPaintViaShape; @@ -665,9 +665,9 @@ public abstract class SurfaceData sg2d.textpipe = paintText; } } - } else if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR || - sg2d.compositeState > sg2d.COMP_ISCOPY || - sg2d.clipState == sg2d.CLIP_SHAPE) + } else if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR || + sg2d.compositeState > SunGraphics2D.COMP_ISCOPY || + sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { sg2d.drawpipe = paintViaShape; sg2d.fillpipe = paintViaShape; @@ -675,13 +675,13 @@ public abstract class SurfaceData sg2d.alphafill = getMaskFill(sg2d); // assert(sg2d.surfaceData == this); if (sg2d.alphafill != null) { - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { sg2d.textpipe = clipColorText; } else { sg2d.textpipe = colorText; } } else { - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { sg2d.textpipe = clipPaintText; } else { sg2d.textpipe = paintText; @@ -700,11 +700,11 @@ public abstract class SurfaceData converter = colorViaShape; sg2d.shapepipe = colorPrimitives; } - if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { sg2d.drawpipe = converter; sg2d.fillpipe = converter; } else { - if (sg2d.strokeState != sg2d.STROKE_THIN) { + if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) { sg2d.drawpipe = converter; } else { sg2d.drawpipe = colorPrimitives; @@ -817,7 +817,7 @@ public abstract class SurfaceData private static CompositeType getFillCompositeType(SunGraphics2D sg2d) { CompositeType compType = sg2d.imageComp; - if (sg2d.compositeState == sg2d.COMP_ISCOPY) { + if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) { if (compType == CompositeType.SrcOverNoEa) { compType = CompositeType.OpaqueSrcOverNoEa; } else { diff --git a/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java b/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java index 638579cfebe..fefb50797ca 100644 --- a/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java +++ b/jdk/src/share/classes/sun/java2d/SurfaceDataProxy.java @@ -71,7 +71,7 @@ public abstract class SurfaceDataProxy static { cachingAllowed = true; - String manimg = (String)AccessController.doPrivileged( + String manimg = AccessController.doPrivileged( new GetPropertyAction("sun.java2d.managedimages")); if (manimg != null && manimg.equals("false")) { cachingAllowed = false; @@ -79,7 +79,7 @@ public abstract class SurfaceDataProxy } defaultThreshold = 1; - String num = (String)AccessController.doPrivileged( + String num = AccessController.doPrivileged( new GetPropertyAction("sun.java2d.accthreshold")); if (num != null) { try { diff --git a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java index 664d5ff7e47..205da2f0d3b 100644 --- a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java +++ b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java @@ -328,7 +328,7 @@ public abstract class GraphicsPrimitive { static { GetPropertyAction gpa = new GetPropertyAction("sun.java2d.trace"); - String trace = (String)AccessController.doPrivileged(gpa); + String trace = AccessController.doPrivileged(gpa); if (trace != null) { boolean verbose = false; int traceflags = 0; @@ -391,9 +391,9 @@ public abstract class GraphicsPrimitive { private static PrintStream getTraceOutputFile() { if (traceout == null) { if (tracefile != null) { - Object o = - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + FileOutputStream o = AccessController.doPrivileged( + new PrivilegedAction() { + public FileOutputStream run() { try { return new FileOutputStream(tracefile); } catch (FileNotFoundException e) { @@ -402,7 +402,7 @@ public abstract class GraphicsPrimitive { } }); if (o != null) { - traceout = new PrintStream((OutputStream) o); + traceout = new PrintStream(o); } else { traceout = System.err; } @@ -415,8 +415,8 @@ public abstract class GraphicsPrimitive { public static class TraceReporter extends Thread { public static void setShutdownHook() { - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { TraceReporter t = new TraceReporter(); t.setContextClassLoader(null); Runtime.getRuntime().addShutdownHook(t); diff --git a/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java b/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java index bcce58eb215..907c6f3c550 100644 --- a/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java +++ b/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java @@ -56,7 +56,7 @@ import java.util.HashMap; public final class SurfaceType { private static int unusedUID = 1; - private static HashMap surfaceUIDMap = new HashMap(100); + private static HashMap surfaceUIDMap = new HashMap<>(100); /* * CONSTANTS USED BY ALL PRIMITIVES TO DESCRIBE THE SURFACES @@ -402,7 +402,7 @@ public final class SurfaceType { } public synchronized static final int makeUniqueID(String desc) { - Integer i = (Integer) surfaceUIDMap.get((Object) desc); + Integer i = surfaceUIDMap.get(desc); if (i == null) { if (unusedUID > 255) { diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java b/jdk/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java index 994b46ec8ea..8d8366bbc77 100644 --- a/jdk/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java +++ b/jdk/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java @@ -78,12 +78,12 @@ class OGLBufImgOps extends BufferedBufImgOps { } SurfaceData srcData = - dstData.getSourceSurfaceData(img, sg.TRANSFORM_ISIDENT, + dstData.getSourceSurfaceData(img, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null); if (!(srcData instanceof OGLSurfaceData)) { // REMIND: this hack tries to ensure that we have a cached texture srcData = - dstData.getSourceSurfaceData(img, sg.TRANSFORM_ISIDENT, + dstData.getSourceSurfaceData(img, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null); if (!(srcData instanceof OGLSurfaceData)) { return false; diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLDrawImage.java b/jdk/src/share/classes/sun/java2d/opengl/OGLDrawImage.java index 07a416ed950..9e373f22647 100644 --- a/jdk/src/share/classes/sun/java2d/opengl/OGLDrawImage.java +++ b/jdk/src/share/classes/sun/java2d/opengl/OGLDrawImage.java @@ -60,7 +60,7 @@ public class OGLDrawImage extends DrawImage { SurfaceData dstData = sg.surfaceData; SurfaceData srcData = dstData.getSourceSurfaceData(img, - sg.TRANSFORM_GENERIC, + SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor); diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLPaints.java b/jdk/src/share/classes/sun/java2d/opengl/OGLPaints.java index 24b839ba805..62d400153f7 100644 --- a/jdk/src/share/classes/sun/java2d/opengl/OGLPaints.java +++ b/jdk/src/share/classes/sun/java2d/opengl/OGLPaints.java @@ -123,14 +123,16 @@ abstract class OGLPaints { } SurfaceData srcData = - dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT, + dstData.getSourceSurfaceData(bi, + SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null); if (!(srcData instanceof OGLSurfaceData)) { // REMIND: this is a hack that attempts to cache the system // memory image from the TexturePaint instance into an // OpenGL texture... srcData = - dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT, + dstData.getSourceSurfaceData(bi, + SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null); if (!(srcData instanceof OGLSurfaceData)) { return false; diff --git a/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java b/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java index ca6c9a65b01..3968f05d58f 100644 --- a/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java +++ b/jdk/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java @@ -428,18 +428,18 @@ public abstract class OGLSurfaceData extends SurfaceData // by the CompositeType.SrcNoEa (any color) test below.) if (/* CompositeType.SrcNoEa (any color) */ - (sg2d.compositeState <= sg2d.COMP_ISCOPY && - sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) || + (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY && + sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) || /* CompositeType.SrcOver (any color) */ - (sg2d.compositeState == sg2d.COMP_ALPHA && - sg2d.paintState <= sg2d.PAINT_ALPHACOLOR && + (sg2d.compositeState == SunGraphics2D.COMP_ALPHA && + sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && (((AlphaComposite)sg2d.composite).getRule() == - AlphaComposite.SRC_OVER)) || + AlphaComposite.SRC_OVER)) || /* CompositeType.Xor (any color) */ - (sg2d.compositeState == sg2d.COMP_XOR && - sg2d.paintState <= sg2d.PAINT_ALPHACOLOR)) + (sg2d.compositeState == SunGraphics2D.COMP_XOR && + sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR)) { textpipe = oglTextPipe; } else { @@ -454,12 +454,12 @@ public abstract class OGLSurfaceData extends SurfaceData OGLRenderer nonTxPipe = null; if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) { - if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) { - if (sg2d.compositeState <= sg2d.COMP_XOR) { + if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) { + if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) { txPipe = oglTxRenderPipe; nonTxPipe = oglRenderPipe; } - } else if (sg2d.compositeState <= sg2d.COMP_ALPHA) { + } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) { if (OGLPaints.isValid(sg2d)) { txPipe = oglTxRenderPipe; nonTxPipe = oglRenderPipe; @@ -467,7 +467,7 @@ public abstract class OGLSurfaceData extends SurfaceData // custom paints handled by super.validatePipe() below } } else { - if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) { + if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) { if (graphicsConfig.isCapPresent(CAPS_PS30) && (sg2d.imageComp == CompositeType.SrcOverNoEa || sg2d.imageComp == CompositeType.SrcOver)) @@ -484,7 +484,7 @@ public abstract class OGLSurfaceData extends SurfaceData sg2d.drawpipe = aaConverter; sg2d.fillpipe = aaConverter; sg2d.shapepipe = aaConverter; - } else if (sg2d.compositeState == sg2d.COMP_XOR) { + } else if (sg2d.compositeState == SunGraphics2D.COMP_XOR) { // install the solid pipes when AA and XOR are both enabled txPipe = oglTxRenderPipe; nonTxPipe = oglRenderPipe; @@ -494,10 +494,10 @@ public abstract class OGLSurfaceData extends SurfaceData } if (txPipe != null) { - if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { sg2d.drawpipe = txPipe; sg2d.fillpipe = txPipe; - } else if (sg2d.strokeState != sg2d.STROKE_THIN) { + } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) { sg2d.drawpipe = txPipe; sg2d.fillpipe = nonTxPipe; } else { @@ -524,7 +524,7 @@ public abstract class OGLSurfaceData extends SurfaceData @Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { - if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { + if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: @@ -548,8 +548,8 @@ public abstract class OGLSurfaceData extends SurfaceData public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h, int dx, int dy) { - if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE && - sg2d.compositeState < sg2d.COMP_XOR) + if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE && + sg2d.compositeState < SunGraphics2D.COMP_XOR) { x += sg2d.transX; y += sg2d.transY; diff --git a/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java b/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java index eaa821d9022..7da9b58ea10 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java +++ b/jdk/src/share/classes/sun/java2d/pipe/AAShapePipe.java @@ -144,7 +144,7 @@ public class AAShapePipe public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) { boolean adjust = (bs != null && sg.strokeHint != SunHints.INTVAL_STROKE_PURE); - boolean thin = (sg.strokeState <= sg.STROKE_THINDASHED); + boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED); Region clip = sg.getCompClip(); int abox[] = new int[4]; diff --git a/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java b/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java index 87ff6490bfd..afdfe6d2063 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java +++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedPaints.java @@ -247,7 +247,7 @@ public class BufferedPaints { BufferedImage bi = paint.getImage(); SurfaceData dstData = sg2d.surfaceData; SurfaceData srcData = - dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT, + dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null); boolean filter = (sg2d.interpolationType != diff --git a/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java b/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java index c5f30976958..3270a463c4c 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java +++ b/jdk/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java @@ -508,9 +508,9 @@ public abstract class BufferedRenderPipe } public void draw(SunGraphics2D sg2d, Shape s) { - if (sg2d.strokeState == sg2d.STROKE_THIN) { + if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { if (s instanceof Polygon) { - if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) { Polygon p = (Polygon)s; drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); return; @@ -518,7 +518,7 @@ public abstract class BufferedRenderPipe } Path2D.Float p2df; int transx, transy; - if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { + if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { @@ -532,7 +532,7 @@ public abstract class BufferedRenderPipe transy = 0; } drawPath(sg2d, p2df, transx, transy); - } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) { + } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) { ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s); try { fillSpans(sg2d, si, 0, 0); @@ -547,11 +547,11 @@ public abstract class BufferedRenderPipe public void fill(SunGraphics2D sg2d, Shape s) { int transx, transy; - if (sg2d.strokeState == sg2d.STROKE_THIN) { + if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { // Here we are able to use fillPath() for // high-quality fills. Path2D.Float p2df; - if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { + if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { @@ -569,7 +569,7 @@ public abstract class BufferedRenderPipe } AffineTransform at; - if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { + if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { // Transform (translation) will be done by FillSpans (we could // delegate to fillPolygon() here, but most hardware accelerated // libraries cannot handle non-convex polygons, so we will use diff --git a/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java b/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java index f702a68be68..510a46bd253 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java +++ b/jdk/src/share/classes/sun/java2d/pipe/DrawImage.java @@ -146,7 +146,7 @@ public class DrawImage implements DrawImagePipe int imgh = img.getHeight(null); boolean checkfinalxform; - if (sg.transformState <= sg.TRANSFORM_ANY_TRANSLATE && + if (sg.transformState <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE && (txtype == AffineTransform.TYPE_IDENTITY || txtype == AffineTransform.TYPE_TRANSLATION)) { @@ -166,7 +166,7 @@ public class DrawImage implements DrawImagePipe return; } checkfinalxform = false; - } else if (sg.transformState <= sg.TRANSFORM_TRANSLATESCALE && + } else if (sg.transformState <= SunGraphics2D.TRANSFORM_TRANSLATESCALE && ((txtype & (AffineTransform.TYPE_FLIP | AffineTransform.TYPE_MASK_ROTATION | AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0)) @@ -344,14 +344,14 @@ public class DrawImage implements DrawImagePipe Region clip = sg.getCompClip(); SurfaceData dstData = sg.surfaceData; SurfaceData srcData = dstData.getSourceSurfaceData(img, - sg.TRANSFORM_GENERIC, + SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor); if (srcData == null) { img = getBufferedImage(img); srcData = dstData.getSourceSurfaceData(img, - sg.TRANSFORM_GENERIC, + SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor); if (srcData == null) { @@ -372,7 +372,7 @@ public class DrawImage implements DrawImagePipe sx1 = sy1 = 0; srcData = dstData.getSourceSurfaceData(img, - sg.TRANSFORM_GENERIC, + SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor); } @@ -398,7 +398,7 @@ public class DrawImage implements DrawImagePipe sx1 = sy1 = 0; srcData = dstData.getSourceSurfaceData(img, - sg.TRANSFORM_GENERIC, + SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, null); srcType = srcData.getSurfaceType(); @@ -449,7 +449,7 @@ public class DrawImage implements DrawImagePipe SurfaceType dstType = dstData.getSurfaceType(); MaskBlit maskblit; Blit blit; - if (sg.compositeState <= sg.COMP_ALPHA) { + if (sg.compositeState <= SunGraphics2D.COMP_ALPHA) { /* NOTE: We either have, or we can make, * a MaskBlit for any alpha composite type */ @@ -565,7 +565,7 @@ public class DrawImage implements DrawImagePipe while (true) { SurfaceData srcData = dstData.getSourceSurfaceData(img, - sg.TRANSFORM_ISIDENT, + SunGraphics2D.TRANSFORM_ISIDENT, sg.imageComp, bgColor); if (srcData == null) { @@ -628,7 +628,7 @@ public class DrawImage implements DrawImagePipe while (true) { SurfaceData srcData = dstData.getSourceSurfaceData(img, - sg.TRANSFORM_TRANSLATESCALE, + SunGraphics2D.TRANSFORM_TRANSLATESCALE, sg.imageComp, bgColor); @@ -800,11 +800,11 @@ public class DrawImage implements DrawImagePipe public static boolean isSimpleTranslate(SunGraphics2D sg) { int ts = sg.transformState; - if (ts <= sg.TRANSFORM_INT_TRANSLATE) { + if (ts <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { // Integer translates are always "simple" return true; } - if (ts >= sg.TRANSFORM_TRANSLATESCALE) { + if (ts >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { // Scales and beyond are always "not simple" return false; } @@ -846,8 +846,11 @@ public class DrawImage implements DrawImagePipe } int type = tx.getType(); boolean needTrans = - ((type&(tx.TYPE_MASK_ROTATION|tx.TYPE_GENERAL_TRANSFORM)) != 0); - if (! needTrans && type != tx.TYPE_TRANSLATION && type != tx.TYPE_IDENTITY) + ((type & (AffineTransform.TYPE_MASK_ROTATION | + AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0); + if (! needTrans && + type != AffineTransform.TYPE_TRANSLATION && + type != AffineTransform.TYPE_IDENTITY) { double[] mtx = new double[4]; tx.getMatrix(mtx); @@ -861,7 +864,7 @@ public class DrawImage implements DrawImagePipe Raster raster = bImg.getRaster(); IndexColorModel icm = (IndexColorModel) cm; // Just need to make sure that we have a transparent pixel - if (needTrans && cm.getTransparency() == cm.OPAQUE) { + if (needTrans && cm.getTransparency() == Transparency.OPAQUE) { // Fix 4221407 if (raster instanceof sun.awt.image.BytePackedRaster) { dstCM = ColorModel.getRGBdefault(); @@ -892,7 +895,7 @@ public class DrawImage implements DrawImagePipe } /* raster instanceof sun.awt.image.BytePackedRaster */ } /* if (cm.getTransparency() == cm.OPAQUE) */ } /* if (cm instanceof IndexColorModel) */ - else if (needTrans && cm.getTransparency() == cm.OPAQUE) { + else if (needTrans && cm.getTransparency() == Transparency.OPAQUE) { // Need a bitmask transparency // REMIND: for now, use full transparency since no loops // for bitmask @@ -902,7 +905,7 @@ public class DrawImage implements DrawImagePipe else { if (cm instanceof IndexColorModel || - (needTrans && cm.getTransparency() == cm.OPAQUE)) + (needTrans && cm.getTransparency() == Transparency.OPAQUE)) { // Need a bitmask transparency // REMIND: for now, use full transparency since no loops diff --git a/jdk/src/share/classes/sun/java2d/pipe/GlyphListPipe.java b/jdk/src/share/classes/sun/java2d/pipe/GlyphListPipe.java index 5a44749c4e9..0467290cb8b 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/GlyphListPipe.java +++ b/jdk/src/share/classes/sun/java2d/pipe/GlyphListPipe.java @@ -54,7 +54,7 @@ public abstract class GlyphListPipe implements TextPipe { } float devx, devy; - if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x + info.originX, y + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); devx = (float)origin[0]; @@ -90,7 +90,7 @@ public abstract class GlyphListPipe implements TextPipe { sg2d, data, offset, length, ix, iy); return; } - if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {ix + info.originX, iy + info.originY}; sg2d.transform.transform(origin, 0, origin, 0, 1); x = (float) origin[0]; @@ -122,7 +122,7 @@ public abstract class GlyphListPipe implements TextPipe { SurfaceData.outlineTextRenderer.drawGlyphVector(sg2d, gv, x, y); return; } - if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { double origin[] = {x, y}; sg2d.transform.transform(origin, 0, origin, 0, 1); x = (float) origin[0]; diff --git a/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java b/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java index e975cc9c3cd..e70ab694795 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java +++ b/jdk/src/share/classes/sun/java2d/pipe/LoopPipe.java @@ -171,11 +171,11 @@ public class LoopPipe public void draw(SunGraphics2D sg2d, Shape s) { - if (sg2d.strokeState == sg2d.STROKE_THIN) { + if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { Path2D.Float p2df; int transX; int transY; - if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { + if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { @@ -193,7 +193,7 @@ public class LoopPipe return; } - if (sg2d.strokeState == sg2d.STROKE_CUSTOM) { + if (sg2d.strokeState == SunGraphics2D.STROKE_CUSTOM) { fill(sg2d, sg2d.stroke.createStrokedShape(s)); return; } @@ -271,7 +271,7 @@ public class LoopPipe sr.setRule(PathIterator.WIND_NON_ZERO); BasicStroke bs = (BasicStroke) sg2d.stroke; - boolean thin = (sg2d.strokeState <= sg2d.STROKE_THINDASHED); + boolean thin = (sg2d.strokeState <= SunGraphics2D.STROKE_THINDASHED); boolean normalize = (sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE); @@ -288,11 +288,11 @@ public class LoopPipe } public void fill(SunGraphics2D sg2d, Shape s) { - if (sg2d.strokeState == sg2d.STROKE_THIN) { + if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { Path2D.Float p2df; int transX; int transY; - if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { + if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { @@ -314,7 +314,7 @@ public class LoopPipe try { sr.setOutputArea(sg2d.getCompClip()); AffineTransform at = - ((sg2d.transformState == sg2d.TRANSFORM_ISIDENT) + ((sg2d.transformState == SunGraphics2D.TRANSFORM_ISIDENT) ? null : sg2d.transform); sr.appendPath(s.getPathIterator(at)); @@ -328,7 +328,7 @@ public class LoopPipe // REMIND: Eventually, the plan is that it will not be possible for // fs to be null since the FillSpans loop will be the fundamental // loop implemented for any destination type... - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { si = sg2d.clipRegion.filter(si); // REMIND: Region.filter produces a Java-only iterator // with no native counterpart... diff --git a/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java b/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java index e2913ab45e3..83b691186ce 100644 --- a/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java +++ b/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java @@ -117,16 +117,16 @@ public abstract class RenderingEngine { return reImpl; } - reImpl = (RenderingEngine) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + reImpl = + AccessController.doPrivileged(new PrivilegedAction() { + public RenderingEngine run() { final String ductusREClass = "sun.dc.DuctusRenderingEngine"; String reClass = System.getProperty("sun.java2d.renderer", ductusREClass); if (reClass.equals(ductusREClass)) { try { - Class cls = Class.forName(ductusREClass); - return cls.newInstance(); + Class cls = Class.forName(ductusREClass); + return (RenderingEngine) cls.newInstance(); } catch (ReflectiveOperationException ignored) { // not found } @@ -153,7 +153,7 @@ public abstract class RenderingEngine { GetPropertyAction gpa = new GetPropertyAction("sun.java2d.renderer.trace"); - String reTrace = (String) AccessController.doPrivileged(gpa); + String reTrace = AccessController.doPrivileged(gpa); if (reTrace != null) { reImpl = new Tracer(reImpl); } diff --git a/jdk/src/solaris/classes/sun/java2d/x11/X11Renderer.java b/jdk/src/solaris/classes/sun/java2d/x11/X11Renderer.java index c25d7abade4..f335781bffb 100644 --- a/jdk/src/solaris/classes/sun/java2d/x11/X11Renderer.java +++ b/jdk/src/solaris/classes/sun/java2d/x11/X11Renderer.java @@ -299,7 +299,7 @@ public class X11Renderer implements private void doPath(SunGraphics2D sg2d, Shape s, boolean isFill) { Path2D.Float p2df; int transx, transy; - if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) { + if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { @@ -323,10 +323,10 @@ public class X11Renderer implements } public void draw(SunGraphics2D sg2d, Shape s) { - if (sg2d.strokeState == sg2d.STROKE_THIN) { + if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { // Delegate to drawPolygon() if possible... if (s instanceof Polygon && - sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) + sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) { Polygon p = (Polygon) s; drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); @@ -336,7 +336,7 @@ public class X11Renderer implements // Otherwise we will use drawPath() for // high-quality thin paths. doPath(sg2d, s, false); - } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) { + } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) { // REMIND: X11 can handle uniform scaled wide lines // and dashed lines itself if we set the appropriate // XGC attributes (TBD). @@ -360,10 +360,10 @@ public class X11Renderer implements } public void fill(SunGraphics2D sg2d, Shape s) { - if (sg2d.strokeState == sg2d.STROKE_THIN) { + if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { // Delegate to fillPolygon() if possible... if (s instanceof Polygon && - sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) + sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) { Polygon p = (Polygon) s; fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints); @@ -378,7 +378,7 @@ public class X11Renderer implements AffineTransform at; int transx, transy; - if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) { // Transform (translation) will be done by XFillSpans at = null; transx = sg2d.transX; diff --git a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java index 24513aa1af3..d9d883a0e52 100644 --- a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java +++ b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java @@ -295,9 +295,9 @@ public abstract class X11SurfaceData extends XSurfaceData { public void validatePipe(SunGraphics2D sg2d) { if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON && - sg2d.paintState <= sg2d.PAINT_ALPHACOLOR && - (sg2d.compositeState <= sg2d.COMP_ISCOPY || - sg2d.compositeState == sg2d.COMP_XOR)) + sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && + (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY || + sg2d.compositeState == SunGraphics2D.COMP_XOR)) { if (x11txpipe == null) { /* @@ -315,7 +315,7 @@ public abstract class X11SurfaceData extends XSurfaceData { return; } - if (sg2d.clipState == sg2d.CLIP_SHAPE) { + if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) { // Do this to init textpipe correctly; we will override the // other non-text pipes below // REMIND: we should clean this up eventually instead of @@ -329,7 +329,7 @@ public abstract class X11SurfaceData extends XSurfaceData { case SunHints.INTVAL_TEXT_ANTIALIAS_OFF: // Use X11 pipe even if DGA is available since DGA // text slows everything down when mixed with X11 calls - if (sg2d.compositeState == sg2d.COMP_ISCOPY) { + if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) { sg2d.textpipe = x11textpipe; } else { sg2d.textpipe = solidTextRenderer; @@ -353,7 +353,7 @@ public abstract class X11SurfaceData extends XSurfaceData { case SunHints.INTVAL_TEXT_ANTIALIAS_OFF: // Use X11 pipe even if DGA is available since DGA // text slows everything down when mixed with X11 calls - if (sg2d.compositeState == sg2d.COMP_ISCOPY) { + if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) { sg2d.textpipe = x11textpipe; } else { sg2d.textpipe = solidTextRenderer; @@ -370,10 +370,10 @@ public abstract class X11SurfaceData extends XSurfaceData { } } - if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) { + if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) { sg2d.drawpipe = x11txpipe; sg2d.fillpipe = x11txpipe; - } else if (sg2d.strokeState != sg2d.STROKE_THIN){ + } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN){ sg2d.drawpipe = x11txpipe; sg2d.fillpipe = x11pipe; } else { @@ -398,8 +398,8 @@ public abstract class X11SurfaceData extends XSurfaceData { } public RenderLoops getRenderLoops(SunGraphics2D sg2d) { - if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR && - sg2d.compositeState <= sg2d.COMP_ISCOPY) + if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR && + sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY) { return solidloops; } @@ -488,7 +488,7 @@ public abstract class X11SurfaceData extends XSurfaceData { makePipes(); } CompositeType comptype = sg2d.imageComp; - if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE && + if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE && (CompositeType.SrcOverNoEa.equals(comptype) || CompositeType.SrcNoEa.equals(comptype))) {