Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/gfx/gl.c b/gfx/gl.c
- index bccfd63..1a30613 100644
- --- a/gfx/gl.c
- +++ b/gfx/gl.c
- @@ -997,13 +997,16 @@ static inline void gl_copy_frame(gl_t *gl, const void *frame, unsigned width, un
- }
- else // Slower path.
- {
- + uint8_t *fbuf = malloc(width * height * 2); // Allocate buffer once and reuse it
- const uint8_t *src = (const uint8_t*)frame;
- for (unsigned h = 0; h < height; h++, src += pitch)
- - {
- - glTexSubImage2D(GL_TEXTURE_2D,
- - 0, 0, h, width, 1, gl->texture_type,
- - gl->texture_fmt, src);
- - }
- + memcpy(&fbuf[h * (width * 2)], src, width * 2);
- +
- + glTexSubImage2D(GL_TEXTURE_2D,
- + 0, 0, 0, width, height, gl->texture_type,
- + gl->texture_fmt, fbuf);
- +
- + free(fbuf);
- }
- }
- #else
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement