clean up some unseemly speckles
Turns out they were a bug after all, and scaling the palette was just making them more obvious. The bug: I was carefully clamping to 0xf0 to avoid rounding later, but I forgot to do so for values between 0xf0 and 0xff. As a result, some values could round up past 0xff and turn black.
This commit is contained in:
parent
42bb0922fe
commit
62a2afe0d8
5
img.mu
5
img.mu
|
@ -26,8 +26,7 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk)
|
|||
var img-storage: image
|
||||
var img/esi: (addr image) <- address img-storage
|
||||
load-image img, data-disk
|
||||
render-image screen, img, 0/x, 0xd0/y, 0x12c/width=300, 0xc8/height=200
|
||||
render-pgm-image screen, img, 0x140/x, 0/y, 0x12c/width=300, 0xc8/height=200
|
||||
render-image screen, img, 0/x, 0/y, 0x300/width, 0x300/height
|
||||
}
|
||||
|
||||
fn load-image self: (addr image), data-disk: (addr disk) {
|
||||
|
@ -484,7 +483,7 @@ fn dither-pgm-unordered _src: (addr image), _dest: (addr image) {
|
|||
nearest-color <- copy 0
|
||||
}
|
||||
{
|
||||
compare nearest-color, 0xff
|
||||
compare nearest-color, 0xf0
|
||||
break-if-<=
|
||||
nearest-color <- copy 0xf0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue