src/solaris/classes/sun/font/X11TextRenderer.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2006, 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


  40 
  41 /**
  42  * A delegate pipe of SG2D for drawing text with
  43  * a solid source colour to an X11 drawable destination.
  44  */
  45 public class X11TextRenderer extends GlyphListPipe {
  46     /*
  47      * Override super class method to call the AA pipe if
  48      * AA is specified in the GlyphVector's FontRenderContext
  49      */
  50     public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector g,
  51                                 float x, float y)
  52     {
  53         FontRenderContext frc = g.getFontRenderContext();
  54         FontInfo info = sg2d.getGVFontInfo(g.getFont(), frc);
  55         switch (info.aaHint) {
  56         case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
  57             super.drawGlyphVector(sg2d, g, x, y);
  58             return;
  59         case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
  60              sg2d.surfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y);
  61             return;
  62         case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
  63         case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
  64              sg2d.surfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y);
  65             return;
  66         default:
  67         }
  68     }
  69 
  70     native void doDrawGlyphList(long dstData, long xgc,
  71                                 Region clip, GlyphList gl);
  72 
  73     protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
  74         SunToolkit.awtLock();
  75         try {
  76             X11SurfaceData x11sd = (X11SurfaceData)sg2d.surfaceData;
  77             Region clip = sg2d.getCompClip();
  78             long xgc = x11sd.getRenderGC(clip, SunGraphics2D.COMP_ISCOPY,
  79                                          null, sg2d.pixel);
  80             doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
  81         } finally {
  82             SunToolkit.awtUnlock();
  83         }
  84     }
   1 /*
   2  * Copyright (c) 2000, 2014, 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


  40 
  41 /**
  42  * A delegate pipe of SG2D for drawing text with
  43  * a solid source colour to an X11 drawable destination.
  44  */
  45 public class X11TextRenderer extends GlyphListPipe {
  46     /*
  47      * Override super class method to call the AA pipe if
  48      * AA is specified in the GlyphVector's FontRenderContext
  49      */
  50     public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector g,
  51                                 float x, float y)
  52     {
  53         FontRenderContext frc = g.getFontRenderContext();
  54         FontInfo info = sg2d.getGVFontInfo(g.getFont(), frc);
  55         switch (info.aaHint) {
  56         case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
  57             super.drawGlyphVector(sg2d, g, x, y);
  58             return;
  59         case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
  60              SurfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y);
  61             return;
  62         case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
  63         case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
  64              SurfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y);
  65             return;
  66         default:
  67         }
  68     }
  69 
  70     native void doDrawGlyphList(long dstData, long xgc,
  71                                 Region clip, GlyphList gl);
  72 
  73     protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
  74         SunToolkit.awtLock();
  75         try {
  76             X11SurfaceData x11sd = (X11SurfaceData)sg2d.surfaceData;
  77             Region clip = sg2d.getCompClip();
  78             long xgc = x11sd.getRenderGC(clip, SunGraphics2D.COMP_ISCOPY,
  79                                          null, sg2d.pixel);
  80             doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
  81         } finally {
  82             SunToolkit.awtUnlock();
  83         }
  84     }