more clippy

This commit is contained in:
Lauchmelder 2022-01-23 17:23:08 +01:00
parent baa0de8847
commit 8358bc876a
4 changed files with 32 additions and 4 deletions

9
include/clippy.h Normal file

File diff suppressed because one or more lines are too long

View file

@ -27,4 +27,5 @@ struct FrameBuffer
struct FrameBuffer* framebuffer_init(unsigned int width, unsigned int height);
void framebuffer_release(void);
void draw_test_image(void);
void draw_test_image(void);
void draw_clippy(unsigned int x, unsigned int y);

View file

@ -3,6 +3,7 @@
#include "mb.h"
#include "memory.h"
#include "io.h"
#include "clippy.h"
static struct FrameBuffer framebuffer;
@ -26,10 +27,26 @@ void draw_test_image(void)
{
size_t offset = y * framebuffer.pitch + (x * (framebuffer.bitsPerPixel / 8));
framebuffer.pixels[offset + 3] = 255;
framebuffer.pixels[offset + 2] = y * 255 / framebuffer.virtualDisplay.height;
framebuffer.pixels[offset + 1] = x * 255 / framebuffer.virtualDisplay.width;
framebuffer.pixels[offset + 0] = 255;
framebuffer.pixels[offset + 1] = y * 255 / framebuffer.virtualDisplay.height;
framebuffer.pixels[offset + 2] = x * 255 / framebuffer.virtualDisplay.width;
framebuffer.pixels[offset + 3] = 100;
}
}
}
void draw_clippy(unsigned int xoff, unsigned int yoff)
{
for(uint32_t y = 0; y < clippy_width; y++)
{
for(uint32_t x = 0; x < clippy_width; x++)
{
size_t offset = (yoff + y) * framebuffer.pitch + ((xoff + x) * (framebuffer.bitsPerPixel / 8));
framebuffer.pixels[offset + 3] = 255;
framebuffer.pixels[offset + 2] = clippy_pixels[y * (clippy_width * 3) + (x * 3) + 0];
framebuffer.pixels[offset + 1] = clippy_pixels[y * (clippy_width * 3) + (x * 3) + 1];
framebuffer.pixels[offset + 0] = clippy_pixels[y * (clippy_width * 3) + (x * 3) + 2];
}
}
}

View file

@ -48,6 +48,7 @@ void main()
uart_puts("Size : "); uart_puts(utoa(framebuffer->size, buffer, 10)); uart_puts(" bytes\n\n");
draw_test_image();
draw_clippy(100, 100);
for(;;)
{