diff options
Diffstat (limited to 'src/fb.c')
| -rw-r--r-- | src/fb.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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); |
