aboutsummaryrefslogtreecommitdiff
path: root/src/fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fb.c')
-rw-r--r--src/fb.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fb.c b/src/fb.c
index f52f0c0..e46cdce 100644
--- a/src/fb.c
+++ b/src/fb.c
@@ -13,7 +13,7 @@ struct pw_framebuffer *pw_fb_init(SDL_Renderer *renderer,
// Note that we use a different pixel format here, this is to ensure we match
// the PICO-8 engine whose format is endian-dependant.
texture =
- SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ABGR8888,
+ SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888,
SDL_TEXTUREACCESS_STREAMING, PW_FB_WIDTH, PW_FB_HEIGHT);
if (!texture) {
goto error;
@@ -95,12 +95,15 @@ bool pw_fb_coordinates(struct pw_framebuffer *fb, float wx, float wy,
return true;
}
-bool pw_fb_blit(struct pw_framebuffer *fb,
- uint32_t const pixels[PW_FB_WIDTH * PW_FB_HEIGHT]) {
+bool pw_fb_blit(struct pw_framebuffer *fb, uint8_t const pixels[PW_FB_SIZE]) {
if (!fb) {
SDL_InvalidParamError("fb");
return false;
}
+ if (!pixels) {
+ SDL_InvalidParamError("pixels");
+ return false;
+ }
SDL_Renderer *renderer = SDL_GetRendererFromTexture(fb->texture);
if (!renderer) {