Merge pull request #35 from sleepy-monax/perffix

Fix performance issues introduced by #33 in the vbe code.
This commit is contained in:
mint 2020-09-26 00:21:45 +02:00 committed by GitHub
commit 2483902b88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

Binary file not shown.

View File

@ -84,28 +84,29 @@ void vbe_blend_px(int x, int y, uint32_t hex) {
void vbe_fill_rect(int x, int y, int width, int height, uint32_t hex)
{
for (int xx = 0; xx < width; xx++)
for (int yy = 0; yy < height; yy++)
for (int xx = 0; xx < width; xx++)
vbe_plot_px(x + xx, y + yy, hex);
}
void vbe_blend_rect(int x, int y, int width, int height, uint32_t hex)
{
for (int xx = 0; xx < width; xx++)
for (int yy = 0; yy < height; yy++)
for (int xx = 0; xx < width; xx++)
vbe_blend_px(x + xx, y + yy, hex);
}
void vbe_plot_background(int x, int y, int width, int height)
{
if (background) {
for (int xx = 0; xx < width; xx++)
for (int yy = 0; yy < height; yy++)
for (int xx = 0; xx < width; xx++)
vbe_plot_px(x + xx, y + yy, background->get_pixel(background, x + xx, y + yy));
}
else{
for (int xx = 0; xx < width; xx++)
for (int yy = 0; yy < height; yy++) {
for (int yy = 0; yy < height; yy++)
for (int xx = 0; xx < width; xx++){
uint32_t pixel = color_blend(ansi_colours[0], 0x000000);
vbe_plot_px(x + xx, y + yy, pixel);
}
@ -114,14 +115,14 @@ void vbe_plot_background(int x, int y, int width, int height)
void vbe_plot_background_colored(int x, int y, int width, int height, uint32_t hex){
if (background) {
for (int xx = 0; xx < width; xx++)
for (int yy = 0; yy < height; yy++){
for (int yy = 0; yy < height; yy++)
for (int xx = 0; xx < width; xx++) {
uint32_t pixel = color_blend(hex, background->get_pixel(background, x + xx, y + yy));
vbe_plot_px(x + xx, y + yy, pixel);
}
}else{
for (int xx = 0; xx < width; xx++)
for (int yy = 0; yy < height; yy++) {
for (int yy = 0; yy < height; yy++)
for (int xx = 0; xx < width; xx++) {
uint32_t pixel = color_blend(hex, 0x000000);
vbe_plot_px(x + xx, y + yy, pixel);
}