0
0
mirror of https://github.com/markusfisch/BinaryEye.git synced 2024-09-20 03:52:16 +02:00

Make conditional an argument

To avoid the repetition of the function invocation.

Also make bt a constant variable because it can be.
This commit is contained in:
Markus Fisch 2022-08-20 19:03:29 +02:00
parent 6a47a7e477
commit 319ae53b3b

View File

@ -174,16 +174,18 @@ fun encodeAsText(
for (y in 0 until h step 2) {
for (x in 0 until w) {
val tp = bitMatrix.get(y, x)
var bt = y + 1 >= h || bitMatrix.get(y + 1, x);
if (tp && bt) {
sb.append(' ')//'\u0020'
} else if (tp) {
sb.append('▄')//'\u2584'
} else if (bt) {
sb.append('▀')//'\u2580'
} else {
sb.append('█')//'\u2588'
}
val bt = y + 1 >= h || bitMatrix.get(y + 1, x)
sb.append(
if (tp && bt) {
' '
} else if (tp) {
'▄'
} else if (bt) {
'▀'
} else {
'█'
}
)
}
sb.append('\n')
}