zle dziala clear_buffor
This commit is contained in:
@@ -340,9 +340,9 @@ void SSD1306_write_to_buffer(const uint8_t* bitmap, uint8_t bitmap_width, uint8_
|
||||
}
|
||||
|
||||
if (pos_y < 0) {
|
||||
tmp_buf16 |= tmp_bitmap >> (b.shift % 8);
|
||||
tmp_buf16 |= (tmp_bitmap >> (b.shift % 8)) & ~(mask_buf);
|
||||
} else {
|
||||
tmp_buf16 |= tmp_bitmap << (b.shift % 8);
|
||||
tmp_buf16 |= (tmp_bitmap << (b.shift % 8)) & ~(mask_buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,7 +357,8 @@ void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t po
|
||||
if (width + pos_x < 0 || height + pos_y < 0) return;
|
||||
|
||||
uint16_t tmp_buf16, bitmap_idx;
|
||||
uint8_t mask_buf;
|
||||
uint16_t mask_buf;
|
||||
uint8_t bitmap_row;
|
||||
|
||||
switch(color)
|
||||
{
|
||||
@@ -375,17 +376,17 @@ void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t po
|
||||
for(uint8_t col = b.buf_col_first; col < b.buf_col_last; col++, b.bitmap_col++)
|
||||
{
|
||||
tmp_buf16 = 0;
|
||||
b.bitmap_row = b.bitmap_row_first;
|
||||
for( uint8_t buf_row = b.buf_row_first; buf_row < b.buf_row_last; buf_row++, b.bitmap_row++ )
|
||||
bitmap_row = b.bitmap_row_first;
|
||||
for( uint8_t buf_row = b.buf_row_first; buf_row < b.buf_row_last; buf_row++, bitmap_row++ )
|
||||
{
|
||||
bitmap_idx = width * b.bitmap_row + b.bitmap_col;
|
||||
bitmap_idx = width * bitmap_row + b.bitmap_col;
|
||||
mask_buf = 0;
|
||||
|
||||
if (b.bitmap_row == 0 && pos_y > 0) {
|
||||
if (bitmap_row == 0 && pos_y > 0) {
|
||||
mask_buf |= 0xFF >> (8 - (b.shift % 8));
|
||||
}
|
||||
|
||||
uint8_t shifted_pixels_left = (pos_y%8 + height) - b.bitmap_row * 8;
|
||||
uint8_t shifted_pixels_left = (pos_y%8 + height) - bitmap_row * 8;
|
||||
if (shifted_pixels_left < 8) {
|
||||
mask_buf |= (0xFF << shifted_pixels_left);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user