aboutsummaryrefslogtreecommitdiff
path: root/src/fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fb.c')
-rw-r--r--src/fb.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/fb.c b/src/fb.c
index d0515d9..1e3d601 100644
--- a/src/fb.c
+++ b/src/fb.c
@@ -113,7 +113,7 @@ bool pw_fb_coordinates(struct pw_framebuffer *fb, float wx, float wy,
return true;
}
-bool pw_fb_flip(struct pw_framebuffer *fb,
+bool pw_fb_blit(struct pw_framebuffer *fb,
uint32_t const pixels[PW_FB_WIDTH * PW_FB_HEIGHT]) {
if (!fb) {
SDL_InvalidParamError("fb");
@@ -135,6 +135,20 @@ bool pw_fb_flip(struct pw_framebuffer *fb,
SDL_memcpy(buffer, pixels, sizeof(uint32_t[PW_FB_WIDTH * PW_FB_HEIGHT]));
SDL_UnlockTexture(fb->texture);
+ return true;
+}
+
+bool pw_fb_render(struct pw_framebuffer *fb) {
+ if (!fb) {
+ SDL_InvalidParamError("fb");
+ return false;
+ }
+
+ SDL_Renderer *renderer = SDL_GetRendererFromTexture(fb->texture);
+ if (!renderer) {
+ return false;
+ }
+
return SDL_RenderClear(renderer) &&
SDL_RenderTexture(renderer, fb->texture, NULL, &fb->target) &&
SDL_RenderPresent(renderer);