< prev index next >

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

Print this page




 704         }
 705         if (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT) {
 706             if (antialiasHint == SunHints.INTVAL_ANTIALIAS_ON) {
 707                 aahint = SunHints.INTVAL_TEXT_ANTIALIAS_ON;
 708             } else {
 709                 aahint = SunHints.INTVAL_TEXT_ANTIALIAS_OFF;
 710             }
 711         } else {
 712             /* If we are in checkFontInfo because a rendering hint has been
 713              * set then all pipes are revalidated. But we can also
 714              * be here because setFont() has been called when the 'gasp'
 715              * hint is set, as then the font size determines the text pipe.
 716              * See comments in SunGraphics2d.setFont(Font).
 717              */
 718             if (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_GASP) {
 719                 if (info.font2D.useAAForPtSize(info.pixelHeight)) {
 720                     aahint = SunHints.INTVAL_TEXT_ANTIALIAS_ON;
 721                 } else {
 722                     aahint = SunHints.INTVAL_TEXT_ANTIALIAS_OFF;
 723                 }
 724             } else if (aahint >= SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB) {







 725                 /* loops for default rendering modes are installed in the SG2D
 726                  * constructor. If there are none this will be null.
 727                  * Not all compositing modes update the render loops, so
 728                  * we also test that this is a mode we know should support
 729                  * this. One minor issue is that the loops aren't necessarily
 730                  * installed for a new rendering mode until after this
 731                  * method is called during pipeline validation. So it is
 732                  * theoretically possible that it was set to null for a
 733                  * compositing mode, the composite is then set back to Src,
 734                  * but the loop is still null when this is called and AA=ON
 735                  * is installed instead of an LCD mode.
 736                  * However this is done in the right order in SurfaceData.java
 737                  * so this is not likely to be a problem - but not
 738                  * guaranteed.
 739                  */
 740                 if (
 741                     !surfaceData.canRenderLCDText(this)
 742 //                    loops.drawGlyphListLCDLoop == null ||
 743 //                    compositeState > COMP_ISCOPY ||
 744 //                    paintState > PAINT_ALPHACOLOR


 752                      * tempting to collapse into one value. But they are
 753                      * different strikes (glyph caches) so the distinction
 754                      * needs to be made for that purpose.
 755                      */
 756                     if (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HBGR) {
 757                         aahint = SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
 758                         info.lcdRGBOrder = false;
 759                     } else if
 760                         (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VBGR) {
 761                         aahint = SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
 762                         info.lcdRGBOrder = false;
 763                     }
 764                     /* Support subpixel positioning only for the case in
 765                      * which the horizontal resolution is increased
 766                      */
 767                     info.lcdSubPixPos =
 768                         fmhint == SunHints.INTVAL_FRACTIONALMETRICS_ON &&
 769                         aahint == SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
 770                 }
 771             }
 772         }
 773         info.aaHint = aahint;
 774         info.fontStrike = info.font2D.getStrike(font, devAt, textAt,
 775                                                 aahint, fmhint);
 776         return info;
 777     }
 778 
 779     public static boolean isRotated(double [] mtx) {
 780         if ((mtx[0] == mtx[3]) &&
 781             (mtx[1] == 0.0) &&
 782             (mtx[2] == 0.0) &&
 783             (mtx[0] > 0.0))
 784         {
 785             return false;
 786         }
 787 
 788         return true;
 789     }
 790 
 791     public void setFont(Font font) {
 792         /* replacing the reference equality test font != this.font with




 704         }
 705         if (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT) {
 706             if (antialiasHint == SunHints.INTVAL_ANTIALIAS_ON) {
 707                 aahint = SunHints.INTVAL_TEXT_ANTIALIAS_ON;
 708             } else {
 709                 aahint = SunHints.INTVAL_TEXT_ANTIALIAS_OFF;
 710             }
 711         } else {
 712             /* If we are in checkFontInfo because a rendering hint has been
 713              * set then all pipes are revalidated. But we can also
 714              * be here because setFont() has been called when the 'gasp'
 715              * hint is set, as then the font size determines the text pipe.
 716              * See comments in SunGraphics2d.setFont(Font).
 717              */
 718             if (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_GASP) {
 719                 if (info.font2D.useAAForPtSize(info.pixelHeight)) {
 720                     aahint = SunHints.INTVAL_TEXT_ANTIALIAS_ON;
 721                 } else {
 722                     aahint = SunHints.INTVAL_TEXT_ANTIALIAS_OFF;
 723                 }
 724             }
 725         }
 726 
 727         if  (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_ON && FontUtilities.isMacOSX) {
 728             // TODO: check subpixel order
 729             aahint = SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HBGR;
 730         }
 731         if (aahint >= SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB) {
 732             /* loops for default rendering modes are installed in the SG2D
 733              * constructor. If there are none this will be null.
 734              * Not all compositing modes update the render loops, so
 735              * we also test that this is a mode we know should support
 736              * this. One minor issue is that the loops aren't necessarily
 737              * installed for a new rendering mode until after this
 738              * method is called during pipeline validation. So it is
 739              * theoretically possible that it was set to null for a
 740              * compositing mode, the composite is then set back to Src,
 741              * but the loop is still null when this is called and AA=ON
 742              * is installed instead of an LCD mode.
 743              * However this is done in the right order in SurfaceData.java
 744              * so this is not likely to be a problem - but not
 745              * guaranteed.
 746              */
 747             if (
 748                 !surfaceData.canRenderLCDText(this)
 749 //                loops.drawGlyphListLCDLoop == null ||
 750 //                compositeState > COMP_ISCOPY ||
 751 //                paintState > PAINT_ALPHACOLOR


 759                      * tempting to collapse into one value. But they are
 760                      * different strikes (glyph caches) so the distinction
 761                      * needs to be made for that purpose.
 762                      */
 763                     if (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HBGR) {
 764                         aahint = SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
 765                         info.lcdRGBOrder = false;
 766                     } else if
 767                         (aahint == SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VBGR) {
 768                         aahint = SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB;
 769                         info.lcdRGBOrder = false;
 770                     }
 771                     /* Support subpixel positioning only for the case in
 772                      * which the horizontal resolution is increased
 773                      */
 774                     info.lcdSubPixPos =
 775                         fmhint == SunHints.INTVAL_FRACTIONALMETRICS_ON &&
 776                         aahint == SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB;
 777             }
 778         }

 779         info.aaHint = aahint;
 780         info.fontStrike = info.font2D.getStrike(font, devAt, textAt,
 781                                                 aahint, fmhint);
 782         return info;
 783     }
 784 
 785     public static boolean isRotated(double [] mtx) {
 786         if ((mtx[0] == mtx[3]) &&
 787             (mtx[1] == 0.0) &&
 788             (mtx[2] == 0.0) &&
 789             (mtx[0] > 0.0))
 790         {
 791             return false;
 792         }
 793 
 794         return true;
 795     }
 796 
 797     public void setFont(Font font) {
 798         /* replacing the reference equality test font != this.font with


< prev index next >