From f1e9a3fa502843f0f3092e4bbb016c14eec43fcc Mon Sep 17 00:00:00 2001 From: Fabrice Date: Wed, 11 Feb 2026 22:03:38 +0100 Subject: add ability to choose custom alignment --- src/rendering.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/rendering.cc') diff --git a/src/rendering.cc b/src/rendering.cc index 3870cf6..a34e01c 100644 --- a/src/rendering.cc +++ b/src/rendering.cc @@ -27,9 +27,12 @@ bool wayc_image_init(texture_t* texture, image_type_e type, bool wayc_image_upload(texture_t texture, ivec2 offset, u32 width, u32 height, image_type_e type, image_format_e format, - image_data_type_e data_type, const u8* data) { + image_data_type_e data_type, i32 alignment, + const u8* data) { wayc_notnull(data); + glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); + switch (type) { case IMAGE_TYPE_2D: // TODO: add error checking @@ -105,12 +108,12 @@ void wayc_atlas_use(atlas_s* atlas, u32 slot) { } void wayc_atlas_set(atlas_s* atlas, image_data_type_e data_type, ivec2 offset, - u32 width, u32 height, const u8* data) { + u32 width, u32 height, i32 alignment, const u8* data) { wayc_notnull(atlas); wayc_notnull(data); wayc_image_upload(atlas->texture, offset, width, height, IMAGE_TYPE_2D, - atlas->format, data_type, data); + atlas->format, data_type, alignment, data); } void wayc_atlas_deinit(atlas_s* atlas) { -- cgit v1.2.3