m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/surface.c
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-27 14:46:02 +0200
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-27 14:46:02 +0200
commit9eb310afc4a96304b47d4897c58ca3bb733362a9 (patch)
tree1da74a221faa69ca78ab1676e94b6cda4da62fc5 /surface.c
parente1d57f01b2112a6415313c83fc300f94475db382 (diff)
Add missing draw columns features
Diffstat (limited to 'surface.c')
-rw-r--r--surface.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/surface.c b/surface.c
index fddc0fe..cbb9406 100644
--- a/surface.c
+++ b/surface.c
@@ -93,17 +93,48 @@ long draw_columns(struct file *filp, unsigned long arg)
struct doomdev_surf_ioctl_draw_columns *param;
struct surface_data *surface_data;
struct texture_data *texture_data;
+ struct colors_data *colors_data;
+ struct colors_data *trans_data;
struct doomdev_column *columns;
struct fd texture_fds;
+ struct fd colors_fds;
+ struct fd trans_fds;
+ uint8_t flags;
+ bool got_colors = false;
+ bool got_trans = false;
int i;
surface_data = filp->private_data;
param = (struct doomdev_surf_ioctl_draw_columns *) arg;
- // temp
- if (param->draw_flags & DOOMDEV_DRAW_FLAGS_FUZZ) {
- return 0x400;
+ flags = param->draw_flags;
+
+ if (flags & DOOMDEV_DRAW_FLAGS_FUZZ ||
+ flags & DOOMDEV_DRAW_FLAGS_COLORMAP) {
+ if (flags & DOOMDEV_DRAW_FLAGS_FUZZ) {
+ flags = DOOMDEV_DRAW_FLAGS_FUZZ;
+ }
+
+ colors_fds = fdget(param->colormaps_fd);
+ colors_data = colors_fds.file->private_data;
+
+ got_colors = true;
+
+ if (surface_data->doom_data != colors_data->doom_data) {
+ return -EINVAL;
+ }
+ }
+
+ if (flags & DOOMDEV_DRAW_FLAGS_TRANSLATE) {
+ trans_fds = fdget(param->translations_fd);
+ trans_data = trans_fds.file->private_data;
+
+ got_trans = true;
+
+ if (surface_data->doom_data != trans_data->doom_data) {
+ return -EINVAL;
+ }
}
texture_fds = fdget(param->texture_fd);
@@ -118,13 +149,22 @@ long draw_columns(struct file *filp, unsigned long arg)
mutex_lock(&surface_data->doom_data->cmd_mutex);
for (i = 0; i < param->columns_num; i++) {
- draw_column(surface_data, texture_data, columns[i]);
+ draw_column(surface_data, texture_data, columns[i], colors_data,
+ trans_data, flags, param->translation_idx);
}
mutex_unlock(&surface_data->doom_data->cmd_mutex);
fdput(texture_fds);
+ if (got_colors) {
+ fdput(colors_fds);
+ }
+
+ if (got_trans) {
+ fdput(trans_fds);
+ }
+
return param->columns_num;
}