forked from bartvdbraak/blender
Patch from Xavier Thomas: Use vertex arrays for drawing image editor vector scope
too, making it a lot more efficient. Also fixed issue with scopes height not being stored in file properly.
This commit is contained in:
parent
c1a9d4d7a3
commit
77833847ee
@ -45,7 +45,7 @@ struct Scene;
|
|||||||
struct Main;
|
struct Main;
|
||||||
|
|
||||||
#define BLENDER_VERSION 252
|
#define BLENDER_VERSION 252
|
||||||
#define BLENDER_SUBVERSION 4
|
#define BLENDER_SUBVERSION 5
|
||||||
|
|
||||||
#define BLENDER_MINVERSION 250
|
#define BLENDER_MINVERSION 250
|
||||||
#define BLENDER_MINSUBVERSION 0
|
#define BLENDER_MINSUBVERSION 0
|
||||||
|
@ -899,8 +899,16 @@ DO_INLINE int get_bin_float(float f)
|
|||||||
return bin;
|
return bin;
|
||||||
}
|
}
|
||||||
|
|
||||||
DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, float *rgb, float *ycc, float *ycc709)
|
DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, float *rgb, float *ycc)
|
||||||
{
|
{
|
||||||
|
float yuv[3];
|
||||||
|
|
||||||
|
/* vectorscope*/
|
||||||
|
rgb_to_yuv(rgb[0], rgb[1], rgb[2], &yuv[0], &yuv[1], &yuv[2]);
|
||||||
|
scopes->vecscope[idx + 0] = yuv[1];
|
||||||
|
scopes->vecscope[idx + 1] = yuv[2];
|
||||||
|
|
||||||
|
/* waveform */
|
||||||
switch (scopes->wavefrm_mode) {
|
switch (scopes->wavefrm_mode) {
|
||||||
case SCOPES_WAVEFRM_RGB:
|
case SCOPES_WAVEFRM_RGB:
|
||||||
scopes->waveform_1[idx + 0] = fx;
|
scopes->waveform_1[idx + 0] = fx;
|
||||||
@ -912,35 +920,17 @@ DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, f
|
|||||||
break;
|
break;
|
||||||
case SCOPES_WAVEFRM_LUM:
|
case SCOPES_WAVEFRM_LUM:
|
||||||
scopes->waveform_1[idx + 0] = fx;
|
scopes->waveform_1[idx + 0] = fx;
|
||||||
scopes->waveform_1[idx + 1] = 0.299*rgb[0] + 0.587*rgb[1] + 0.114*rgb[2];
|
scopes->waveform_1[idx + 1] = ycc[0];
|
||||||
break;
|
break;
|
||||||
case SCOPES_WAVEFRM_YCC_JPEG:
|
case SCOPES_WAVEFRM_YCC_JPEG:
|
||||||
scopes->waveform_1[idx + 0] = fx;
|
|
||||||
scopes->waveform_1[idx + 1] = ycc[0] * INV_255;
|
|
||||||
scopes->waveform_2[idx + 0] = fx;
|
|
||||||
scopes->waveform_2[idx + 1] = ycc[1] * INV_255;
|
|
||||||
scopes->waveform_3[idx + 0] = fx;
|
|
||||||
scopes->waveform_3[idx + 1] = ycc[2] * INV_255;
|
|
||||||
break;
|
|
||||||
case SCOPES_WAVEFRM_YCC_709:
|
case SCOPES_WAVEFRM_YCC_709:
|
||||||
scopes->waveform_1[idx + 0] = fx;
|
|
||||||
scopes->waveform_1[idx + 1] = ycc709[0] * INV_255;
|
|
||||||
scopes->waveform_2[idx + 0] = fx;
|
|
||||||
scopes->waveform_2[idx + 1] = ycc709[1] * INV_255;
|
|
||||||
scopes->waveform_3[idx + 0] = fx;
|
|
||||||
scopes->waveform_3[idx + 1] = ycc709[2] * INV_255;
|
|
||||||
break;
|
|
||||||
case SCOPES_WAVEFRM_YCC_601:
|
case SCOPES_WAVEFRM_YCC_601:
|
||||||
{
|
|
||||||
float ycc601[3];
|
|
||||||
rgb_to_ycc(rgb[0], rgb[1], rgb[2], &ycc601[0], &ycc601[1], &ycc601[2], BLI_YCC_ITU_BT601);
|
|
||||||
scopes->waveform_1[idx + 0] = fx;
|
scopes->waveform_1[idx + 0] = fx;
|
||||||
scopes->waveform_1[idx + 1] = ycc601[0] * INV_255;
|
scopes->waveform_1[idx + 1] = ycc[0];
|
||||||
scopes->waveform_2[idx + 0] = fx;
|
scopes->waveform_2[idx + 0] = fx;
|
||||||
scopes->waveform_2[idx + 1] = ycc601[1] * INV_255;
|
scopes->waveform_2[idx + 1] = ycc[1];
|
||||||
scopes->waveform_3[idx + 0] = fx;
|
scopes->waveform_3[idx + 0] = fx;
|
||||||
scopes->waveform_3[idx + 1] = ycc601[2] * INV_255;
|
scopes->waveform_3[idx + 1] = ycc[2];
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -949,11 +939,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
|
|||||||
{
|
{
|
||||||
int x, y, c, n, nl;
|
int x, y, c, n, nl;
|
||||||
double div, divl;
|
double div, divl;
|
||||||
float *rf, *drf;
|
float *rf;
|
||||||
unsigned char *rc, *drc;
|
unsigned char *rc;
|
||||||
unsigned int *bin_r, *bin_g, *bin_b, *bin_lum;
|
unsigned int *bin_r, *bin_g, *bin_b, *bin_lum;
|
||||||
int savedlines, saveline;
|
int savedlines, saveline;
|
||||||
float rgb[3], ycc[3], ycc709[3];
|
float rgb[3], ycc[3];
|
||||||
|
int ycc_mode;
|
||||||
|
|
||||||
if (scopes->ok == 1 ) return;
|
if (scopes->ok == 1 ) return;
|
||||||
|
|
||||||
@ -964,6 +955,22 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
|
|||||||
scopes->hist.channels = 3;
|
scopes->hist.channels = 3;
|
||||||
scopes->hist.x_resolution = 256;
|
scopes->hist.x_resolution = 256;
|
||||||
|
|
||||||
|
switch (scopes->wavefrm_mode) {
|
||||||
|
case SCOPES_WAVEFRM_RGB:
|
||||||
|
ycc_mode = -1;
|
||||||
|
break;
|
||||||
|
case SCOPES_WAVEFRM_LUM:
|
||||||
|
case SCOPES_WAVEFRM_YCC_JPEG:
|
||||||
|
ycc_mode = BLI_YCC_JFIF_0_255;
|
||||||
|
break;
|
||||||
|
case SCOPES_WAVEFRM_YCC_601:
|
||||||
|
ycc_mode = BLI_YCC_ITU_BT601;
|
||||||
|
break;
|
||||||
|
case SCOPES_WAVEFRM_YCC_709:
|
||||||
|
ycc_mode = BLI_YCC_ITU_BT709;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* temp table to count pix value for histo */
|
/* temp table to count pix value for histo */
|
||||||
bin_r = MEM_callocN(256 * sizeof(unsigned int), "temp historgram bins");
|
bin_r = MEM_callocN(256 * sizeof(unsigned int), "temp historgram bins");
|
||||||
bin_g = MEM_callocN(256 * sizeof(unsigned int), "temp historgram bins");
|
bin_g = MEM_callocN(256 * sizeof(unsigned int), "temp historgram bins");
|
||||||
@ -976,19 +983,11 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
|
|||||||
if (scopes->sample_full)
|
if (scopes->sample_full)
|
||||||
scopes->sample_lines = ibuf->y;
|
scopes->sample_lines = ibuf->y;
|
||||||
|
|
||||||
if( scopes->samples_ibuf) {
|
|
||||||
IMB_freeImBuf(scopes->samples_ibuf);
|
|
||||||
scopes->samples_ibuf=NULL;
|
|
||||||
}
|
|
||||||
/* scan the image */
|
/* scan the image */
|
||||||
savedlines=0;
|
savedlines=0;
|
||||||
for (c=0; c<3; c++) {
|
for (c=0; c<3; c++) {
|
||||||
scopes->rgbminmax[c][0]=100.0f;
|
scopes->minmax[c][0]=25500.0f;
|
||||||
scopes->rgbminmax[c][1]=-100.0f;
|
scopes->minmax[c][1]=-25500.0f;
|
||||||
scopes->yccminmax[c][0]=25500.0f;
|
|
||||||
scopes->yccminmax[c][1]=-25500.0f;
|
|
||||||
scopes->ycc709minmax[c][0]=25500.0f;
|
|
||||||
scopes->ycc709minmax[c][1]=-25500.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scopes->waveform_tot = ibuf->x*scopes->sample_lines;
|
scopes->waveform_tot = ibuf->x*scopes->sample_lines;
|
||||||
@ -999,114 +998,68 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
|
|||||||
MEM_freeN(scopes->waveform_2);
|
MEM_freeN(scopes->waveform_2);
|
||||||
if (scopes->waveform_3)
|
if (scopes->waveform_3)
|
||||||
MEM_freeN(scopes->waveform_3);
|
MEM_freeN(scopes->waveform_3);
|
||||||
|
if (scopes->vecscope)
|
||||||
|
MEM_freeN(scopes->vecscope);
|
||||||
|
|
||||||
scopes->waveform_1= MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 1");
|
scopes->waveform_1= MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 1");
|
||||||
scopes->waveform_2= MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 2");
|
scopes->waveform_2= MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 2");
|
||||||
scopes->waveform_3= MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 3");
|
scopes->waveform_3= MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 3");
|
||||||
|
scopes->vecscope= MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "vectorscope point channel");
|
||||||
|
|
||||||
if (ibuf->rect_float) {
|
if (ibuf->rect_float)
|
||||||
scopes->samples_ibuf = IMB_allocImBuf(ibuf->x, scopes->sample_lines, 32, IB_rectfloat, 0 );
|
|
||||||
rf = ibuf->rect_float;
|
rf = ibuf->rect_float;
|
||||||
drf= scopes->samples_ibuf->rect_float;
|
else if (ibuf->rect)
|
||||||
|
rc = (unsigned char *)ibuf->rect;
|
||||||
for (y = 0; y < ibuf->y; y++) {
|
|
||||||
if (savedlines<scopes->sample_lines && y>=((savedlines)*ibuf->y)/(scopes->sample_lines+1)) {
|
for (y = 0; y < ibuf->y; y++) {
|
||||||
saveline=1;
|
if (savedlines<scopes->sample_lines && y>=((savedlines)*ibuf->y)/(scopes->sample_lines+1)) {
|
||||||
} else saveline=0;
|
saveline=1;
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
} else saveline=0;
|
||||||
|
for (x = 0; x < ibuf->x; x++) {
|
||||||
|
|
||||||
|
if (ibuf->rect_float) {
|
||||||
if (use_color_management)
|
if (use_color_management)
|
||||||
linearrgb_to_srgb_v3_v3(rgb, rf);
|
linearrgb_to_srgb_v3_v3(rgb, rf);
|
||||||
else
|
else
|
||||||
copy_v3_v3(rgb, rf);
|
copy_v3_v3(rgb, rf);
|
||||||
|
|
||||||
rgb_to_ycc(rgb[0],rgb[1],rgb[2],&ycc[0],&ycc[1],&ycc[2],BLI_YCC_JFIF_0_255);
|
|
||||||
rgb_to_ycc(rgb[0],rgb[1],rgb[2],&ycc709[0],&ycc709[1],&ycc709[2],BLI_YCC_ITU_BT709);
|
|
||||||
|
|
||||||
/* check for min max */
|
|
||||||
for (c=0; c<3; c++) {
|
|
||||||
if (rgb[c] < scopes->rgbminmax[c][0]) scopes->rgbminmax[c][0] = rgb[c];
|
|
||||||
if (rgb[c] > scopes->rgbminmax[c][1]) scopes->rgbminmax[c][1] = rgb[c];
|
|
||||||
if (ycc[c] < scopes->yccminmax[c][0]) scopes->yccminmax[c][0] = ycc[c];
|
|
||||||
if (ycc[c] > scopes->yccminmax[c][1]) scopes->yccminmax[c][1] = ycc[c];
|
|
||||||
if (ycc709[c] < scopes->ycc709minmax[c][0]) scopes->ycc709minmax[c][0] = ycc709[c];
|
|
||||||
if (ycc709[c] > scopes->ycc709minmax[c][1]) scopes->ycc709minmax[c][1] = ycc709[c];
|
|
||||||
}
|
|
||||||
/* increment count for histo*/
|
|
||||||
bin_r[ get_bin_float(rgb[0]) ] += 1;
|
|
||||||
bin_g[ get_bin_float(rgb[1]) ] += 1;
|
|
||||||
bin_b[ get_bin_float(rgb[2]) ] += 1;
|
|
||||||
bin_lum[ get_bin_float(ycc[0] * INV_255) ] += 1;
|
|
||||||
|
|
||||||
/* save sample if needed */
|
|
||||||
if(saveline) {
|
|
||||||
const float fx = (float)x / (float)ibuf->x;
|
|
||||||
const int idx = 2*(ibuf->x*savedlines+x);
|
|
||||||
|
|
||||||
save_sample_line(scopes, idx, fx, rgb, ycc, ycc709);
|
|
||||||
|
|
||||||
drf[0]=rgb[0];
|
|
||||||
drf[1]=rgb[1];
|
|
||||||
drf[2]=rgb[2];
|
|
||||||
drf+= scopes->samples_ibuf->channels;
|
|
||||||
}
|
|
||||||
rf+= ibuf->channels;
|
|
||||||
}
|
}
|
||||||
if (saveline)
|
else if (ibuf->rect) {
|
||||||
savedlines +=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (ibuf->rect) {
|
|
||||||
scopes->samples_ibuf = IMB_allocImBuf(ibuf->x, scopes->sample_lines, 32, IB_rect, 0 );
|
|
||||||
rc = (unsigned char *)ibuf->rect;
|
|
||||||
drc= (unsigned char *) scopes->samples_ibuf->rect;
|
|
||||||
|
|
||||||
for (y = 0; y < ibuf->y; y++) {
|
|
||||||
if (savedlines<scopes->sample_lines && y>=((savedlines)*ibuf->y)/(scopes->sample_lines+1)) {
|
|
||||||
saveline=1;
|
|
||||||
} else saveline=0;
|
|
||||||
|
|
||||||
for (x = 0; x < ibuf->x; x++) {
|
|
||||||
|
|
||||||
for (c=0; c<3; c++)
|
for (c=0; c<3; c++)
|
||||||
rgb[c] = rc[c] * INV_255;
|
rgb[c] = rc[c] * INV_255;
|
||||||
rgb_to_ycc(rgb[0],rgb[1],rgb[2],&ycc[0],&ycc[1],&ycc[2],BLI_YCC_JFIF_0_255);
|
|
||||||
rgb_to_ycc(rgb[0],rgb[1],rgb[2],&ycc709[0],&ycc709[1],&ycc709[2],BLI_YCC_ITU_BT709);
|
|
||||||
|
|
||||||
/* check for min max */
|
|
||||||
for (c=0; c<3; c++) {
|
|
||||||
if (rgb[c] < scopes->rgbminmax[c][0]) scopes->rgbminmax[c][0] = rgb[c];
|
|
||||||
if (rgb[c] > scopes->rgbminmax[c][1]) scopes->rgbminmax[c][1] = rgb[c];
|
|
||||||
if (ycc[c] < scopes->yccminmax[c][0]) scopes->yccminmax[c][0] = ycc[c];
|
|
||||||
if (ycc[c] > scopes->yccminmax[c][1]) scopes->yccminmax[c][1] = ycc[c];
|
|
||||||
if (ycc709[c] < scopes->ycc709minmax[c][0]) scopes->ycc709minmax[c][0] = ycc709[c];
|
|
||||||
if (ycc709[c] > scopes->ycc709minmax[c][1]) scopes->ycc709minmax[c][1] = ycc709[c];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* increment count for histo */
|
|
||||||
bin_r[ rc[0] ] += 1;
|
|
||||||
bin_g[ rc[1] ] += 1;
|
|
||||||
bin_b[ rc[2] ] += 1;
|
|
||||||
bin_lum[ get_bin_float(ycc[0] * INV_255) ] += 1;
|
|
||||||
|
|
||||||
/* save sample if needed */
|
|
||||||
if(saveline) {
|
|
||||||
const float fx = (float)x / (float)ibuf->x;
|
|
||||||
const int idx = 2*(ibuf->x*savedlines+x);
|
|
||||||
|
|
||||||
save_sample_line(scopes, idx, fx, rgb, ycc, ycc709);
|
|
||||||
|
|
||||||
drc[0]=rc[0];
|
|
||||||
drc[1]=rc[1];
|
|
||||||
drc[2]=rc[2];
|
|
||||||
drc+= 4;
|
|
||||||
}
|
|
||||||
rc += ibuf->channels;
|
|
||||||
}
|
}
|
||||||
if (saveline)
|
/* check for min max */
|
||||||
savedlines +=1;
|
if(ycc_mode == -1 ) {
|
||||||
|
for (c=0; c<3; c++) {
|
||||||
|
if (rgb[c] < scopes->minmax[c][0]) scopes->minmax[c][0] = rgb[c];
|
||||||
|
if (rgb[c] > scopes->minmax[c][1]) scopes->minmax[c][1] = rgb[c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rgb_to_ycc(rgb[0],rgb[1],rgb[2],&ycc[0],&ycc[1],&ycc[2], ycc_mode);
|
||||||
|
for (c=0; c<3; c++) {
|
||||||
|
ycc[c] *=INV_255;
|
||||||
|
if (ycc[c] < scopes->minmax[c][0]) scopes->minmax[c][0] = ycc[c];
|
||||||
|
if (ycc[c] > scopes->minmax[c][1]) scopes->minmax[c][1] = ycc[c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* increment count for histo*/
|
||||||
|
bin_r[ get_bin_float(rgb[0]) ] += 1;
|
||||||
|
bin_g[ get_bin_float(rgb[1]) ] += 1;
|
||||||
|
bin_b[ get_bin_float(rgb[2]) ] += 1;
|
||||||
|
bin_lum[ get_bin_float(ycc[0]) ] += 1;
|
||||||
|
|
||||||
|
/* save sample if needed */
|
||||||
|
if(saveline) {
|
||||||
|
const float fx = (float)x / (float)ibuf->x;
|
||||||
|
const int idx = 2*(ibuf->x*savedlines+x);
|
||||||
|
save_sample_line(scopes, idx, fx, rgb, ycc);
|
||||||
|
}
|
||||||
|
|
||||||
|
rf+= ibuf->channels;
|
||||||
|
rc+= ibuf->channels;
|
||||||
}
|
}
|
||||||
|
if (saveline)
|
||||||
|
savedlines +=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert hist data to float (proportional to max count) */
|
/* convert hist data to float (proportional to max count) */
|
||||||
@ -1152,9 +1105,8 @@ void scopes_free(Scopes *scopes)
|
|||||||
MEM_freeN(scopes->waveform_3);
|
MEM_freeN(scopes->waveform_3);
|
||||||
scopes->waveform_3 = NULL;
|
scopes->waveform_3 = NULL;
|
||||||
}
|
}
|
||||||
|
if (scopes->vecscope) {
|
||||||
if( scopes->samples_ibuf) {
|
MEM_freeN(scopes->vecscope);
|
||||||
IMB_freeImBuf(scopes->samples_ibuf);
|
scopes->vecscope = NULL;
|
||||||
scopes->samples_ibuf=NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4834,10 +4834,10 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
|
|||||||
|
|
||||||
sima->image= restore_pointer_by_name(newmain, (ID *)sima->image, 1);
|
sima->image= restore_pointer_by_name(newmain, (ID *)sima->image, 1);
|
||||||
|
|
||||||
sima->scopes.samples_ibuf = NULL;
|
|
||||||
sima->scopes.waveform_1 = NULL;
|
sima->scopes.waveform_1 = NULL;
|
||||||
sima->scopes.waveform_2 = NULL;
|
sima->scopes.waveform_2 = NULL;
|
||||||
sima->scopes.waveform_3 = NULL;
|
sima->scopes.waveform_3 = NULL;
|
||||||
|
sima->scopes.vecscope = NULL;
|
||||||
sima->scopes.ok = 0;
|
sima->scopes.ok = 0;
|
||||||
|
|
||||||
/* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data
|
/* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data
|
||||||
@ -5111,10 +5111,10 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
|
|||||||
|
|
||||||
sima->iuser.scene= NULL;
|
sima->iuser.scene= NULL;
|
||||||
sima->iuser.ok= 1;
|
sima->iuser.ok= 1;
|
||||||
sima->scopes.samples_ibuf = NULL;
|
|
||||||
sima->scopes.waveform_1 = NULL;
|
sima->scopes.waveform_1 = NULL;
|
||||||
sima->scopes.waveform_2 = NULL;
|
sima->scopes.waveform_2 = NULL;
|
||||||
sima->scopes.waveform_3 = NULL;
|
sima->scopes.waveform_3 = NULL;
|
||||||
|
sima->scopes.vecscope = NULL;
|
||||||
sima->scopes.ok = 0;
|
sima->scopes.ok = 0;
|
||||||
|
|
||||||
/* WARNING: gpencil data is no longer stored directly in sima after 2.5
|
/* WARNING: gpencil data is no longer stored directly in sima after 2.5
|
||||||
@ -10737,8 +10737,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
|||||||
do_version_old_trackto_to_constraints(ob);
|
do_version_old_trackto_to_constraints(ob);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put 2.50 compatibility code here until next subversion bump */
|
if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 5)) {
|
||||||
{
|
|
||||||
bScreen *sc;
|
bScreen *sc;
|
||||||
|
|
||||||
/* Image editor scopes */
|
/* Image editor scopes */
|
||||||
@ -10754,12 +10753,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
|||||||
sima->scopes.wavefrm_alpha=0.3;
|
sima->scopes.wavefrm_alpha=0.3;
|
||||||
sima->scopes.vecscope_alpha=0.3;
|
sima->scopes.vecscope_alpha=0.3;
|
||||||
sima->scopes.wavefrm_height= 100;
|
sima->scopes.wavefrm_height= 100;
|
||||||
|
sima->scopes.vecscope_height= 100;
|
||||||
sima->scopes.hist.height= 100;
|
sima->scopes.hist.height= 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* put 2.50 compatibility code here until next subversion bump */
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
|
||||||
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
|
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
|
||||||
|
@ -688,6 +688,32 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
|||||||
#endif // INTERNATIONAL
|
#endif // INTERNATIONAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void draw_scope_end(rctf *rect, GLint *scissor)
|
||||||
|
{
|
||||||
|
float scaler_x1, scaler_x2;
|
||||||
|
|
||||||
|
/* restore scissortest */
|
||||||
|
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
|
||||||
|
|
||||||
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
/* scale widget */
|
||||||
|
scaler_x1 = rect->xmin + (rect->xmax - rect->xmin)/2 - SCOPE_RESIZE_PAD;
|
||||||
|
scaler_x2 = rect->xmin + (rect->xmax - rect->xmin)/2 + SCOPE_RESIZE_PAD;
|
||||||
|
|
||||||
|
glColor4f(0.f, 0.f, 0.f, 0.25f);
|
||||||
|
fdrawline(scaler_x1, rect->ymin-4, scaler_x2, rect->ymin-4);
|
||||||
|
fdrawline(scaler_x1, rect->ymin-7, scaler_x2, rect->ymin-7);
|
||||||
|
glColor4f(1.f, 1.f, 1.f, 0.25f);
|
||||||
|
fdrawline(scaler_x1, rect->ymin-5, scaler_x2, rect->ymin-5);
|
||||||
|
fdrawline(scaler_x1, rect->ymin-8, scaler_x2, rect->ymin-8);
|
||||||
|
|
||||||
|
/* outline */
|
||||||
|
glColor4f(0.f, 0.f, 0.f, 0.5f);
|
||||||
|
uiSetRoundBox(15);
|
||||||
|
gl_round_box(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, rect->ymax+1, 3.0f);
|
||||||
|
}
|
||||||
|
|
||||||
void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, float *data, int res)
|
void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, float *data, int res)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -728,7 +754,6 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *
|
|||||||
rctf rect;
|
rctf rect;
|
||||||
int i;
|
int i;
|
||||||
float w, h;
|
float w, h;
|
||||||
float scaler_x1, scaler_x2;
|
|
||||||
//float alpha;
|
//float alpha;
|
||||||
GLint scissor[4];
|
GLint scissor[4];
|
||||||
|
|
||||||
@ -740,8 +765,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *
|
|||||||
rect.ymax = (float)recti->ymax-1;
|
rect.ymax = (float)recti->ymax-1;
|
||||||
|
|
||||||
w = rect.xmax - rect.xmin;
|
w = rect.xmax - rect.xmin;
|
||||||
h = rect.ymax - rect.ymin;
|
h = (rect.ymax - rect.ymin) * hist->ymax;
|
||||||
h *= hist->ymax;
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
@ -771,27 +795,9 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *
|
|||||||
if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_B)
|
if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_B)
|
||||||
histogram_draw_one(0.0, 0.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_b, res);
|
histogram_draw_one(0.0, 0.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_b, res);
|
||||||
}
|
}
|
||||||
/* restore scissortest */
|
|
||||||
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
|
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
/* outline, scale gripper */
|
||||||
|
draw_scope_end(&rect, scissor);
|
||||||
/* height scaling widget */
|
|
||||||
scaler_x1 = rect.xmin + w/2 - SCOPE_RESIZE_PAD;
|
|
||||||
scaler_x2 = rect.xmin + w/2 + SCOPE_RESIZE_PAD;
|
|
||||||
|
|
||||||
glColor4f(0.f, 0.f, 0.f, 0.25f);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-4, scaler_x2, rect.ymin-4);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-7, scaler_x2, rect.ymin-7);
|
|
||||||
glColor4f(1.f, 1.f, 1.f, 0.25f);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-5, scaler_x2, rect.ymin-5);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-8, scaler_x2, rect.ymin-8);
|
|
||||||
|
|
||||||
glColor4f(0.f, 0.f, 0.f, 0.5f);
|
|
||||||
uiSetRoundBox(15);
|
|
||||||
gl_round_box(GL_LINE_LOOP, rect.xmin-1, rect.ymin, rect.xmax+1, rect.ymax+1, 3.0f);
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti)
|
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti)
|
||||||
@ -805,9 +811,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r
|
|||||||
float colorsycc[3][3] = {{1,0,1},{1,1,0},{0,1,1}};
|
float colorsycc[3][3] = {{1,0,1},{1,1,0},{0,1,1}};
|
||||||
float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */
|
float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */
|
||||||
float min, max;
|
float min, max;
|
||||||
float scaler_x1, scaler_x2;
|
|
||||||
|
|
||||||
if (scopes==NULL || scopes->samples_ibuf==NULL) return;
|
if (scopes==NULL) return;
|
||||||
|
|
||||||
rect.xmin = (float)recti->xmin+1;
|
rect.xmin = (float)recti->xmin+1;
|
||||||
rect.xmax = (float)recti->xmax-1;
|
rect.xmax = (float)recti->xmax-1;
|
||||||
@ -815,9 +820,9 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r
|
|||||||
rect.ymax = (float)recti->ymax-1;
|
rect.ymax = (float)recti->ymax-1;
|
||||||
|
|
||||||
if (scopes->wavefrm_yfac < 0.5f )
|
if (scopes->wavefrm_yfac < 0.5f )
|
||||||
scopes->wavefrm_yfac =1.0f;
|
scopes->wavefrm_yfac =0.98f;
|
||||||
w = rect.xmax - rect.xmin-7;
|
w = rect.xmax - rect.xmin-7;
|
||||||
h = (rect.ymax - rect.ymin)/scopes->wavefrm_yfac;
|
h = (rect.ymax - rect.ymin)*scopes->wavefrm_yfac;
|
||||||
yofs= rect.ymin + (rect.ymax - rect.ymin -h)/2.0f;
|
yofs= rect.ymin + (rect.ymax - rect.ymin -h)/2.0f;
|
||||||
w3=w/3.0f;
|
w3=w/3.0f;
|
||||||
|
|
||||||
@ -839,7 +844,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r
|
|||||||
gl_round_box(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
|
gl_round_box(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
|
||||||
|
|
||||||
|
|
||||||
/* need scissor test, histogram can draw outside of boundary */
|
/* need scissor test, waveform can draw outside of boundary */
|
||||||
glGetIntegerv(GL_VIEWPORT, scissor);
|
glGetIntegerv(GL_VIEWPORT, scissor);
|
||||||
glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
|
glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
|
||||||
|
|
||||||
@ -861,6 +866,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r
|
|||||||
fdrawline(rect.xmin+i*w3, rect.ymin, rect.xmin+i*w3, rect.ymax);
|
fdrawline(rect.xmin+i*w3, rect.ymin, rect.xmin+i*w3, rect.ymax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* separate min max zone on the right */
|
/* separate min max zone on the right */
|
||||||
fdrawline(rect.xmin+w, rect.ymin, rect.xmin+w, rect.ymax);
|
fdrawline(rect.xmin+w, rect.ymin, rect.xmin+w, rect.ymax);
|
||||||
/* 16-235-240 level in case of ITU-R BT601/709 */
|
/* 16-235-240 level in case of ITU-R BT601/709 */
|
||||||
@ -871,7 +877,9 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r
|
|||||||
fdrawline(rect.xmin+3*w3, yofs+h*235.0f/255.0f, rect.xmax+1, yofs+h*235.0f/255.0f);
|
fdrawline(rect.xmin+3*w3, yofs+h*235.0f/255.0f, rect.xmax+1, yofs+h*235.0f/255.0f);
|
||||||
fdrawline(rect.xmin+w3, yofs+h*240.0f/255.0f, rect.xmax+1, yofs+h*240.0f/255.0f);
|
fdrawline(rect.xmin+w3, yofs+h*240.0f/255.0f, rect.xmax+1, yofs+h*240.0f/255.0f);
|
||||||
}
|
}
|
||||||
|
/* 7.5 IRE black point level for NTSC */
|
||||||
|
if (scopes->wavefrm_mode== SCOPES_WAVEFRM_LUM)
|
||||||
|
fdrawline(rect.xmin, yofs+h*0.075f, rect.xmax+1, yofs+h*0.075f);
|
||||||
|
|
||||||
/* LUMA (1 channel) */
|
/* LUMA (1 channel) */
|
||||||
glBlendFunc(GL_ONE,GL_ONE);
|
glBlendFunc(GL_ONE,GL_ONE);
|
||||||
@ -881,23 +889,20 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r
|
|||||||
glBlendFunc(GL_ONE,GL_ONE);
|
glBlendFunc(GL_ONE,GL_ONE);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
glTranslatef(rect.xmin, yofs, 0.f);
|
glTranslatef(rect.xmin, yofs, 0.f);
|
||||||
glScalef(w, h, 0.f);
|
glScalef(w, h, 0.f);
|
||||||
|
|
||||||
glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
|
glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
|
||||||
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
||||||
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
/* min max */
|
/* min max */
|
||||||
glColor3f(.5f, .5f, .5f);
|
glColor3f(.5f, .5f, .5f);
|
||||||
min= yofs+scopes->yccminmax[0][0]*h/255.0f;
|
min= yofs+scopes->minmax[0][0]*h;
|
||||||
max= yofs+scopes->yccminmax[0][1]*h/255.0f;
|
max= yofs+scopes->minmax[0][1]*h;
|
||||||
CLAMP(min, rect.ymin, rect.ymax);
|
CLAMP(min, rect.ymin, rect.ymax);
|
||||||
CLAMP(max, rect.ymin, rect.ymax);
|
CLAMP(max, rect.ymin, rect.ymax);
|
||||||
fdrawline(rect.xmax-3,min,rect.xmax-3,max);
|
fdrawline(rect.xmax-3,min,rect.xmax-3,max);
|
||||||
@ -910,103 +915,45 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *r
|
|||||||
glBlendFunc(GL_ONE,GL_ONE);
|
glBlendFunc(GL_ONE,GL_ONE);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
glTranslatef(rect.xmin, yofs, 0.f);
|
glTranslatef(rect.xmin, yofs, 0.f);
|
||||||
glScalef(w3, h, 0.f);
|
glScalef(w3, h, 0.f);
|
||||||
|
|
||||||
glColor3fv((rgb)?colors_alpha[0]:colorsycc_alpha[0]);
|
glColor3fv((rgb)?colors_alpha[0]:colorsycc_alpha[0]);
|
||||||
|
|
||||||
glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
|
glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
|
||||||
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
||||||
|
|
||||||
glTranslatef(1.f, 0.f, 0.f);
|
glTranslatef(1.f, 0.f, 0.f);
|
||||||
glColor3fv((rgb)?colors_alpha[1]:colorsycc_alpha[1]);
|
glColor3fv((rgb)?colors_alpha[1]:colorsycc_alpha[1]);
|
||||||
|
|
||||||
glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_2);
|
glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_2);
|
||||||
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
||||||
|
|
||||||
glTranslatef(1.f, 0.f, 0.f);
|
glTranslatef(1.f, 0.f, 0.f);
|
||||||
glColor3fv((rgb)?colors_alpha[2]:colorsycc_alpha[2]);
|
glColor3fv((rgb)?colors_alpha[2]:colorsycc_alpha[2]);
|
||||||
|
|
||||||
glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_3);
|
glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_3);
|
||||||
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
||||||
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
|
||||||
/* min max */
|
/* min max */
|
||||||
if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB) {
|
for (c=0; c<3; c++) {
|
||||||
for (c=0; c<3; c++) {
|
if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB)
|
||||||
glColor3f(colors[c][0]*0.75, colors[c][1]*0.75, colors[c][2]*0.75);
|
glColor3f(colors[c][0]*0.75, colors[c][1]*0.75, colors[c][2]*0.75);
|
||||||
min= yofs+scopes->rgbminmax[c][0]*h;
|
else
|
||||||
max= yofs+scopes->rgbminmax[c][1]*h;
|
glColor3f(colorsycc[c][0]*0.75, colorsycc[c][1]*0.75, colorsycc[c][2]*0.75);
|
||||||
CLAMP(min, rect.ymin, rect.ymax);
|
min= yofs+scopes->minmax[c][0]*h;
|
||||||
CLAMP(max, rect.ymin, rect.ymax);
|
max= yofs+scopes->minmax[c][1]*h;
|
||||||
fdrawline(rect.xmin+w+2+c*2,min,rect.xmin+w+2+c*2,max);
|
CLAMP(min, rect.ymin, rect.ymax);
|
||||||
}
|
CLAMP(max, rect.ymin, rect.ymax);
|
||||||
} else {
|
fdrawline(rect.xmin+w+2+c*2,min,rect.xmin+w+2+c*2,max);
|
||||||
if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_JPEG)) {
|
|
||||||
for (c=0; c<3; c++) {
|
|
||||||
glColor3f(colorsycc[c][0]*0.75, colorsycc[c][1]*0.75, colorsycc[c][2]*0.75);
|
|
||||||
/* we get ITU 601 min max from remapping JPEG*/
|
|
||||||
if (scopes->wavefrm_mode== SCOPES_WAVEFRM_YCC_601) {
|
|
||||||
if(c==0) {
|
|
||||||
min= yofs+(16+(219*scopes->yccminmax[c][0]/255))*h/255.0f;
|
|
||||||
max= yofs+(16+(219*scopes->yccminmax[c][1]/255))*h/255.0f;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
min= yofs+(16+(224*scopes->yccminmax[c][0]/255))*h/255.0f;
|
|
||||||
max= yofs+(16+(224*scopes->yccminmax[c][1]/255))*h/255.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* rescale ycc to 0-1*/
|
|
||||||
else {
|
|
||||||
min= yofs+scopes->yccminmax[c][0]*h/255.0f;
|
|
||||||
max= yofs+scopes->yccminmax[c][1]*h/255.0f;
|
|
||||||
}
|
|
||||||
CLAMP(min, rect.ymin, rect.ymax);
|
|
||||||
CLAMP(max, rect.ymin, rect.ymax);
|
|
||||||
fdrawline(rect.xmin+2+w+c*2,min,rect.xmin+2+w+c*2,max);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (scopes->wavefrm_mode== SCOPES_WAVEFRM_YCC_709) {
|
|
||||||
for (c=0; c<3; c++) {
|
|
||||||
glColor3f(colorsycc[c][0]*0.75, colorsycc[c][1]*0.75, colorsycc[c][2]*0.75);
|
|
||||||
min= yofs+scopes->ycc709minmax[c][0]*h/255.0f;
|
|
||||||
max= yofs+scopes->ycc709minmax[c][1]*h/255.0f;
|
|
||||||
CLAMP(min, rect.ymin, rect.ymax);
|
|
||||||
CLAMP(max, rect.ymin, rect.ymax);
|
|
||||||
fdrawline(rect.xmin+2+w+c*2,min,rect.xmin+2+w+c*2,max);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* restore scissortest */
|
/* outline, scale gripper */
|
||||||
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
|
draw_scope_end(&rect, scissor);
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
/* height scaling widget */
|
|
||||||
scaler_x1 = rect.xmin + w/2 - SCOPE_RESIZE_PAD;
|
|
||||||
scaler_x2 = rect.xmin + w/2 + SCOPE_RESIZE_PAD;
|
|
||||||
|
|
||||||
glColor4f(0.f, 0.f, 0.f, 0.25f);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-4, scaler_x2, rect.ymin-4);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-7, scaler_x2, rect.ymin-7);
|
|
||||||
glColor4f(1.f, 1.f, 1.f, 0.25f);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-5, scaler_x2, rect.ymin-5);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-8, scaler_x2, rect.ymin-8);
|
|
||||||
|
|
||||||
glColor4f(0.f, 0.f, 0.f, 0.5f);
|
|
||||||
uiSetRoundBox(15);
|
|
||||||
gl_round_box(GL_LINE_LOOP, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float polar_to_x(float center, float diam, float ampli, float angle)
|
float polar_to_x(float center, float diam, float ampli, float angle)
|
||||||
@ -1076,18 +1023,14 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti
|
|||||||
{
|
{
|
||||||
Scopes *scopes = (Scopes *)but->poin;
|
Scopes *scopes = (Scopes *)but->poin;
|
||||||
rctf rect;
|
rctf rect;
|
||||||
int i, j, x, y;
|
int i, j;
|
||||||
int skina= 123; /* angle in degree of the skin tone line */
|
int skina= 123; /* angle in degree of the skin tone line */
|
||||||
float w, h, centerx, centery, diam;
|
float w, h, centerx, centery, diam;
|
||||||
float alpha;
|
float alpha;
|
||||||
float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
|
float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
|
||||||
unsigned char *rc;
|
|
||||||
float *rf;
|
|
||||||
GLint scissor[4];
|
GLint scissor[4];
|
||||||
float u, v;
|
|
||||||
float scaler_x1, scaler_x2;
|
|
||||||
|
|
||||||
if (scopes==NULL || scopes->samples_ibuf==NULL) return;
|
if (scopes==NULL) return;
|
||||||
|
|
||||||
rect.xmin = (float)recti->xmin+1;
|
rect.xmin = (float)recti->xmin+1;
|
||||||
rect.xmax = (float)recti->xmax-1;
|
rect.xmax = (float)recti->xmax-1;
|
||||||
@ -1098,8 +1041,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti
|
|||||||
h = rect.ymax - rect.ymin;
|
h = rect.ymax - rect.ymin;
|
||||||
centerx = rect.xmin + w/2;
|
centerx = rect.xmin + w/2;
|
||||||
centery = rect.ymin + h/2;
|
centery = rect.ymin + h/2;
|
||||||
diam= h;
|
diam= (w<h)?w:h;
|
||||||
if (w<diam) diam=w;
|
|
||||||
|
|
||||||
alpha = scopes->vecscope_alpha*scopes->vecscope_alpha*scopes->vecscope_alpha;
|
alpha = scopes->vecscope_alpha*scopes->vecscope_alpha*scopes->vecscope_alpha;
|
||||||
|
|
||||||
@ -1136,55 +1078,24 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti
|
|||||||
/* saturation points */
|
/* saturation points */
|
||||||
for(i=0; i<6; i++)
|
for(i=0; i<6; i++)
|
||||||
vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]);
|
vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]);
|
||||||
|
|
||||||
/* pixel point cloud */
|
/* pixel point cloud */
|
||||||
glBlendFunc(GL_ONE,GL_ONE);
|
glBlendFunc(GL_ONE,GL_ONE);
|
||||||
glBegin(GL_POINTS);
|
|
||||||
glColor4f(alpha, alpha, alpha, alpha);
|
glColor4f(alpha, alpha, alpha, alpha);
|
||||||
if (scopes->samples_ibuf->rect_float) {
|
|
||||||
rf = scopes->samples_ibuf->rect_float;
|
|
||||||
for (y=0; y<scopes->samples_ibuf->y; y++) {
|
|
||||||
for (x=0; x<scopes->samples_ibuf->x; x++) {
|
|
||||||
u=-0.147f*rf[0] - 0.289f*rf[1] + 0.436f*rf[2];
|
|
||||||
v= 0.615f*rf[0] - 0.515f*rf[1] - 0.100f*rf[2];
|
|
||||||
glVertex2f(centerx+u*diam, centery+v*diam);
|
|
||||||
rf+=scopes->samples_ibuf->channels;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(scopes->samples_ibuf->rect) {
|
|
||||||
rc = (unsigned char *)(scopes->samples_ibuf->rect);
|
|
||||||
for (y=0; y<scopes->samples_ibuf->y; y++) {
|
|
||||||
for (x=0; x<scopes->samples_ibuf->x; x++) {
|
|
||||||
u=-0.147f*rc[0]/255.0f - 0.289f*rc[1]/255.0f + 0.436f*rc[2]/255.0f;
|
|
||||||
v= 0.615f*rc[0]/255.0f - 0.515f*rc[1]/255.0f - 0.100f*rc[2]/255.0f;
|
|
||||||
glVertex2f(centerx+u*diam, centery+v*diam);
|
|
||||||
rc+=4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
|
|
||||||
/* restore scissortest */
|
glPushMatrix();
|
||||||
glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
/* height scaling widget */
|
|
||||||
scaler_x1 = rect.xmin + w/2 - SCOPE_RESIZE_PAD;
|
|
||||||
scaler_x2 = rect.xmin + w/2 + SCOPE_RESIZE_PAD;
|
|
||||||
|
|
||||||
glColor4f(0.f, 0.f, 0.f, 0.25f);
|
glTranslatef(centerx, centery, 0.f);
|
||||||
fdrawline(scaler_x1, rect.ymin-4, scaler_x2, rect.ymin-4);
|
glScalef(diam, diam, 0.f);
|
||||||
fdrawline(scaler_x1, rect.ymin-7, scaler_x2, rect.ymin-7);
|
glVertexPointer(2, GL_FLOAT, 0, scopes->vecscope);
|
||||||
glColor4f(1.f, 1.f, 1.f, 0.25f);
|
glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
|
||||||
fdrawline(scaler_x1, rect.ymin-5, scaler_x2, rect.ymin-5);
|
|
||||||
fdrawline(scaler_x1, rect.ymin-8, scaler_x2, rect.ymin-8);
|
|
||||||
|
|
||||||
glColor4f(0.f, 0.f, 0.f, 0.5f);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
uiSetRoundBox(15);
|
glPopMatrix();
|
||||||
gl_round_box(GL_LINE_LOOP, rect.xmin-1, rect.ymin, rect.xmax+1, rect.ymax+1, 3.0f);
|
|
||||||
|
/* outline, scale gripper */
|
||||||
|
draw_scope_end(&rect, scissor);
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
@ -122,14 +122,12 @@ typedef struct Scopes {
|
|||||||
int wavefrm_height;
|
int wavefrm_height;
|
||||||
float vecscope_alpha;
|
float vecscope_alpha;
|
||||||
int vecscope_height;
|
int vecscope_height;
|
||||||
float rgbminmax[3][2];
|
float minmax[3][2];
|
||||||
float yccminmax[3][2];
|
|
||||||
float ycc709minmax[3][2];
|
|
||||||
struct ImBuf *samples_ibuf;
|
|
||||||
struct Histogram hist;
|
struct Histogram hist;
|
||||||
float *waveform_1;
|
float *waveform_1;
|
||||||
float *waveform_2;
|
float *waveform_2;
|
||||||
float *waveform_3;
|
float *waveform_3;
|
||||||
|
float *vecscope;
|
||||||
int waveform_tot;
|
int waveform_tot;
|
||||||
int pad;
|
int pad;
|
||||||
} Scopes;
|
} Scopes;
|
||||||
|
Loading…
Reference in New Issue
Block a user