Extract texture management to a separate file

Move texture management out of screen.c, which already handles the
window and the rendering.

This paves the way to implement optional software filtering (swscale)
properly, as an alternative to mipmaps (which are not available
everywhere).
This commit is contained in:
Romain Vimont
2021-02-07 19:26:58 +01:00
parent edf710af3c
commit 0b4b4609dc
5 changed files with 180 additions and 116 deletions

33
app/src/frame_texture.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef SC_FRAME_TEXTURE_H
#define SC_FRAME_TEXTURE_H
#include "common.h"
#include <stdbool.h>
#include <SDL2/SDL.h>
#include <libavformat/avformat.h>
#include "coords.h"
#include "opengl.h"
struct sc_frame_texture {
SDL_Renderer *renderer; // owned by struct screen
bool mipmaps;
struct sc_opengl gl;
SDL_Texture *texture;
struct size texture_size;
};
bool
sc_frame_texture_init(struct sc_frame_texture *ftex, SDL_Renderer *renderer,
bool mipmaps, struct size initial_size);
void
sc_frame_texture_destroy(struct sc_frame_texture *ftex);
bool
sc_frame_texture_update(struct sc_frame_texture *ftex, const AVFrame *frame);
#endif