From 850d73414716351421245102f4d2255691987b8a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 20 Jun 2012 18:46:18 +0000 Subject: [PATCH] make mask handles draw with an outline - when outline option is enabled. --- .../operations/COM_CalculateMeanOperation.cpp | 2 +- source/blender/editors/mask/mask_draw.c | 21 +++++++++++++++---- .../editors/space_view3d/view3d_draw.c | 5 +++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp index 3f9003b8c48..8ef7605c21a 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp @@ -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++; diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 71d3caf74c5..83337a18223 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -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; } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 709a73178aa..709de274b8b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -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;