diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-04-03 08:21:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-04-03 08:21:24 +0300 |
commit | 600a627f6e326f4542a876e6e82f771cd3da218f (patch) | |
tree | 9df2dd448e8da7b885d8cf8e56645a062f6d842c /source/blender/editors/space_sequencer | |
parent | 04fe37f93116bd3b276ebe86d9fa53f18223ee6a (diff) |
Cleanup: use abbreviated names for unsigned types in editors
Diffstat (limited to 'source/blender/editors/space_sequencer')
3 files changed, 79 insertions, 80 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 0766996c00b..b50a3e1743e 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -99,9 +99,9 @@ static Sequence *special_seq_update = NULL; -void color3ubv_from_seq(Scene *curscene, Sequence *seq, unsigned char col[3]) +void color3ubv_from_seq(Scene *curscene, Sequence *seq, uchar col[3]) { - unsigned char blendcol[3]; + uchar blendcol[3]; switch (seq->type) { case SEQ_TYPE_IMAGE: @@ -366,7 +366,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, * so for now, just use the meta's immediate children, could be fixed but * its only drawing - campbell */ Sequence *seq; - unsigned char col[4]; + uchar col[4]; int chan_min = MAXSEQ; int chan_max = 0; @@ -467,15 +467,15 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_clamped, const short direction, - unsigned int pos, + uint pos, bool seq_active, float pixelx, bool y_threshold) { float rx1 = 0, rx2 = 0; float x1, x2, y1, y2; - unsigned int whichsel = 0; - unsigned char col[4]; + uint whichsel = 0; + uchar col[4]; x1 = seq->startdisp; x2 = seq->enddisp; @@ -557,7 +557,7 @@ static void draw_seq_handle(View2D *v2d, } static void draw_seq_outline(Sequence *seq, - unsigned int pos, + uint pos, float x1, float x2, float y1, @@ -566,7 +566,7 @@ static void draw_seq_outline(Sequence *seq, float pixely, bool seq_active) { - unsigned char col[3]; + uchar col[3]; /* Get the color for the outline. */ if (seq_active && (seq->flag & SELECT)) { @@ -751,10 +751,10 @@ static void draw_seq_text(View2D *v2d, UI_view2d_text_cache_add_rectf(v2d, &rect, str, str_len, col); } -static void draw_sequence_extensions(Scene *scene, Sequence *seq, unsigned int pos, float pixely) +static void draw_sequence_extensions(Scene *scene, Sequence *seq, uint pos, float pixely) { float x1, x2, y1, y2; - unsigned char col[4], blend_col[3]; + uchar col[4], blend_col[3]; x1 = seq->startdisp; x2 = seq->enddisp; @@ -793,9 +793,9 @@ static void draw_sequence_extensions(Scene *scene, Sequence *seq, unsigned int p GPU_blend(false); } -static void draw_color_strip_band(Sequence *seq, unsigned int pos, float text_margin_y, float y1) +static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y, float y1) { - unsigned char col[4]; + uchar col[4]; SolidColorVars *colvars = (SolidColorVars *)seq->effectdata; rgb_float_to_uchar(col, colvars->col); @@ -827,14 +827,14 @@ static void draw_color_strip_band(Sequence *seq, unsigned int pos, float text_ma static void draw_seq_background(Scene *scene, Sequence *seq, - unsigned int pos, + uint pos, float x1, float x2, float y1, float y2, bool is_single_image) { - unsigned char col[4]; + uchar col[4]; /* Get the correct color per strip type, transitions use their inputs ones. */ if (ELEM(seq->type, SEQ_TYPE_CROSS, SEQ_TYPE_GAMCROSS, SEQ_TYPE_WIPE)) { @@ -1538,7 +1538,7 @@ static void sequencer_draw_display_buffer(const bContext *C, IMB_rect_from_float(ibuf); } - display_buffer = (unsigned char *)ibuf->rect; + display_buffer = (uchar *)ibuf->rect; format = GL_RGBA; type = GL_UNSIGNED_BYTE; } diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 309840ea9e3..3dcbdb6c4b0 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -50,24 +50,24 @@ static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3]) yuv[2] += 0.5f; } -static void scope_put_pixel(unsigned char *table, unsigned char *pos) +static void scope_put_pixel(uchar *table, uchar *pos) { - unsigned char newval = table[*pos]; + uchar newval = table[*pos]; pos[0] = pos[1] = pos[2] = newval; pos[3] = 255; } -static void scope_put_pixel_single(unsigned char *table, unsigned char *pos, int col) +static void scope_put_pixel_single(uchar *table, uchar *pos, int col) { char newval = table[pos[col]]; pos[col] = newval; pos[3] = 255; } -static void wform_put_line(int w, unsigned char *last_pos, unsigned char *new_pos) +static void wform_put_line(int w, uchar *last_pos, uchar *new_pos) { if (last_pos > new_pos) { - unsigned char *temp = new_pos; + uchar *temp = new_pos; new_pos = last_pos; last_pos = temp; } @@ -81,10 +81,10 @@ static void wform_put_line(int w, unsigned char *last_pos, unsigned char *new_po } } -static void wform_put_line_single(int w, unsigned char *last_pos, unsigned char *new_pos, int col) +static void wform_put_line_single(int w, uchar *last_pos, uchar *new_pos, int col) { if (last_pos > new_pos) { - unsigned char *temp = new_pos; + uchar *temp = new_pos; new_pos = last_pos; last_pos = temp; } @@ -98,12 +98,12 @@ static void wform_put_line_single(int w, unsigned char *last_pos, unsigned char } } -static void wform_put_border(unsigned char *tgt, int w, int h) +static void wform_put_border(uchar *tgt, int w, int h) { int x, y; for (x = 0; x < w; x++) { - unsigned char *p = tgt + 4 * x; + uchar *p = tgt + 4 * x; p[1] = p[3] = 155; p[4 * w + 1] = p[4 * w + 3] = 155; p = tgt + 4 * (w * (h - 1) + x); @@ -112,7 +112,7 @@ static void wform_put_border(unsigned char *tgt, int w, int h) } for (y = 0; y < h; y++) { - unsigned char *p = tgt + 4 * w * y; + uchar *p = tgt + 4 * w * y; p[1] = p[3] = 155; p[4 + 1] = p[4 + 3] = 155; p = tgt + 4 * (w * y + w - 1); @@ -121,7 +121,7 @@ static void wform_put_border(unsigned char *tgt, int w, int h) } } -static void wform_put_gridrow(unsigned char *tgt, float perc, int w, int h) +static void wform_put_gridrow(uchar *tgt, float perc, int w, int h) { int i; @@ -134,7 +134,7 @@ static void wform_put_gridrow(unsigned char *tgt, float perc, int w, int h) } } -static void wform_put_grid(unsigned char *tgt, int w, int h) +static void wform_put_grid(uchar *tgt, int w, int h) { wform_put_gridrow(tgt, 90.0, w, h); wform_put_gridrow(tgt, 70.0, w, h); @@ -145,27 +145,27 @@ static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x, y; - const unsigned char *src = (unsigned char *)ibuf->rect; - unsigned char *tgt = (unsigned char *)rval->rect; + const uchar *src = (uchar *)ibuf->rect; + uchar *tgt = (uchar *)rval->rect; int w = ibuf->x + 3; int h = 515; float waveform_gamma = 0.2; - unsigned char wtable[256]; + uchar wtable[256]; wform_put_grid(tgt, w, h); wform_put_border(tgt, w, h); for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char)(pow(((float)x + 1) / 256, waveform_gamma) * 255); + wtable[x] = (uchar)(pow(((float)x + 1) / 256, waveform_gamma) * 255); } for (y = 0; y < ibuf->y; y++) { - unsigned char *last_p = NULL; + uchar *last_p = NULL; for (x = 0; x < ibuf->x; x++) { - const unsigned char *rgb = src + 4 * (ibuf->x * y + x); + const uchar *rgb = src + 4 * (ibuf->x * y + x); float v = (float)IMB_colormanagement_get_luminance_byte(rgb) / 255.0f; - unsigned char *p = tgt; + uchar *p = tgt; p += 4 * (w * ((int)(v * (h - 3)) + 1) + x + 1); scope_put_pixel(wtable, p); @@ -187,25 +187,25 @@ static ImBuf *make_waveform_view_from_ibuf_float(ImBuf *ibuf) ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x, y; const float *src = ibuf->rect_float; - unsigned char *tgt = (unsigned char *)rval->rect; + uchar *tgt = (uchar *)rval->rect; int w = ibuf->x + 3; int h = 515; float waveform_gamma = 0.2; - unsigned char wtable[256]; + uchar wtable[256]; wform_put_grid(tgt, w, h); for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char)(pow(((float)x + 1) / 256, waveform_gamma) * 255); + wtable[x] = (uchar)(pow(((float)x + 1) / 256, waveform_gamma) * 255); } for (y = 0; y < ibuf->y; y++) { - unsigned char *last_p = NULL; + uchar *last_p = NULL; for (x = 0; x < ibuf->x; x++) { const float *rgb = src + 4 * (ibuf->x * y + x); float v = IMB_colormanagement_get_luminance(rgb); - unsigned char *p = tgt; + uchar *p = tgt; CLAMP(v, 0.0f, 1.0f); @@ -241,28 +241,28 @@ static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x, y; - const unsigned char *src = (const unsigned char *)ibuf->rect; - unsigned char *tgt = (unsigned char *)rval->rect; + const uchar *src = (const uchar *)ibuf->rect; + uchar *tgt = (uchar *)rval->rect; int w = ibuf->x + 3; int sw = ibuf->x / 3; int h = 515; float waveform_gamma = 0.2; - unsigned char wtable[256]; + uchar wtable[256]; wform_put_grid(tgt, w, h); for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char)(pow(((float)x + 1) / 256, waveform_gamma) * 255); + wtable[x] = (uchar)(pow(((float)x + 1) / 256, waveform_gamma) * 255); } for (y = 0; y < ibuf->y; y++) { - unsigned char *last_p[3] = {NULL, NULL, NULL}; + uchar *last_p[3] = {NULL, NULL, NULL}; for (x = 0; x < ibuf->x; x++) { int c; - const unsigned char *rgb = src + 4 * (ibuf->x * y + x); + const uchar *rgb = src + 4 * (ibuf->x * y + x); for (c = 0; c < 3; c++) { - unsigned char *p = tgt; + uchar *p = tgt; p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1) + c * sw + x / 3 + 1); scope_put_pixel_single(wtable, p, c); @@ -287,27 +287,27 @@ static ImBuf *make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf) ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x, y; const float *src = ibuf->rect_float; - unsigned char *tgt = (unsigned char *)rval->rect; + uchar *tgt = (uchar *)rval->rect; int w = ibuf->x + 3; int sw = ibuf->x / 3; int h = 515; float waveform_gamma = 0.2; - unsigned char wtable[256]; + uchar wtable[256]; wform_put_grid(tgt, w, h); for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char)(pow(((float)x + 1) / 256, waveform_gamma) * 255); + wtable[x] = (uchar)(pow(((float)x + 1) / 256, waveform_gamma) * 255); } for (y = 0; y < ibuf->y; y++) { - unsigned char *last_p[3] = {NULL, NULL, NULL}; + uchar *last_p[3] = {NULL, NULL, NULL}; for (x = 0; x < ibuf->x; x++) { int c; const float *rgb = src + 4 * (ibuf->x * y + x); for (c = 0; c < 3; c++) { - unsigned char *p = tgt; + uchar *p = tgt; float v = rgb[c]; CLAMP(v, 0.0f, 1.0f); @@ -343,18 +343,18 @@ ImBuf *make_sep_waveform_view_from_ibuf(ImBuf *ibuf) static void draw_zebra_byte(ImBuf *src, ImBuf *ibuf, float perc) { - unsigned int limit = 255.0f * perc / 100.0f; - unsigned char *p = (unsigned char *)src->rect; - unsigned char *o = (unsigned char *)ibuf->rect; + uint limit = 255.0f * perc / 100.0f; + uchar *p = (uchar *)src->rect; + uchar *o = (uchar *)ibuf->rect; int x; int y; for (y = 0; y < ibuf->y; y++) { for (x = 0; x < ibuf->x; x++) { - unsigned char r = *p++; - unsigned char g = *p++; - unsigned char b = *p++; - unsigned char a = *p++; + uchar r = *p++; + uchar g = *p++; + uchar b = *p++; + uchar a = *p++; if (r >= limit || g >= limit || b >= limit) { if (((x + y) & 0x08) != 0) { @@ -375,7 +375,7 @@ static void draw_zebra_float(ImBuf *src, ImBuf *ibuf, float perc) { float limit = perc / 100.0f; const float *p = src->rect_float; - unsigned char *o = (unsigned char *)ibuf->rect; + uchar *o = (uchar *)ibuf->rect; int x; int y; @@ -417,7 +417,7 @@ ImBuf *make_zebra_view_from_ibuf(ImBuf *src, float perc) static void draw_histogram_marker(ImBuf *ibuf, int x) { - unsigned char *p = (unsigned char *)ibuf->rect; + uchar *p = (uchar *)ibuf->rect; int barh = ibuf->y * 0.1; int i; @@ -431,7 +431,7 @@ static void draw_histogram_marker(ImBuf *ibuf, int x) static void draw_histogram_bar(ImBuf *ibuf, int x, float val, int col) { - unsigned char *p = (unsigned char *)ibuf->rect; + uchar *p = (uchar *)ibuf->rect; int barh = ibuf->y * val * 0.9f; int i; @@ -456,12 +456,12 @@ static void make_histogram_view_from_ibuf_byte_cb_ex(void *__restrict userdata, { MakeHistogramViewData *data = userdata; const ImBuf *ibuf = data->ibuf; - const unsigned char *src = (unsigned char *)ibuf->rect; + const uchar *src = (uchar *)ibuf->rect; uint32_t(*cur_bins)[HIS_STEPS] = tls->userdata_chunk; for (int x = 0; x < ibuf->x; x++) { - const unsigned char *pixel = src + (y * ibuf->x + x) * 4; + const uchar *pixel = src + (y * ibuf->x + x) * 4; for (int j = 3; j--;) { cur_bins[j][pixel[j]]++; @@ -488,9 +488,9 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect); int x; - unsigned int nr, ng, nb; + uint nr, ng, nb; - unsigned int bins[3][HIS_STEPS]; + uint bins[3][HIS_STEPS]; memset(bins, 0, sizeof(bins)); @@ -534,7 +534,7 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) } } - wform_put_border((unsigned char *)rval->rect, rval->x, rval->y); + wform_put_border((uchar *)rval->rect, rval->x, rval->y); return rval; } @@ -576,7 +576,7 @@ static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf) int nr, ng, nb; int x; - unsigned int bins[3][HIS_STEPS]; + uint bins[3][HIS_STEPS]; memset(bins, 0, sizeof(bins)); @@ -619,7 +619,7 @@ static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf) draw_histogram_marker(rval, get_bin_float(0.0)); draw_histogram_marker(rval, get_bin_float(1.0)); - wform_put_border((unsigned char *)rval->rect, rval->x, rval->y); + wform_put_border((uchar *)rval->rect, rval->x, rval->y); return rval; } @@ -636,8 +636,7 @@ ImBuf *make_histogram_view_from_ibuf(ImBuf *ibuf) } } -static void vectorscope_put_cross( - unsigned char r, unsigned char g, unsigned char b, char *tgt, int w, int h, int size) +static void vectorscope_put_cross(uchar r, uchar g, uchar b, char *tgt, int w, int h, int size) { float rgb[3], yuv[3]; char *p; @@ -676,10 +675,10 @@ static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf) int w = 515; int h = 515; float scope_gamma = 0.2; - unsigned char wtable[256]; + uchar wtable[256]; for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char)(pow(((float)x + 1) / 256, scope_gamma) * 255); + wtable[x] = (uchar)(pow(((float)x + 1) / 256, scope_gamma) * 255); } for (x = 0; x < 256; x++) { @@ -702,7 +701,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf) rgb_to_yuv_normalized(rgb, yuv); p = tgt + 4 * (w * (int)((yuv[2] * (h - 3) + 1)) + (int)((yuv[1] * (w - 3) + 1))); - scope_put_pixel(wtable, (unsigned char *)p); + scope_put_pixel(wtable, (uchar *)p); } } @@ -721,10 +720,10 @@ static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf) int w = 515; int h = 515; float scope_gamma = 0.2; - unsigned char wtable[256]; + uchar wtable[256]; for (x = 0; x < 256; x++) { - wtable[x] = (unsigned char)(pow(((float)x + 1) / 256, scope_gamma) * 255); + wtable[x] = (uchar)(pow(((float)x + 1) / 256, scope_gamma) * 255); } for (x = 0; x <= 255; x++) { @@ -748,7 +747,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf) rgb_to_yuv_normalized(rgb, yuv); p = tgt + 4 * (w * (int)((yuv[2] * (h - 3) + 1)) + (int)((yuv[1] * (w - 3) + 1))); - scope_put_pixel(wtable, (unsigned char *)p); + scope_put_pixel(wtable, (uchar *)p); } } diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index 714a634766c..b2114eab62e 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -57,11 +57,11 @@ typedef struct ImageSampleInfo { int x, y; int channels; - unsigned char col[4]; + uchar col[4]; float colf[4]; float linearcol[4]; - unsigned char *colp; + uchar *colp; const float *colfp; int draw; @@ -117,7 +117,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) { const float *fp; - unsigned char *cp; + uchar *cp; int x = (int)fx, y = (int)fy; info->x = x; @@ -129,7 +129,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) info->colfp = NULL; if (ibuf->rect) { - cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x); + cp = (uchar *)(ibuf->rect + y * ibuf->x + x); info->col[0] = cp[0]; info->col[1] = cp[1]; |