0N/A/*
2362N/A * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage sun.font;
0N/A
0N/Aimport java.awt.Rectangle;
0N/Aimport java.awt.font.FontRenderContext;
0N/Aimport java.awt.font.GlyphVector;
0N/Aimport sun.awt.SunHints;
0N/Aimport sun.awt.SunToolkit;
0N/Aimport sun.java2d.SunGraphics2D;
0N/Aimport sun.java2d.SurfaceData;
0N/Aimport sun.java2d.pipe.GlyphListPipe;
0N/Aimport sun.java2d.pipe.Region;
0N/Aimport sun.java2d.loops.FontInfo;
0N/Aimport sun.java2d.loops.GraphicsPrimitive;
0N/Aimport sun.java2d.x11.X11SurfaceData;
0N/A
0N/A/**
0N/A * A delegate pipe of SG2D for drawing text with
0N/A * a solid source colour to an X11 drawable destination.
0N/A */
0N/Apublic class X11TextRenderer extends GlyphListPipe {
0N/A /*
0N/A * Override super class method to call the AA pipe if
0N/A * AA is specified in the GlyphVector's FontRenderContext
0N/A */
0N/A public void drawGlyphVector(SunGraphics2D sg2d, GlyphVector g,
0N/A float x, float y)
0N/A {
0N/A FontRenderContext frc = g.getFontRenderContext();
0N/A FontInfo info = sg2d.getGVFontInfo(g.getFont(), frc);
0N/A switch (info.aaHint) {
0N/A case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
0N/A super.drawGlyphVector(sg2d, g, x, y);
0N/A return;
0N/A case SunHints.INTVAL_TEXT_ANTIALIAS_ON:
0N/A sg2d.surfaceData.aaTextRenderer.drawGlyphVector(sg2d, g, x, y);
0N/A return;
0N/A case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_HRGB:
0N/A case SunHints.INTVAL_TEXT_ANTIALIAS_LCD_VRGB:
0N/A sg2d.surfaceData.lcdTextRenderer.drawGlyphVector(sg2d, g, x, y);
0N/A return;
0N/A default:
0N/A }
0N/A }
0N/A
0N/A native void doDrawGlyphList(long dstData, long xgc,
0N/A Region clip, GlyphList gl);
0N/A
0N/A protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl) {
0N/A SunToolkit.awtLock();
0N/A try {
0N/A X11SurfaceData x11sd = (X11SurfaceData)sg2d.surfaceData;
0N/A Region clip = sg2d.getCompClip();
0N/A long xgc = x11sd.getRenderGC(clip, SunGraphics2D.COMP_ISCOPY,
0N/A null, sg2d.pixel);
0N/A doDrawGlyphList(x11sd.getNativeOps(), xgc, clip, gl);
0N/A } finally {
0N/A SunToolkit.awtUnlock();
0N/A }
0N/A }
0N/A
0N/A public X11TextRenderer traceWrap() {
0N/A return new Tracer();
0N/A }
0N/A
0N/A public static class Tracer extends X11TextRenderer {
0N/A void doDrawGlyphList(long dstData, long xgc,
0N/A Region clip, GlyphList gl)
0N/A {
0N/A GraphicsPrimitive.tracePrimitive("X11DrawGlyphs");
0N/A super.doDrawGlyphList(dstData, xgc, clip, gl);
0N/A }
0N/A }
0N/A}