Last active
April 12, 2019 02:27
-
-
Save melpon/79cd7439122d0369f3def9c336b33913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void screen_draw_rect(uint8_t screen[][4], uint8_t x, uint8_t y, uint8_t w, uint8_t h) { | |
uint8_t masks[4] = { 0 }; | |
uint8_t x2 = x + w; | |
while (x < x2) { | |
uint8_t n = x / 8; | |
uint8_t m = x % 8; | |
masks[n] |= (1 << (7 - m)); | |
x++; | |
} | |
uint8_t y2 = y + h; | |
while (y < y2) { | |
for (uint8_t i = 0; i < 4; i++) { | |
screen[i][y] |= masks[i]; | |
} | |
y++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment