bbcmicrobit / micropython

Port of MicroPython for the BBC micro:bit
https://microbit-micropython.readthedocs.io
Other
595 stars 287 forks source link

Shifting and image causes it to be resized. #718

Closed Blockguy24 closed 2 years ago

Blockguy24 commented 3 years ago

I was having this issue with Image where if I did something like Image(5,6).shift_down(1), it would cause it to return an image of size 5x5 instead of 5x6. After looking through the code, I saw that the width was being passed twice into the blit function: https://github.com/bbcmicrobit/micropython/blob/a92ca9b1f907c07a01116b0eb464ca4743a28bf1/source/microbit/microbitimage.cpp#L324-L328

It looks like self->width(), self->width() should be replaced with self->width(), self->height() on lines 325 and 326 for this to function correctly.

dpgeorge commented 2 years ago

Fixed by 4cdc4ac219f46cb7582a469e940a5ea27bb34a1d