< prev index next >

src/java.desktop/share/native/libfontmanager/sunFont.c

Print this page
rev 12879 : 8136556: Add the ability to perform static builds of MacOSX x64 binaries
Reviewed-by: ihse, bdelsart, gadams, lfoltan, rriggs, hseigel, twisti
   1 /*
   2  * Copyright (c) 2007, 2013, 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
  23  * questions.
  24  */
  25 
  26 #include "stdlib.h"
  27 #include "string.h"
  28 #include "gdefs.h"
  29 #include "jlong.h"
  30 #include "jni_util.h"
  31 #include "sunfontids.h"
  32 #include "fontscalerdefs.h"
  33 #include "sun_font_SunFontManager.h"
  34 #include "sun_font_NullFontScaler.h"
  35 #include "sun_font_StrikeCache.h"
  36 
  37 static void *theNullScalerContext = NULL;
  38 extern void AccelGlyphCache_RemoveAllCellInfos(GlyphInfo *glyph);
  39 




  40 
  41 JNIEXPORT jlong JNICALL
  42 Java_sun_font_NullFontScaler_getNullScalerContext
  43     (JNIEnv *env, jclass scalerClass) {
  44 
  45     if (theNullScalerContext == NULL) {
  46         theNullScalerContext = malloc(1);
  47     }
  48     return ptr_to_jlong(theNullScalerContext);
  49 }
  50 
  51 int isNullScalerContext(void *context) {
  52     return theNullScalerContext == context;
  53 }
  54 
  55 /* Eventually we may rework it to be a singleton.
  56  * This will require additional checks in freeLongMemory/freeIntMemory
  57  * and on other hand malformed fonts (main source of null glyph images)
  58  * are supposed to be collected fast.
  59  * But perhaps it is still right thing to do.


   1 /*
   2  * Copyright (c) 2007, 2015, 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
  23  * questions.
  24  */
  25 
  26 #include "stdlib.h"
  27 #include "string.h"
  28 #include "gdefs.h"
  29 #include "jlong.h"
  30 #include "jni_util.h"
  31 #include "sunfontids.h"
  32 #include "fontscalerdefs.h"
  33 #include "sun_font_SunFontManager.h"
  34 #include "sun_font_NullFontScaler.h"
  35 #include "sun_font_StrikeCache.h"
  36 
  37 static void *theNullScalerContext = NULL;
  38 extern void AccelGlyphCache_RemoveAllCellInfos(GlyphInfo *glyph);
  39 
  40 /*
  41  * Declare library specific JNI_Onload entry if static build
  42  */
  43 DEF_STATIC_JNI_OnLoad
  44 
  45 JNIEXPORT jlong JNICALL
  46 Java_sun_font_NullFontScaler_getNullScalerContext
  47     (JNIEnv *env, jclass scalerClass) {
  48 
  49     if (theNullScalerContext == NULL) {
  50         theNullScalerContext = malloc(1);
  51     }
  52     return ptr_to_jlong(theNullScalerContext);
  53 }
  54 
  55 int isNullScalerContext(void *context) {
  56     return theNullScalerContext == context;
  57 }
  58 
  59 /* Eventually we may rework it to be a singleton.
  60  * This will require additional checks in freeLongMemory/freeIntMemory
  61  * and on other hand malformed fonts (main source of null glyph images)
  62  * are supposed to be collected fast.
  63  * But perhaps it is still right thing to do.


< prev index next >