提交 a715a5cc 编写于 作者: S simonis

7191872: Xrender: No text displayed using 64 bit JDK on solaris11-sparc

Reviewed-by: prr, ceisserer
上级 ec336348
......@@ -747,14 +747,9 @@ public class FileFontStrike extends PhysicalStrike {
return origMinX;
}
long pixelData;
if (StrikeCache.nativeAddressSize == 4) {
pixelData = 0xffffffff &
StrikeCache.unsafe.getInt(ptr + StrikeCache.pixelDataOffset);
} else {
pixelData =
StrikeCache.unsafe.getLong(ptr + StrikeCache.pixelDataOffset);
}
long pixelData =
StrikeCache.unsafe.getAddress(ptr + StrikeCache.pixelDataOffset);
if (pixelData == 0L) {
return origMinX;
}
......
......@@ -361,16 +361,10 @@ public final class GlyphList {
graybits = new byte[len];
}
}
long pixelDataAddress;
if (StrikeCache.nativeAddressSize == 4) {
pixelDataAddress = 0xffffffff &
StrikeCache.unsafe.getInt(images[glyphindex] +
long pixelDataAddress =
StrikeCache.unsafe.getAddress(images[glyphindex] +
StrikeCache.pixelDataOffset);
} else {
pixelDataAddress =
StrikeCache.unsafe.getLong(images[glyphindex] +
StrikeCache.pixelDataOffset);
}
if (pixelDataAddress == 0L) {
return graybits;
}
......
......@@ -69,11 +69,28 @@ public class XRGlyphCacheEntry {
}
public static int getGlyphID(long glyphInfoPtr) {
return (int) StrikeCache.unsafe.getInt(glyphInfoPtr + StrikeCache.cacheCellOffset);
// We need to access the GlyphID with Unsafe.getAddress() because the
// corresponding field in the underlying C data-structure is of type
// 'void*' (see field 'cellInfo' of struct 'GlyphInfo'
// in src/share/native/sun/font/fontscalerdefs.h).
// On 64-bit Big-endian architectures it would be wrong to access this
// field with Unsafe.getInt().
return (int) StrikeCache.unsafe.getAddress(glyphInfoPtr +
StrikeCache.cacheCellOffset);
}
public static void setGlyphID(long glyphInfoPtr, int id) {
StrikeCache.unsafe.putInt(glyphInfoPtr + StrikeCache.cacheCellOffset, id);
// We need to access the GlyphID with Unsafe.putAddress() because the
// corresponding field in the underlying C data-structure is of type
// 'void*' (see field 'cellInfo' of struct 'GlyphInfo' in
// src/share/native/sun/font/fontscalerdefs.h).
// On 64-bit Big-endian architectures it would be wrong to write this
// field with Unsafe.putInt() because it is also accessed from native
// code as a 'long'.
// See Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative()
// in src/solaris/native/sun/java2d/x11/XRBackendNative.c
StrikeCache.unsafe.putAddress(glyphInfoPtr +
StrikeCache.cacheCellOffset, (long)id);
}
public int getGlyphID() {
......@@ -105,12 +122,9 @@ public class XRGlyphCacheEntry {
}
public void writePixelData(ByteArrayOutputStream os, boolean uploadAsLCD) {
long pixelDataAddress;
if (StrikeCache.nativeAddressSize == 4) {
pixelDataAddress = 0xffffffff & StrikeCache.unsafe.getInt(glyphInfoPtr + StrikeCache.pixelDataOffset);
} else {
pixelDataAddress = StrikeCache.unsafe.getLong(glyphInfoPtr + StrikeCache.pixelDataOffset);
}
long pixelDataAddress =
StrikeCache.unsafe.getAddress(glyphInfoPtr +
StrikeCache.pixelDataOffset);
if (pixelDataAddress == 0L) {
return;
}
......
......@@ -742,7 +742,12 @@ Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative
for (i=0; i < glyphCnt; i++) {
GlyphInfo *jginfo = (GlyphInfo *) jlong_to_ptr(glyphInfoPtrs[i]);
gid[i] = (Glyph) (0x0ffffffffL & ((unsigned long)(jginfo->cellInfo)));
// 'jginfo->cellInfo' is of type 'void*'
// (see definition of 'GlyphInfo' in fontscalerdefs.h)
// 'Glyph' is typedefed to 'unsigned long'
// (see http://www.x.org/releases/X11R7.7/doc/libXrender/libXrender.txt)
// Maybe we should assert that (sizeof(void*) == sizeof(Glyph)) ?
gid[i] = (Glyph) (jginfo->cellInfo);
xginfo[i].x = (-jginfo->topLeftX);
xginfo[i].y = (-jginfo->topLeftY);
xginfo[i].width = jginfo->width;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册