make mask handles draw with an outline - when outline option is enabled.

This commit is contained in:
Campbell Barton 2012-06-20 18:46:18 +00:00
parent dc7770d1a1
commit 850d734147
3 changed files with 23 additions and 5 deletions

@ -88,7 +88,7 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile)
float *buffer = tile->getBuffer();
int size = tile->getWidth() * tile->getHeight();
int pixels = 0;
float sum;
float sum = 0.0f;
for (int i = 0, offset = 0; i < size; i++, offset += 4) {
if (buffer[offset + 3] > 0) {
pixels++;

@ -116,7 +116,8 @@ static void draw_spline_parents(MaskLayer *UNUSED(masklay), MaskSpline *spline)
#endif
/* return non-zero if spline is selected */
static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline)
static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline,
const char UNUSED(draw_flag), const char draw_type)
{
const int is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0;
unsigned char rgb_spline[4];
@ -188,8 +189,20 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline)
/* draw handle segment */
if (has_handle) {
glColor3ubv(rgb_spline);
/* this could be split into its own loop */
if (draw_type == MASK_DT_OUTLINE) {
const unsigned char rgb_grey[4] = {0x60, 0x60, 0x60, 0xff};
glLineWidth(3);
glColor4ubv(rgb_grey);
glBegin(GL_LINES);
glVertex3fv(vert);
glVertex3fv(handle);
glEnd();
glLineWidth(1);
}
glColor3ubv(rgb_spline);
glBegin(GL_LINES);
glVertex3fv(vert);
glVertex3fv(handle);
@ -415,7 +428,7 @@ static void draw_masklays(Mask *mask, const char draw_flag, const char draw_type
if (!(masklay->restrictflag & MASK_RESTRICT_SELECT)) {
/* ...and then handles over the curve so they're nicely visible */
draw_spline_points(masklay, spline);
draw_spline_points(masklay, spline, draw_flag, draw_type);
}
/* show undeform for testing */
@ -425,7 +438,7 @@ static void draw_masklays(Mask *mask, const char draw_flag, const char draw_type
spline->points_deform = NULL;
draw_spline_curve(masklay, spline, draw_flag, draw_type, is_active, width, height);
// draw_spline_parents(masklay, spline);
draw_spline_points(masklay, spline);
draw_spline_points(masklay, spline, draw_flag, draw_type);
spline->points_deform = back;
}
}

@ -1589,6 +1589,11 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
* be dereferenced after usage. */
freeibuf = ibuf;
}
else {
/* perhaps when loading future files... */
BLI_assert(0);
copy_v2_fl(image_aspect, 1.0f);
}
if (ibuf == NULL)
continue;