Skip to content

Commit c443f8d

Browse files
committed
PicoVector: Tweak polygon tile rendering loop.
1 parent 591058f commit c443f8d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

libraries/pico_vector/pico_vector.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@ namespace pimoroni {
2222

2323
if(this->graphics->supports_alpha_blend() && pretty_poly::settings::antialias != pretty_poly::NONE) {
2424
for(auto y = 0; y < tile.bounds.h; y++) {
25-
for(auto x = 0; x < (int)tile.stride; x++) {
25+
for(auto x = 0; x < tile.bounds.w; x++) {
2626
uint8_t alpha = *tile_data++;
27-
if(x > tile.bounds.w) continue;
2827
if (alpha >= 4) {
29-
this->graphics->pixel({x + tile.bounds.x, y + tile.bounds.y});
28+
this->graphics->set_pixel({x + tile.bounds.x, y + tile.bounds.y});
3029
} else if (alpha > 0) {
3130
alpha = alpha_map[alpha];
3231
this->graphics->set_pixel_alpha({x + tile.bounds.x, y + tile.bounds.y}, alpha);
3332
}
3433
}
34+
tile_data += tile.stride - tile.bounds.w;
3535
}
3636
} else {
3737
for(auto y = 0; y < tile.bounds.h; y++) {
38-
for(auto x = 0; x < (int)tile.stride; x++) {
39-
uint8_t alpha = *tile_data++;
40-
if(x > tile.bounds.w) continue;
38+
for(auto x = 0; x < tile.bounds.w; x++) {
39+
uint8_t alpha = *tile_data++;
4140
if (alpha) {
42-
this->graphics->pixel({x + tile.bounds.x, y + tile.bounds.y});
41+
this->graphics->set_pixel({x + tile.bounds.x, y + tile.bounds.y});
4342
}
4443
}
44+
tile_data += tile.stride - tile.bounds.w;
4545
}
4646
}
4747
}, graphics->supports_alpha_blend() ? pretty_poly::X4 : pretty_poly::NONE, {0, 0, graphics->bounds.w, graphics->bounds.h});

0 commit comments

Comments
 (0)