Cleanup: use const rect argument for immDrawPixelsTex functions

This commit is contained in:
Campbell Barton
2023-07-13 10:09:16 +10:00
parent 1dec7189ed
commit 4e7ea8bf70
5 changed files with 19 additions and 19 deletions

View File

@@ -90,7 +90,7 @@ void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state,
int img_h,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
const void *rect,
float xzoom,
float yzoom,
const float color[4]);
@@ -101,7 +101,7 @@ void immDrawPixelsTexTiled_clipping(IMMDrawPixelsTexState *state,
int img_h,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
const void *rect,
float clip_min_x,
float clip_min_y,
float clip_max_x,
@@ -116,7 +116,7 @@ void immDrawPixelsTexTiled_scaling(IMMDrawPixelsTexState *state,
int img_h,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
const void *rect,
float scaleX,
float scaleY,
float xzoom,
@@ -143,7 +143,7 @@ void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state,
int img_h,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
const void *rect,
float scaleX,
float scaleY,
float clip_min_x,

View File

@@ -2074,7 +2074,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion * /*region*/,
GPU_scissor(rect.xmin, rect.ymin, scissor[2], scissor[3]);
if (width > 0 && height > 0) {
ImBuf *drawibuf = scopes->track_preview;
const ImBuf *drawibuf = scopes->track_preview;
float col_sel[4], col_outline[4];
if (scopes->use_track_mask) {

View File

@@ -1528,7 +1528,7 @@ static void icon_draw_rect(float x,
float /*aspect*/,
int rw,
int rh,
uint8_t *rect,
const uint8_t *rect,
float alpha,
const float desaturate)
{
@@ -1882,7 +1882,7 @@ static void icon_draw_size(float x,
UI_widgetbase_draw_cache_flush();
if (di->type == ICON_TYPE_IMBUF) {
ImBuf *ibuf = static_cast<ImBuf *>(icon->obj);
const ImBuf *ibuf = static_cast<const ImBuf *>(icon->obj);
GPU_blend(GPU_BLEND_ALPHA_PREMULT);
icon_draw_rect(
@@ -2018,7 +2018,7 @@ static void icon_draw_size(float x,
aspect,
pi->w[size],
pi->h[size],
reinterpret_cast<uint8_t *>(pi->rect[size]),
reinterpret_cast<const uint8_t *>(pi->rect[size]),
alpha,
desaturate);
GPU_blend(GPU_BLEND_ALPHA);

View File

@@ -705,7 +705,7 @@ void ED_mask_draw_region(
if (draw_flag & MASK_DRAWFLAG_OVERLAY) {
float buf_col[4] = {1.0f, 0.0f, 0.0f, 0.0f};
float *buffer = mask_rasterize(mask_eval, width, height);
const float *buffer = mask_rasterize(mask_eval, width, height);
if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
/* More blending types could be supported in the future. */
@@ -740,7 +740,7 @@ void ED_mask_draw_region(
GPU_blend(GPU_BLEND_NONE);
}
MEM_freeN(buffer);
MEM_freeN((void *)buffer);
}
/* apply transformation so mask editing tools will assume drawing from the

View File

@@ -136,7 +136,7 @@ void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state,
int img_h,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
const void *rect,
float scaleX,
float scaleY,
float clip_min_x,
@@ -245,28 +245,28 @@ void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state,
int src_y = subpart_y * offset_y;
int src_x = subpart_x * offset_x;
#define DATA(_y, _x) ((char *)rect + stride * (size_t(_y) * img_w + (_x)))
#define DATA(_y, _x) (static_cast<const char *>(rect) + stride * (size_t(_y) * img_w + (_x)))
{
void *data = DATA(src_y, src_x);
const void *data = DATA(src_y, src_x);
GPU_texture_update_sub(tex, gpu_data, data, 0, 0, 0, subpart_w, subpart_h, 0);
}
/* Add an extra border of pixels so linear interpolation looks ok
* at edges of full image. */
if (subpart_w < tex_w) {
void *data = DATA(src_y, src_x + subpart_w - 1);
const void *data = DATA(src_y, src_x + subpart_w - 1);
const int offset[2] = {subpart_w, 0};
const int extent[2] = {1, subpart_h};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
}
if (subpart_h < tex_h) {
void *data = DATA(src_y + subpart_h - 1, src_x);
const void *data = DATA(src_y + subpart_h - 1, src_x);
const int offset[2] = {0, subpart_h};
const int extent[2] = {subpart_w, 1};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
}
if (subpart_w < tex_w && subpart_h < tex_h) {
void *data = DATA(src_y + subpart_h - 1, src_x + subpart_w - 1);
const void *data = DATA(src_y + subpart_h - 1, src_x + subpart_w - 1);
const int offset[2] = {subpart_w, subpart_h};
const int extent[2] = {1, 1};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
@@ -320,7 +320,7 @@ void immDrawPixelsTexTiled_scaling(IMMDrawPixelsTexState *state,
int img_h,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
const void *rect,
float scaleX,
float scaleY,
float xzoom,
@@ -353,7 +353,7 @@ void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state,
int img_h,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
const void *rect,
float xzoom,
float yzoom,
const float color[4])
@@ -384,7 +384,7 @@ void immDrawPixelsTexTiled_clipping(IMMDrawPixelsTexState *state,
int img_h,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
const void *rect,
float clip_min_x,
float clip_min_y,
float clip_max_x,