own recent commits caused crash with the grease pencil in camera view, always pass rv3d argument now.

also found a bug where hex_to_rgb could use un-initialized memory.
This commit is contained in:
Campbell Barton
2011-05-26 23:29:40 +00:00
parent f1d3982bf6
commit 72499b070a
4 changed files with 6 additions and 5 deletions

View File

@@ -194,6 +194,10 @@ void hex_to_rgb(char *hexcol, float *r, float *g, float *b)
CLAMP(*g, 0.0f, 1.0f);
CLAMP(*b, 0.0f, 1.0f);
}
else {
/* avoid using un-initialized vars */
*r= *g= *b= 0.0f;
}
}
void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)

View File

@@ -453,7 +453,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
ED_view3d_calc_camera_border(scene, ar, v3d, NULL, subrect, -1); /* negative shift */
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, -1); /* negative shift */
return 1;
}
}

View File

@@ -1131,7 +1131,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
ED_view3d_calc_camera_border(p->scene, p->ar, v3d, NULL, &p->subrect_data, -1); /* negative shift */
ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, -1); /* negative shift */
p->subrect= &p->subrect_data;
}
}

View File

@@ -876,9 +876,6 @@ void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, Region
float dx= 0.0f, dy= 0.0f;
view3d_viewborder_size_get(scene, ar, size);
if (rv3d == NULL)
rv3d = ar->regiondata;
size[0]= size[0]*zoomfac;
size[1]= size[1]*zoomfac;