diff --git a/src/main/scala/li/cil/oc/client/renderer/font/TextureFontRenderer.scala b/src/main/scala/li/cil/oc/client/renderer/font/TextureFontRenderer.scala index 93686b1ae..97c290a2a 100644 --- a/src/main/scala/li/cil/oc/client/renderer/font/TextureFontRenderer.scala +++ b/src/main/scala/li/cil/oc/client/renderer/font/TextureFontRenderer.scala @@ -46,7 +46,7 @@ abstract class TextureFontRenderer { // Background first. We try to merge adjacent backgrounds of the same // color to reduce the number of quads we have to draw. GL11.glBegin(GL11.GL_QUADS) - for (y <- 0 until viewportHeight) { + for (y <- 0 until (viewportHeight min buffer.height)) { val color = buffer.color(y) var cbg = 0x000000 var x = 0 @@ -74,7 +74,7 @@ abstract class TextureFontRenderer { // Foreground second. We only have to flush when the color changes, so // unless every char has a different color this should be quite efficient. - for (y <- 0 until viewportHeight) { + for (y <- 0 until (viewportHeight min buffer.height)) { val line = buffer.buffer(y) val color = buffer.color(y) val ty = y * charHeight diff --git a/src/main/scala/li/cil/oc/common/component/TextBuffer.scala b/src/main/scala/li/cil/oc/common/component/TextBuffer.scala index ee5253f97..f0ea9e66c 100644 --- a/src/main/scala/li/cil/oc/common/component/TextBuffer.scala +++ b/src/main/scala/li/cil/oc/common/component/TextBuffer.scala @@ -244,8 +244,9 @@ class TextBuffer(val host: EnvironmentHost) extends prefab.ManagedEnvironment wi proxy.onBufferResolutionChange(w, h) // Force set viewport to new resolution. This is partially for // backwards compatibility, and partially to enforce a valid one. - // Binary or to evaluate both, negated setViewport to only send signal once. - if ((data.size = (w, h)) | !setViewport(w, h)) { + val sizeChanged = data.size = (w, h) + val viewportChanged = setViewport(w, h) + if (sizeChanged && !viewportChanged) { if (node != null) { node.sendToReachable("computer.signal", "screen_resized", Int.box(w), Int.box(h)) } diff --git a/src/main/scala/li/cil/oc/util/TextBuffer.scala b/src/main/scala/li/cil/oc/util/TextBuffer.scala index d896c010d..8cef8bad6 100644 --- a/src/main/scala/li/cil/oc/util/TextBuffer.scala +++ b/src/main/scala/li/cil/oc/util/TextBuffer.scala @@ -215,9 +215,9 @@ class TextBuffer(var width: Int, var height: Int, initialFormat: PackedColor.Col } def load(nbt: NBTTagCompound): Unit = { - val maxResolution = math.max(Settings.screenResolutionsByTier(2)._1, Settings.screenResolutionsByTier(2)._2) - val w = nbt.getInteger("width") max 1 min maxResolution - val h = nbt.getInteger("height") max 1 min maxResolution + val maxResolution = math.max(Settings.screenResolutionsByTier.last._1, Settings.screenResolutionsByTier.last._2) + val w = nbt.getInteger("width") min maxResolution max 1 + val h = nbt.getInteger("height") min maxResolution max 1 size = (w, h) val b = nbt.getTagList("buffer", NBT.TAG_STRING)