mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-06-21 04:44:05 +09:00
hopefully alleviating a bug involving multithreaded (or mixed thread?) usage
This commit is contained in:
@@ -394,6 +394,7 @@ class TerrarumSansBitmap(
|
||||
|
||||
var index = 0
|
||||
while (index <= textBuffer.lastIndex) {
|
||||
try {
|
||||
val c = textBuffer[index]
|
||||
val sheetID = getSheetType(c)
|
||||
val (sheetX, sheetY) =
|
||||
@@ -468,6 +469,12 @@ class TerrarumSansBitmap(
|
||||
|
||||
index++
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
System.err.println("Shit hit the multithreaded fan")
|
||||
e.printStackTrace()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
makeShadow(linotypePixmap)
|
||||
@@ -846,6 +853,7 @@ class TerrarumSansBitmap(
|
||||
// persisting value. the value is set a few characters before the actual usage
|
||||
var extraWidth = 0
|
||||
|
||||
try {
|
||||
for (charIndex in 0 until posXbuffer.size - 1) {
|
||||
if (charIndex > 0) {
|
||||
// nonDiacriticCounter allows multiple diacritics
|
||||
@@ -1006,6 +1014,8 @@ class TerrarumSansBitmap(
|
||||
else {
|
||||
posXbuffer[0] = 0
|
||||
}
|
||||
}
|
||||
catch (e: NullPointerException) {}
|
||||
|
||||
return posXbuffer to posYbuffer
|
||||
}
|
||||
@@ -1345,10 +1355,16 @@ class TerrarumSansBitmap(
|
||||
val hashPrime = 1099511628211L
|
||||
var hashAccumulator = hashBasis
|
||||
|
||||
try {
|
||||
this.forEach {
|
||||
hashAccumulator = hashAccumulator xor it.toLong()
|
||||
hashAccumulator *= hashPrime
|
||||
}
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
System.err.println("CodepointSequence is null?!")
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
return hashAccumulator
|
||||
}
|
||||
|
||||
@@ -278,8 +278,8 @@ class TerrarumTypewriterBitmap(
|
||||
private val pixmapOffsetY = 10
|
||||
private val linotypePad = 16
|
||||
private var flagFirstRun = true
|
||||
private var textBuffer = CodepointSequence(256)
|
||||
private lateinit var tempLinotype: Texture
|
||||
private @Volatile var textBuffer = CodepointSequence(256)
|
||||
private @Volatile lateinit var tempLinotype: Texture
|
||||
private var nullProp = GlyphProps(15)
|
||||
|
||||
|
||||
@@ -333,6 +333,7 @@ class TerrarumTypewriterBitmap(
|
||||
|
||||
var index = 0
|
||||
while (index <= textBuffer.lastIndex) {
|
||||
try {
|
||||
val c = textBuffer[index]
|
||||
val sheetID = getSheetType(c)
|
||||
val (sheetX, sheetY) =
|
||||
@@ -343,12 +344,10 @@ class TerrarumTypewriterBitmap(
|
||||
if (TerrarumSansBitmap.isColourCode(c)) {
|
||||
if (c == 0x100000) {
|
||||
renderCol = -1
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
renderCol = getColour(c)
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
val posY = posYbuffer[index].flipY()
|
||||
val posX = posXbuffer[index]
|
||||
@@ -358,14 +357,19 @@ class TerrarumTypewriterBitmap(
|
||||
linotypePixmap.drawPixmap(it, posX + linotypePad, posY + pixmapOffsetY, renderCol)
|
||||
}
|
||||
|
||||
}
|
||||
catch (noSuchGlyph: ArrayIndexOutOfBoundsException) {
|
||||
} catch (noSuchGlyph: ArrayIndexOutOfBoundsException) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
index++
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
System.err.println("Shit hit the multithreaded fan")
|
||||
e.printStackTrace()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
tempLinotype = Texture(linotypePixmap)
|
||||
tempLinotype.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||
@@ -417,6 +421,7 @@ class TerrarumTypewriterBitmap(
|
||||
// persisting value. the value is set a few characters before the actual usage
|
||||
var extraWidth = 0
|
||||
|
||||
try {
|
||||
for (charIndex in 0 until posXbuffer.size - 1) {
|
||||
if (charIndex > 0) {
|
||||
// nonDiacriticCounter allows multiple diacritics
|
||||
@@ -555,6 +560,8 @@ class TerrarumTypewriterBitmap(
|
||||
else {
|
||||
posXbuffer[0] = 0
|
||||
}
|
||||
}
|
||||
catch (e: NullPointerException) {}
|
||||
|
||||
return posXbuffer to posYbuffer
|
||||
}
|
||||
@@ -609,14 +616,15 @@ class TerrarumTypewriterBitmap(
|
||||
val hashPrime = 1099511628211L
|
||||
var hashAccumulator = hashBasis
|
||||
|
||||
if (this != null) {
|
||||
try {
|
||||
this.forEach {
|
||||
hashAccumulator = hashAccumulator xor it.toLong()
|
||||
hashAccumulator *= hashPrime
|
||||
}
|
||||
}
|
||||
else {
|
||||
catch (e: NullPointerException) {
|
||||
System.err.println("CodepointSequence is null?!")
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
return hashAccumulator
|
||||
|
||||
Reference in New Issue
Block a user