aboutsummaryrefslogtreecommitdiff
path: root/src/share/native/sun
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/native/sun')
-rw-r--r--src/share/native/sun/font/freetypeScaler.c165
-rw-r--r--src/share/native/sun/font/layout/MorphTables2.cpp2
-rw-r--r--src/share/native/sun/java2d/opengl/OGLSurfaceData.c12
-rw-r--r--src/share/native/sun/java2d/opengl/OGLSurfaceData.h6
-rw-r--r--src/share/native/sun/security/krb5/nativeccache.c6
5 files changed, 96 insertions, 95 deletions
diff --git a/src/share/native/sun/font/freetypeScaler.c b/src/share/native/sun/font/freetypeScaler.c
index 4a45aaadde..65c24d42d2 100644
--- a/src/share/native/sun/font/freetypeScaler.c
+++ b/src/share/native/sun/font/freetypeScaler.c
@@ -48,6 +48,7 @@
#include FT_SIZES_H
#include FT_OUTLINE_H
#include FT_SYNTHESIS_H
+#include FT_LCD_FILTER_H
#include FT_MODULE_H
#include FT_LCD_FILTER_H
@@ -941,6 +942,8 @@ static int setupFTContext(JNIEnv *env, jobject font2D, FTScalerInfo *scalerInfo,
if (logFC) fprintf(stderr, "\n");
#endif
}
+
+ FT_Library_SetLcdFilter(scalerInfo->library, FT_LCD_FILTER_DEFAULT);
}
return 0;
@@ -1010,6 +1013,14 @@ Java_sun_font_FreetypeFontScaler_getFontMetricsNative(
/* See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657854 */
#define FT_MulFixFloatShift6(a, b) (((float) (a)) * ((float) (b)) / 65536.0 / 64.0)
+#define contextAwareMetricsX(x, y) \
+ (FTFixedToFloat(context->transform.xx) * (x) - \
+ FTFixedToFloat(context->transform.xy) * (y))
+
+#define contextAwareMetricsY(x, y) \
+ (-FTFixedToFloat(context->transform.yx) * (x) + \
+ FTFixedToFloat(context->transform.yy) * (y))
+
/*
* See FreeType source code: src/base/ftobjs.c ft_recompute_scaled_metrics()
* http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1659
@@ -1056,9 +1067,13 @@ Java_sun_font_FreetypeFontScaler_getFontMetricsNative(
mx = txx * mx;
metrics = (*env)->NewObject(env,
- sunFontIDs.strikeMetricsClass,
- sunFontIDs.strikeMetricsCtr,
- ax, ay, dx, dy, bx, by, lx, ly, mx, my);
+ sunFontIDs.strikeMetricsClass,
+ sunFontIDs.strikeMetricsCtr,
+ contextAwareMetricsX(ax, ay), contextAwareMetricsY(ax, ay),
+ contextAwareMetricsX(dx, dy), contextAwareMetricsY(dx, dy),
+ bx, by,
+ contextAwareMetricsX(lx, ly), contextAwareMetricsY(lx, ly),
+ contextAwareMetricsX(mx, my), contextAwareMetricsY(mx, my));
return metrics;
}
@@ -1125,10 +1140,14 @@ Java_sun_font_FreetypeFontScaler_getGlyphMetricsNative(
pScalerContext, pScaler, glyphCode);
info = (GlyphInfo*) jlong_to_ptr(image);
- (*env)->SetFloatField(env, metrics, sunFontIDs.xFID, info->advanceX);
- (*env)->SetFloatField(env, metrics, sunFontIDs.yFID, info->advanceY);
-
- free(info);
+ if (info != NULL) {
+ (*env)->SetFloatField(env, metrics, sunFontIDs.xFID, info->advanceX);
+ (*env)->SetFloatField(env, metrics, sunFontIDs.yFID, info->advanceY);
+ free(info);
+ } else {
+ (*env)->SetFloatField(env, metrics, sunFontIDs.xFID, 0.0f);
+ (*env)->SetFloatField(env, metrics, sunFontIDs.yFID, 0.0f);
+ }
}
@@ -1680,86 +1699,60 @@ static int allocateSpaceForGP(GPData* gpdata, int npoints, int ncontours) {
return 1;
}
+static void addSeg(GPData *gp, jbyte type) {
+ gp->pointTypes[gp->numTypes++] = type;
+}
+
+static void addCoords(GPData *gp, FT_Vector *p) {
+ gp->pointCoords[gp->numCoords++] = F26Dot6ToFloat(p->x);
+ gp->pointCoords[gp->numCoords++] = -F26Dot6ToFloat(p->y);
+}
+
+static int moveTo(FT_Vector *to, GPData *gp) {
+ if (gp->numCoords)
+ addSeg(gp, SEG_CLOSE);
+ addCoords(gp, to);
+ addSeg(gp, SEG_MOVETO);
+ return FT_Err_Ok;
+}
+
+static int lineTo(FT_Vector *to, GPData *gp) {
+ addCoords(gp, to);
+ addSeg(gp, SEG_LINETO);
+ return FT_Err_Ok;
+}
+
+static int conicTo(FT_Vector *control, FT_Vector *to, GPData *gp) {
+ addCoords(gp, control);
+ addCoords(gp, to);
+ addSeg(gp, SEG_QUADTO);
+ return FT_Err_Ok;
+}
+
+static int cubicTo(FT_Vector *control1,
+ FT_Vector *control2,
+ FT_Vector *to,
+ GPData *gp) {
+ addCoords(gp, control1);
+ addCoords(gp, control2);
+ addCoords(gp, to);
+ addSeg(gp, SEG_CUBICTO);
+ return FT_Err_Ok;
+}
+
static void addToGP(GPData* gpdata, FT_Outline*outline) {
- jbyte current_type=SEG_UNKNOWN;
- int i, j;
- jfloat x, y;
-
- j = 0;
- for(i=0; i<outline->n_points; i++) {
- x = F26Dot6ToFloat(outline->points[i].x);
- y = -F26Dot6ToFloat(outline->points[i].y);
-
- if (FT_CURVE_TAG(outline->tags[i]) == FT_CURVE_TAG_ON) {
- /* If bit 0 is unset, the point is "off" the curve,
- i.e., a Bezier control point, while it is "on" when set. */
- if (current_type == SEG_UNKNOWN) { /* special case:
- very first point */
- /* add segment */
- gpdata->pointTypes[gpdata->numTypes++] = SEG_MOVETO;
- current_type = SEG_LINETO;
- } else {
- gpdata->pointTypes[gpdata->numTypes++] = current_type;
- current_type = SEG_LINETO;
- }
- } else {
- if (current_type == SEG_UNKNOWN) { /* special case:
- very first point */
- if (FT_CURVE_TAG(outline->tags[i+1]) == FT_CURVE_TAG_ON) {
- /* just skip first point. Adhoc heuristic? */
- continue;
- } else {
- x = (x + F26Dot6ToFloat(outline->points[i+1].x))/2;
- y = (y - F26Dot6ToFloat(outline->points[i+1].y))/2;
- gpdata->pointTypes[gpdata->numTypes++] = SEG_MOVETO;
- current_type = SEG_LINETO;
- }
- } else if (FT_CURVE_TAG(outline->tags[i]) == FT_CURVE_TAG_CUBIC) {
- /* Bit 1 is meaningful for 'off' points only.
- If set, it indicates a third-order Bezier arc control
- point; and a second-order control point if unset. */
- current_type = SEG_CUBICTO;
- } else {
- /* two successive conic "off" points forces the rasterizer
- to create (during the scan-line conversion process
- exclusively) a virtual "on" point amidst them, at their
- exact middle. This greatly facilitates the definition of
- successive conic Bezier arcs. Moreover, it is the way
- outlines are described in the TrueType specification. */
- if (current_type == SEG_QUADTO) {
- gpdata->pointCoords[gpdata->numCoords++] =
- F26Dot6ToFloat(outline->points[i].x +
- outline->points[i-1].x)/2;
- gpdata->pointCoords[gpdata->numCoords++] =
- - F26Dot6ToFloat(outline->points[i].y +
- outline->points[i-1].y)/2;
- gpdata->pointTypes[gpdata->numTypes++] = SEG_QUADTO;
- }
- current_type = SEG_QUADTO;
- }
- }
- gpdata->pointCoords[gpdata->numCoords++] = x;
- gpdata->pointCoords[gpdata->numCoords++] = y;
- if (outline->contours[j] == i) { //end of contour
- int start = j > 0 ? outline->contours[j-1]+1 : 0;
- gpdata->pointTypes[gpdata->numTypes++] = current_type;
- if (current_type == SEG_QUADTO &&
- FT_CURVE_TAG(outline->tags[start]) != FT_CURVE_TAG_ON) {
- gpdata->pointCoords[gpdata->numCoords++] =
- (F26Dot6ToFloat(outline->points[start].x) + x)/2;
- gpdata->pointCoords[gpdata->numCoords++] =
- (-F26Dot6ToFloat(outline->points[start].y) + y)/2;
- } else {
- gpdata->pointCoords[gpdata->numCoords++] =
- F26Dot6ToFloat(outline->points[start].x);
- gpdata->pointCoords[gpdata->numCoords++] =
- -F26Dot6ToFloat(outline->points[start].y);
- }
- gpdata->pointTypes[gpdata->numTypes++] = SEG_CLOSE;
- current_type = SEG_UNKNOWN;
- j++;
- }
- }
+ static const FT_Outline_Funcs outline_funcs = {
+ (FT_Outline_MoveToFunc) moveTo,
+ (FT_Outline_LineToFunc) lineTo,
+ (FT_Outline_ConicToFunc) conicTo,
+ (FT_Outline_CubicToFunc) cubicTo,
+ 0, /* shift */
+ 0, /* delta */
+ };
+
+ FT_Outline_Decompose(outline, &outline_funcs, gpdata);
+ if (gpdata->numCoords)
+ addSeg(gpdata, SEG_CLOSE);
/* If set to 1, the outline will be filled using the even-odd fill rule */
if (outline->flags & FT_OUTLINE_EVEN_ODD_FILL) {
diff --git a/src/share/native/sun/font/layout/MorphTables2.cpp b/src/share/native/sun/font/layout/MorphTables2.cpp
index ff69cb9a41..eb628a1a32 100644
--- a/src/share/native/sun/font/layout/MorphTables2.cpp
+++ b/src/share/native/sun/font/layout/MorphTables2.cpp
@@ -192,7 +192,7 @@ void MorphTableHeader2::process(const LEReferenceTo<MorphTableHeader2> &base, LE
for (subtable = 0; LE_SUCCESS(success) && subtable < nSubtables; subtable++) {
if(subtable>0) {
le_uint32 length = SWAPL(subtableHeader->length);
- if (length & 0x03) { // incorrect alignment for 32 bit tables
+ if (length & 0x01) { // incorrect alignment for 32 bit tables
success = LE_MEMORY_ALLOCATION_ERROR; // as good a choice as any
return;
}
diff --git a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c
index 83c0b59f32..8bff4a89e4 100644
--- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c
+++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
* The following methods are implemented in the windowing system (i.e. GLX
* and WGL) source files.
*/
-extern jlong OGLSD_GetNativeConfigInfo(OGLSDOps *oglsdo);
extern jboolean OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo);
extern void OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo);
@@ -593,11 +592,14 @@ void
OGLSD_Dispose(JNIEnv *env, SurfaceDataOps *ops)
{
OGLSDOps *oglsdo = (OGLSDOps *)ops;
- jlong pConfigInfo = OGLSD_GetNativeConfigInfo(oglsdo);
+ jobject graphicsConfig = oglsdo->graphicsConfig;
JNU_CallStaticMethodByName(env, NULL, "sun/java2d/opengl/OGLSurfaceData",
- "dispose", "(JJ)V",
- ptr_to_jlong(ops), pConfigInfo);
+ "dispose",
+ "(JLsun/java2d/opengl/OGLGraphicsConfig;)V",
+ ptr_to_jlong(ops), graphicsConfig);
+ (*env)->DeleteGlobalRef(env, graphicsConfig);
+ oglsdo->graphicsConfig = NULL;
}
/**
diff --git a/src/share/native/sun/java2d/opengl/OGLSurfaceData.h b/src/share/native/sun/java2d/opengl/OGLSurfaceData.h
index 0fc8b3b4da..62c48ee434 100644
--- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.h
+++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -85,6 +85,9 @@ typedef struct {
* Pointer to native-specific (GLX, WGL, etc.) SurfaceData info, such as the
* native Drawable handle and GraphicsConfig data.
*
+ * jobject graphicsConfig;;
+ * Strong reference to the OGLGraphicsConfig used by this OGLSurfaceData.
+ *
* jint drawableType;
* The surface type; can be any one of the surface type constants defined
* below (OGLSD_WINDOW, OGLSD_TEXTURE, etc).
@@ -162,6 +165,7 @@ typedef struct {
struct _OGLSDOps {
SurfaceDataOps sdOps;
void *privOps;
+ jobject graphicsConfig;
jint drawableType;
GLenum activeBuffer;
jboolean isOpaque;
diff --git a/src/share/native/sun/security/krb5/nativeccache.c b/src/share/native/sun/security/krb5/nativeccache.c
index 1b50a2e176..5ab3f737f2 100644
--- a/src/share/native/sun/security/krb5/nativeccache.c
+++ b/src/share/native/sun/security/krb5/nativeccache.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -418,7 +418,7 @@ JNIEXPORT jobject JNICALL Java_sun_security_krb5_Credentials_acquireDefaultNativ
if (krbcredsConstructor == 0) {
krbcredsConstructor = (*env)->GetMethodID(env, krbcredsClass, "<init>",
- "(Lsun/security/krb5/internal/Ticket;Lsun/security/krb5/PrincipalName;Lsun/security/krb5/PrincipalName;Lsun/security/krb5/EncryptionKey;Lsun/security/krb5/internal/TicketFlags;Lsun/security/krb5/internal/KerberosTime;Lsun/security/krb5/internal/KerberosTime;Lsun/security/krb5/internal/KerberosTime;Lsun/security/krb5/internal/KerberosTime;Lsun/security/krb5/internal/HostAddresses;)V");
+ "(Lsun/security/krb5/internal/Ticket;Lsun/security/krb5/PrincipalName;Lsun/security/krb5/PrincipalName;Lsun/security/krb5/PrincipalName;Lsun/security/krb5/PrincipalName;Lsun/security/krb5/EncryptionKey;Lsun/security/krb5/internal/TicketFlags;Lsun/security/krb5/internal/KerberosTime;Lsun/security/krb5/internal/KerberosTime;Lsun/security/krb5/internal/KerberosTime;Lsun/security/krb5/internal/KerberosTime;Lsun/security/krb5/internal/HostAddresses;)V");
if (krbcredsConstructor == 0) {
printf("Couldn't find sun.security.krb5.internal.Ticket constructor\n");
break;
@@ -432,7 +432,9 @@ JNIEXPORT jobject JNICALL Java_sun_security_krb5_Credentials_acquireDefaultNativ
krbcredsConstructor,
ticket,
clientPrincipal,
+ NULL,
targetPrincipal,
+ NULL,
encryptionKey,
ticketFlags,
authTime,