Fix brick.print()

This commit is contained in:
Michal Moskal 2017-10-30 19:03:45 +00:00
parent 2df90152fe
commit e8e31e6aa7
2 changed files with 2 additions and 2 deletions

View File

@ -239,7 +239,7 @@ extern "C" void drawPanic(int code) {
} }
bool isValidImage(Buffer buf) { bool isValidImage(Buffer buf) {
return buf->length >= 3 && buf->data[0] == 0xf0; return buf != NULL && buf->length >= 3 && buf->data[0] == 0xf0;
} }
/** Makes an image bound to a buffer. */ /** Makes an image bound to a buffer. */

View File

@ -112,10 +112,10 @@ namespace brick {
let byteWidth = (currFont.charWidth + 7) >> 3 let byteWidth = (currFont.charWidth + 7) >> 3
let charSize = byteWidth * currFont.charHeight let charSize = byteWidth * currFont.charHeight
let imgBuf = output.createBuffer(2 + charSize) let imgBuf = output.createBuffer(2 + charSize)
let img = screen.imageOf(imgBuf)
let double = (mode & Draw.Quad) ? 4 : (mode & Draw.Double) ? 2 : 1 let double = (mode & Draw.Quad) ? 4 : (mode & Draw.Double) ? 2 : 1
imgBuf[0] = 0xf0 imgBuf[0] = 0xf0
imgBuf[1] = currFont.charWidth imgBuf[1] = currFont.charWidth
let img = screen.imageOf(imgBuf)
while (cp < text.length) { while (cp < text.length) {
let ch = text.charCodeAt(cp++) let ch = text.charCodeAt(cp++)
if (ch == 10) { if (ch == 10) {