Path: blob/master/src/java.desktop/unix/native/libfontmanager/X11TextRenderer.c
41149 views
/*1* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/*26* Important note : All AWTxxx functions are defined in font.h.27* These were added to remove the dependency of this file on X11.28* These functions are used to perform X11 operations and should29* be "stubbed out" in environments that do not support X11.30* The implementation of these functions has been moved from this file31* into X11TextRenderer_md.c, which is compiled into another library.32*/3334#include "sun_font_X11TextRenderer.h"3536#include "Region.h"37#include "SurfaceData.h"38#include "GraphicsPrimitiveMgr.h"39#include "glyphblitting.h"40#include "sunfontids.h"41#include <stdlib.h>424344JNIEXPORT void JNICALL AWTDrawGlyphList45(JNIEnv *env, jobject xtr,46jlong dstData, jlong gc,47SurfaceDataBounds *bounds, ImageRef *glyphs, jint totalGlyphs);4849/*50* Class: sun_font_X11TextRenderer51* Method: doDrawGlyphList52* Signature: (Lsun/java2d/SurfaceData;Ljava/awt/Rectangle;ILsun/font/GlyphList;J)V53*/54JNIEXPORT void JNICALL Java_sun_font_X11TextRenderer_doDrawGlyphList55(JNIEnv *env, jobject xtr,56jlong dstData, jlong xgc, jobject clip,57jobject glyphlist)58{59jint glyphCount;60GlyphBlitVector* gbv;61SurfaceDataBounds bounds;62Region_GetBounds(env, clip, &bounds);6364glyphCount = (*env)->GetIntField(env, glyphlist, sunFontIDs.glyphListLen);65if ((gbv = setupBlitVector(env, glyphlist, 0, glyphCount)) == NULL) {66return;67}68if (!RefineBounds(gbv, &bounds)) {69free(gbv);70return;71}72AWTDrawGlyphList(env, xtr, dstData, xgc,73&bounds, gbv->glyphs, gbv->numGlyphs);74free(gbv);75}767778