src/solaris/classes/sun/font/XRGlyphCacheEntry.java
Print this page
rev 6829 : Fix Xrender backend on 64-bit Big-endian architectures
*** 67,81 ****
public int getGlyphSet() {
return glyphSet;
}
public static int getGlyphID(long glyphInfoPtr) {
! return (int) StrikeCache.unsafe.getInt(glyphInfoPtr + StrikeCache.cacheCellOffset);
}
public static void setGlyphID(long glyphInfoPtr, int id) {
! StrikeCache.unsafe.putInt(glyphInfoPtr + StrikeCache.cacheCellOffset, id);
}
public int getGlyphID() {
return getGlyphID(glyphInfoPtr);
}
--- 67,92 ----
public int getGlyphSet() {
return glyphSet;
}
public static int getGlyphID(long glyphInfoPtr) {
! // 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) {
! // 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() {
return getGlyphID(glyphInfoPtr);
}
*** 103,118 ****
public int getHeight() {
return StrikeCache.unsafe.getShort(glyphInfoPtr + StrikeCache.heightOffset);
}
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);
! }
if (pixelDataAddress == 0L) {
return;
}
int width = getWidth();
--- 114,124 ----
public int getHeight() {
return StrikeCache.unsafe.getShort(glyphInfoPtr + StrikeCache.heightOffset);
}
public void writePixelData(ByteArrayOutputStream os, boolean uploadAsLCD) {
! long pixelDataAddress = StrikeCache.unsafe.getAddress(glyphInfoPtr + StrikeCache.pixelDataOffset);
if (pixelDataAddress == 0L) {
return;
}
int width = getWidth();