src/java.desktop/share/native/libfontmanager/sunFont.c
author ihse
Sat, 03 Mar 2018 08:21:47 +0100
branchihse-warnings-cflags-branch
changeset 56230 489867818774
parent 47216 71c04702a3d5
permissions -rw-r--r--
No longer disable E_OLD_STYLE_FUNC_DEF.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 25859
diff changeset
     2
 * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3928
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3928
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3928
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3928
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3928
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include "stdlib.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include "string.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "gdefs.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "jlong.h"
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    30
#include "jni_util.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include "sunfontids.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "fontscalerdefs.h"
12392
af6c2083c5d7 7159136: JDK 7 font manager refactoring left JNI header generation and inclusion out of sync
prr
parents: 12047
diff changeset
    33
#include "sun_font_SunFontManager.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "sun_font_NullFontScaler.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "sun_font_StrikeCache.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
static void *theNullScalerContext = NULL;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    38
extern void AccelGlyphCache_RemoveAllCellInfos(GlyphInfo *glyph);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    39
33653
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 25859
diff changeset
    40
/*
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 25859
diff changeset
    41
 * Declare library specific JNI_Onload entry if static build
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 25859
diff changeset
    42
 */
c1ee09fe3274 8136556: Add the ability to perform static builds of MacOSX x64 binaries
bobv
parents: 25859
diff changeset
    43
DEF_STATIC_JNI_OnLoad
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
JNIEXPORT jlong JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
Java_sun_font_NullFontScaler_getNullScalerContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    (JNIEnv *env, jclass scalerClass) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    if (theNullScalerContext == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        theNullScalerContext = malloc(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    return ptr_to_jlong(theNullScalerContext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
int isNullScalerContext(void *context) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    return theNullScalerContext == context;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
/* Eventually we may rework it to be a singleton.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * This will require additional checks in freeLongMemory/freeIntMemory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * and on other hand malformed fonts (main source of null glyph images)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * are supposed to be collected fast.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * But perhaps it is still right thing to do.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * Even better is to eliminate the need to have this native method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * but for this it is necessary to rework Strike and drawing logic
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * to be able to live with NULL pointers without performance hit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
JNIEXPORT jlong JNICALL Java_sun_font_NullFontScaler_getGlyphImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  (JNIEnv *env, jobject scaler, jlong pContext, jint glyphCode) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    void *nullscaler = calloc(sizeof(GlyphInfo), 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    return ptr_to_jlong(nullscaler);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
void initLCDGammaTables();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
/* placeholder for extern variable */
19356
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
    79
static int initialisedFontIDs = 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
FontManagerNativeIDs sunFontIDs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
19356
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
    82
static void initFontIDs(JNIEnv *env) {
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
    83
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
    84
     jclass tmpClass;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
19356
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
    86
     if (initialisedFontIDs) {
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
    87
        return;
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
    88
     }
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    89
     CHECK_NULL(tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    90
     CHECK_NULL(sunFontIDs.ttReadBlockMID =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
         (*env)->GetMethodID(env, tmpClass, "readBlock",
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    92
                             "(Ljava/nio/ByteBuffer;II)I"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    93
     CHECK_NULL(sunFontIDs.ttReadBytesMID =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    94
         (*env)->GetMethodID(env, tmpClass, "readBytes", "(II)[B"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    96
     CHECK_NULL(tmpClass = (*env)->FindClass(env, "sun/font/Type1Font"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    97
     CHECK_NULL(sunFontIDs.readFileMID =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
         (*env)->GetMethodID(env, tmpClass,
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
    99
                             "readFile", "(Ljava/nio/ByteBuffer;)V"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   101
     CHECK_NULL(tmpClass =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   102
         (*env)->FindClass(env, "java/awt/geom/Point2D$Float"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     sunFontIDs.pt2DFloatClass = (jclass)(*env)->NewGlobalRef(env, tmpClass);
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   104
     CHECK_NULL(sunFontIDs.pt2DFloatCtr =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   105
         (*env)->GetMethodID(env, sunFontIDs.pt2DFloatClass, "<init>","(FF)V"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   107
     CHECK_NULL(sunFontIDs.xFID =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   108
         (*env)->GetFieldID(env, sunFontIDs.pt2DFloatClass, "x", "F"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   109
     CHECK_NULL(sunFontIDs.yFID =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   110
         (*env)->GetFieldID(env, sunFontIDs.pt2DFloatClass, "y", "F"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   112
     CHECK_NULL(tmpClass = (*env)->FindClass(env, "sun/font/StrikeMetrics"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   113
     CHECK_NULL(sunFontIDs.strikeMetricsClass =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   114
         (jclass)(*env)->NewGlobalRef(env, tmpClass));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   116
     CHECK_NULL(sunFontIDs.strikeMetricsCtr =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
         (*env)->GetMethodID(env, sunFontIDs.strikeMetricsClass,
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   118
                             "<init>", "(FFFFFFFFFF)V"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   120
     CHECK_NULL(tmpClass =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   121
         (*env)->FindClass(env, "java/awt/geom/Rectangle2D$Float"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     sunFontIDs.rect2DFloatClass = (jclass)(*env)->NewGlobalRef(env, tmpClass);
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   123
     CHECK_NULL(sunFontIDs.rect2DFloatCtr =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   124
         (*env)->GetMethodID(env, sunFontIDs.rect2DFloatClass, "<init>", "()V"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   125
     CHECK_NULL(sunFontIDs.rect2DFloatCtr4 =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   126
         (*env)->GetMethodID(env, sunFontIDs.rect2DFloatClass,
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   127
                            "<init>", "(FFFF)V"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   128
     CHECK_NULL(sunFontIDs.rectF2DX =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   129
         (*env)->GetFieldID(env, sunFontIDs.rect2DFloatClass, "x", "F"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   130
     CHECK_NULL(sunFontIDs.rectF2DY =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   131
         (*env)->GetFieldID(env, sunFontIDs.rect2DFloatClass, "y", "F"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   132
     CHECK_NULL(sunFontIDs.rectF2DWidth =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   133
         (*env)->GetFieldID(env, sunFontIDs.rect2DFloatClass, "width", "F"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   134
     CHECK_NULL(sunFontIDs.rectF2DHeight =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   135
         (*env)->GetFieldID(env, sunFontIDs.rect2DFloatClass, "height", "F"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   137
     CHECK_NULL(tmpClass = (*env)->FindClass(env, "java/awt/geom/GeneralPath"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     sunFontIDs.gpClass = (jclass)(*env)->NewGlobalRef(env, tmpClass);
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   139
     CHECK_NULL(sunFontIDs.gpCtr =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   140
         (*env)->GetMethodID(env, sunFontIDs.gpClass, "<init>", "(I[BI[FI)V"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   141
     CHECK_NULL(sunFontIDs.gpCtrEmpty =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   142
         (*env)->GetMethodID(env, sunFontIDs.gpClass, "<init>", "()V"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   144
     CHECK_NULL(tmpClass = (*env)->FindClass(env, "sun/font/Font2D"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   145
     CHECK_NULL(sunFontIDs.f2dCharToGlyphMID =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   146
         (*env)->GetMethodID(env, tmpClass, "charToGlyph", "(I)I"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   147
     CHECK_NULL(sunFontIDs.getMapperMID =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
         (*env)->GetMethodID(env, tmpClass, "getMapper",
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   149
                             "()Lsun/font/CharToGlyphMapper;"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   150
     CHECK_NULL(sunFontIDs.getTableBytesMID =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   151
         (*env)->GetMethodID(env, tmpClass, "getTableBytes", "(I)[B"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   152
     CHECK_NULL(sunFontIDs.canDisplayMID =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   153
         (*env)->GetMethodID(env, tmpClass, "canDisplay", "(C)Z"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   155
     CHECK_NULL(tmpClass = (*env)->FindClass(env, "sun/font/CharToGlyphMapper"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   156
     CHECK_NULL(sunFontIDs.charToGlyphMID =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   157
        (*env)->GetMethodID(env, tmpClass, "charToGlyph", "(I)I"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   159
     CHECK_NULL(tmpClass = (*env)->FindClass(env, "sun/font/PhysicalStrike"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   160
     CHECK_NULL(sunFontIDs.getGlyphMetricsMID =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
         (*env)->GetMethodID(env, tmpClass, "getGlyphMetrics",
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   162
                             "(I)Ljava/awt/geom/Point2D$Float;"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   163
     CHECK_NULL(sunFontIDs.getGlyphPointMID =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
         (*env)->GetMethodID(env, tmpClass, "getGlyphPoint",
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   165
                             "(II)Ljava/awt/geom/Point2D$Float;"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   166
     CHECK_NULL(sunFontIDs.adjustPointMID =
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
         (*env)->GetMethodID(env, tmpClass, "adjustPoint",
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   168
                             "(Ljava/awt/geom/Point2D$Float;)V"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   169
     CHECK_NULL(sunFontIDs.pScalerContextFID =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   170
         (*env)->GetFieldID(env, tmpClass, "pScalerContext", "J"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
23695
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   172
     CHECK_NULL(tmpClass = (*env)->FindClass(env, "sun/font/GlyphList"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   173
     CHECK_NULL(sunFontIDs.glyphListX =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   174
         (*env)->GetFieldID(env, tmpClass, "x", "F"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   175
     CHECK_NULL(sunFontIDs.glyphListY =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   176
         (*env)->GetFieldID(env, tmpClass, "y", "F"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   177
     CHECK_NULL(sunFontIDs.glyphListLen =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   178
         (*env)->GetFieldID(env, tmpClass, "len", "I"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   179
     CHECK_NULL(sunFontIDs.glyphImages =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   180
         (*env)->GetFieldID(env, tmpClass, "images", "[J"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   181
     CHECK_NULL(sunFontIDs.glyphListUsePos =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   182
         (*env)->GetFieldID(env, tmpClass, "usePositions", "Z"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   183
     CHECK_NULL(sunFontIDs.glyphListPos =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   184
         (*env)->GetFieldID(env, tmpClass, "positions", "[F"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   185
     CHECK_NULL(sunFontIDs.lcdRGBOrder =
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   186
         (*env)->GetFieldID(env, tmpClass, "lcdRGBOrder", "Z"));
3eb0829f4e08 8029008: [Parfait] warnings from b116 for jdk.src.share.native.sun.font: JNI exceptions pending
prr
parents: 23010
diff changeset
   187
     CHECK_NULL(sunFontIDs.lcdSubPixPos =
23699
fa664c1f28c1 8038217: SunFontManager.initIDs NoSuchFieldError: lcdSubPixPos
pchelko
parents: 23695
diff changeset
   188
         (*env)->GetFieldID(env, tmpClass, "lcdSubPixPos", "Z"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     initLCDGammaTables();
19356
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   191
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   192
     initialisedFontIDs = 1;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
19356
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   195
JNIEXPORT void JNICALL
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   196
Java_sun_font_SunFontManager_initIDs
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   197
    (JNIEnv *env, jclass cls) {
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   198
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   199
    initFontIDs(env);
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   200
}
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   201
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   202
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) {
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   203
6f8b216b81bd 8017580: Crash in font loading code on Linux (due to use of reflection)
prr
parents: 16891
diff changeset
   204
    initFontIDs(env);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    return sunFontIDs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 * Class:     sun_font_StrikeCache
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 * Method:    freeIntPointer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 * Signature: (I)V
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeIntPointer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    (JNIEnv *env, jclass cacheClass, jint ptr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    /* Note this is used for freeing a glyph which was allocated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * but never placed into the glyph cache. The caller holds the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * only reference, therefore it is unnecessary to invalidate any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * accelerated glyph cache cells as we do in freeInt/LongMemory().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    if (ptr != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        free((void*)ptr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
 * Class:     sun_font_StrikeCache
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 * Method:    freeLongPointer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 * Signature: (J)V
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeLongPointer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    (JNIEnv *env, jclass cacheClass, jlong ptr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    /* Note this is used for freeing a glyph which was allocated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * but never placed into the glyph cache. The caller holds the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * only reference, therefore it is unnecessary to invalidate any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * accelerated glyph cache cells as we do in freeInt/LongMemory().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    if (ptr != 0L) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        free(jlong_to_ptr(ptr));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * Class:     sun_font_StrikeCache
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * Method:    freeIntMemory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 * Signature: ([I)V
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeIntMemory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    (JNIEnv *env, jclass cacheClass, jintArray jmemArray, jlong pContext) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    int len = (*env)->GetArrayLength(env, jmemArray);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    jint* ptrs =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        (jint*)(*env)->GetPrimitiveArrayCritical(env, jmemArray, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    if (ptrs) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        for (i=0; i< len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            if (ptrs[i] != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                GlyphInfo *ginfo = (GlyphInfo *)ptrs[i];
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3928
diff changeset
   261
                if (ginfo->cellInfo != NULL &&
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3928
diff changeset
   262
                    ginfo->managed == MANAGED_GLYPH) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                    // invalidate this glyph's accelerated cache cell
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   264
                    AccelGlyphCache_RemoveAllCellInfos(ginfo);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                free((void*)ginfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        (*env)->ReleasePrimitiveArrayCritical(env, jmemArray, ptrs, JNI_ABORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    if (!isNullScalerContext(jlong_to_ptr(pContext))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        free(jlong_to_ptr(pContext));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 * Class:     sun_font_StrikeCache
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
 * Method:    freeLongMemory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 * Signature: ([J)V
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
JNIEXPORT void JNICALL Java_sun_font_StrikeCache_freeLongMemory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    (JNIEnv *env, jclass cacheClass, jlongArray jmemArray, jlong pContext) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    int len = (*env)->GetArrayLength(env, jmemArray);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    jlong* ptrs =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        (jlong*)(*env)->GetPrimitiveArrayCritical(env, jmemArray, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    if (ptrs) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        for (i=0; i< len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            if (ptrs[i] != 0L) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                GlyphInfo *ginfo = (GlyphInfo *) jlong_to_ptr(ptrs[i]);
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3928
diff changeset
   293
                if (ginfo->cellInfo != NULL &&
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3928
diff changeset
   294
                    ginfo->managed == MANAGED_GLYPH) {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   295
                    AccelGlyphCache_RemoveAllCellInfos(ginfo);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                free((void*)ginfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        (*env)->ReleasePrimitiveArrayCritical(env, jmemArray, ptrs, JNI_ABORT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    if (!isNullScalerContext(jlong_to_ptr(pContext))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        free(jlong_to_ptr(pContext));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
JNIEXPORT void JNICALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
Java_sun_font_StrikeCache_getGlyphCacheDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
  (JNIEnv *env, jclass cls, jlongArray results) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    jlong* nresults;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    GlyphInfo *info;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    size_t baseAddr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3928
diff changeset
   315
    if ((*env)->GetArrayLength(env, results) < 13) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    nresults = (jlong*)(*env)->GetPrimitiveArrayCritical(env, results, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    if (nresults == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    info = (GlyphInfo*) calloc(1, sizeof(GlyphInfo));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    if (info == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
        (*env)->ReleasePrimitiveArrayCritical(env, results, nresults, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    baseAddr = (size_t)info;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    nresults[0] = sizeof(void*);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    nresults[1] = sizeof(GlyphInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    nresults[2] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    nresults[3] = (size_t)&(info->advanceY)-baseAddr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    nresults[4] = (size_t)&(info->width)-baseAddr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    nresults[5] = (size_t)&(info->height)-baseAddr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    nresults[6] = (size_t)&(info->rowBytes)-baseAddr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    nresults[7] = (size_t)&(info->topLeftX)-baseAddr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    nresults[8] = (size_t)&(info->topLeftY)-baseAddr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    nresults[9] = (size_t)&(info->image)-baseAddr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    nresults[10] = (jlong)(uintptr_t)info; /* invisible glyph */
5579
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3928
diff changeset
   340
    nresults[11] = (size_t)&(info->cellInfo)-baseAddr;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3928
diff changeset
   341
    nresults[12] = (size_t)&(info->managed)-baseAddr;
1a5e995a710b 6307603: [X11] Use RENDER extension for complex operations done in software
ceisserer
parents: 3928
diff changeset
   342
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    (*env)->ReleasePrimitiveArrayCritical(env, results, nresults, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
56230
489867818774 No longer disable E_OLD_STYLE_FUNC_DEF.
ihse
parents: 47216
diff changeset
   346
JNIEXPORT TTLayoutTableCache* newLayoutTableCache(void) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
  TTLayoutTableCache* ltc = calloc(1, sizeof(TTLayoutTableCache));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
  if (ltc) {
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 12392
diff changeset
   349
    int i;
91e99bed64ae 8001031: Better font processing
prr
parents: 12392
diff changeset
   350
    for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
91e99bed64ae 8001031: Better font processing
prr
parents: 12392
diff changeset
   351
      ltc->entries[i].len = -1;
91e99bed64ae 8001031: Better font processing
prr
parents: 12392
diff changeset
   352
    }
47188
0048f025c993 8186317: Cache font layout tables for use by harfbuzz
prr
parents: 33653
diff changeset
   353
    ltc->entries[0].tag = GDEF_TAG;
0048f025c993 8186317: Cache font layout tables for use by harfbuzz
prr
parents: 33653
diff changeset
   354
    ltc->entries[1].tag = GPOS_TAG;
0048f025c993 8186317: Cache font layout tables for use by harfbuzz
prr
parents: 33653
diff changeset
   355
    ltc->entries[2].tag = GSUB_TAG;
0048f025c993 8186317: Cache font layout tables for use by harfbuzz
prr
parents: 33653
diff changeset
   356
    ltc->entries[3].tag = HEAD_TAG;
0048f025c993 8186317: Cache font layout tables for use by harfbuzz
prr
parents: 33653
diff changeset
   357
    ltc->entries[4].tag = KERN_TAG;
0048f025c993 8186317: Cache font layout tables for use by harfbuzz
prr
parents: 33653
diff changeset
   358
    ltc->entries[5].tag = MORT_TAG;
0048f025c993 8186317: Cache font layout tables for use by harfbuzz
prr
parents: 33653
diff changeset
   359
    ltc->entries[6].tag = MORX_TAG;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
  return ltc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
JNIEXPORT void freeLayoutTableCache(TTLayoutTableCache* ltc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
  if (ltc) {
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 12392
diff changeset
   366
    int i;
91e99bed64ae 8001031: Better font processing
prr
parents: 12392
diff changeset
   367
    for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
91e99bed64ae 8001031: Better font processing
prr
parents: 12392
diff changeset
   368
      if(ltc->entries[i].ptr) free (ltc->entries[i].ptr);
91e99bed64ae 8001031: Better font processing
prr
parents: 12392
diff changeset
   369
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    if (ltc->kernPairs) free(ltc->kernPairs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    free(ltc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
}