1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

gl_common: reduce some code duplication

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-03-15 20:05:01 +00:00
parent 0eca07d400
commit b3590f934f
No known key found for this signature in database
GPG key ID: 37C999F617EA1A47

View file

@ -1304,14 +1304,10 @@ static inline void gl_image_decouple(backend_t *base, struct gl_image *img) {
struct gl_data *gl = (void *)base;
auto new_tex = ccalloc(1, struct gl_texture);
glGenTextures(1, &new_tex->texture);
new_tex->texture = gl_new_texture(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, new_tex->texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, img->inner->width, img->inner->height, 0,
GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
new_tex->y_inverted = true;
new_tex->height = img->inner->height;
new_tex->width = img->inner->width;