diff options
Diffstat (limited to 'surface.c')
-rw-r--r-- | surface.c | 48 |
1 files changed, 44 insertions, 4 deletions
@@ -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; } |