981 } 982 return tx; 983 } 984 985 private static boolean equalNonTranslateTX(AffineTransform lhs, AffineTransform rhs) { 986 return lhs.getScaleX() == rhs.getScaleX() && 987 lhs.getShearY() == rhs.getShearY() && 988 lhs.getShearX() == rhs.getShearX() && 989 lhs.getScaleY() == rhs.getScaleY(); 990 } 991 992 // called by setupGlyphImages (after needsPositions, so redundant match check?) 993 private void setRenderTransform(double[] devTX) { 994 assert(devTX.length == 4); 995 if (!matchTX(devTX, dtx)) { 996 resetDTX(new AffineTransform(devTX)); // no translation since devTX len == 4. 997 } 998 } 999 1000 // called by getGlyphsPixelBounds 1001 private final void setDTX(AffineTransform tx) { 1002 if (!equalNonTranslateTX(dtx, tx)) { 1003 resetDTX(getNonTranslateTX(tx)); 1004 } 1005 } 1006 1007 // called by most functions 1008 private final void setFRCTX() { 1009 if (!equalNonTranslateTX(frctx, dtx)) { 1010 resetDTX(getNonTranslateTX(frctx)); 1011 } 1012 } 1013 1014 /** 1015 * Change the dtx for the strike refs we use. Keeps a reference to the at. At 1016 * must not contain translation. 1017 * Called by setRenderTransform, setDTX, initFontData. 1018 */ 1019 private final void resetDTX(AffineTransform at) { 1020 fsref = null; 1021 dtx = at; 1022 invdtx = null; 1023 if (!dtx.isIdentity()) { 1024 try { 1025 invdtx = dtx.createInverse(); 1026 } 1027 catch (NoninvertibleTransformException e) { 1028 // we needn't care for rendering 1029 } 1030 } 1031 if (gti != null) { 1032 gti.strikesRef = null; 1033 } 1034 } 1035 1036 /** 1037 * Utility used by getStandardGV. 1038 * Constructs a StandardGlyphVector from a generic glyph vector. 1039 * Do not call this from new contexts without considering the comment | 981 } 982 return tx; 983 } 984 985 private static boolean equalNonTranslateTX(AffineTransform lhs, AffineTransform rhs) { 986 return lhs.getScaleX() == rhs.getScaleX() && 987 lhs.getShearY() == rhs.getShearY() && 988 lhs.getShearX() == rhs.getShearX() && 989 lhs.getScaleY() == rhs.getScaleY(); 990 } 991 992 // called by setupGlyphImages (after needsPositions, so redundant match check?) 993 private void setRenderTransform(double[] devTX) { 994 assert(devTX.length == 4); 995 if (!matchTX(devTX, dtx)) { 996 resetDTX(new AffineTransform(devTX)); // no translation since devTX len == 4. 997 } 998 } 999 1000 // called by getGlyphsPixelBounds 1001 private void setDTX(AffineTransform tx) { 1002 if (!equalNonTranslateTX(dtx, tx)) { 1003 resetDTX(getNonTranslateTX(tx)); 1004 } 1005 } 1006 1007 // called by most functions 1008 private void setFRCTX() { 1009 if (!equalNonTranslateTX(frctx, dtx)) { 1010 resetDTX(getNonTranslateTX(frctx)); 1011 } 1012 } 1013 1014 /** 1015 * Change the dtx for the strike refs we use. Keeps a reference to the at. At 1016 * must not contain translation. 1017 * Called by setRenderTransform, setDTX, initFontData. 1018 */ 1019 private void resetDTX(AffineTransform at) { 1020 fsref = null; 1021 dtx = at; 1022 invdtx = null; 1023 if (!dtx.isIdentity()) { 1024 try { 1025 invdtx = dtx.createInverse(); 1026 } 1027 catch (NoninvertibleTransformException e) { 1028 // we needn't care for rendering 1029 } 1030 } 1031 if (gti != null) { 1032 gti.strikesRef = null; 1033 } 1034 } 1035 1036 /** 1037 * Utility used by getStandardGV. 1038 * Constructs a StandardGlyphVector from a generic glyph vector. 1039 * Do not call this from new contexts without considering the comment |