fix [#32374] Curve compositor UI drawing glitch
copy the curve for the compositor.
This commit is contained in:
@@ -150,7 +150,7 @@ void curvemapping_set_black_white_ex(const float black[3], const float white[3],
|
||||
int a;
|
||||
|
||||
for (a = 0; a < 3; a++) {
|
||||
const float delta = MAX2(white[a] - black[a], 1e-5f);
|
||||
const float delta = maxf(white[a] - black[a], 1e-5f);
|
||||
r_bwmul[a] = 1.0f / delta;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ TimeNode::TimeNode(bNode *editorNode) : Node(editorNode)
|
||||
/* pass */
|
||||
}
|
||||
|
||||
////curvemapping_initialize(&hcmd->curve_mapping);
|
||||
|
||||
void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
|
||||
{
|
||||
SetValueOperation *operation = new SetValueOperation();
|
||||
|
||||
@@ -98,11 +98,11 @@ void ColorCurveOperation::executePixel(float output[4], float x, float y, PixelS
|
||||
|
||||
void ColorCurveOperation::deinitExecution()
|
||||
{
|
||||
CurveBaseOperation::deinitExecution();
|
||||
this->m_inputFacProgram = NULL;
|
||||
this->m_inputImageProgram = NULL;
|
||||
this->m_inputBlackProgram = NULL;
|
||||
this->m_inputWhiteProgram = NULL;
|
||||
curvemapping_premultiply(this->m_curveMapping, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ void ConstantLevelColorCurveOperation::executePixel(float output[4], float x, fl
|
||||
|
||||
void ConstantLevelColorCurveOperation::deinitExecution()
|
||||
{
|
||||
CurveBaseOperation::deinitExecution();
|
||||
this->m_inputFacProgram = NULL;
|
||||
this->m_inputImageProgram = NULL;
|
||||
curvemapping_premultiply(this->m_curveMapping, 1);
|
||||
}
|
||||
|
||||
@@ -38,3 +38,17 @@ void CurveBaseOperation::initExecution()
|
||||
{
|
||||
curvemapping_initialize(this->m_curveMapping);
|
||||
}
|
||||
void CurveBaseOperation::deinitExecution()
|
||||
{
|
||||
curvemapping_free(this->m_curveMapping);
|
||||
this->m_curveMapping = NULL;
|
||||
}
|
||||
|
||||
void CurveBaseOperation::setCurveMapping(CurveMapping *mapping)
|
||||
{
|
||||
/* duplicate the curve to avoid glitches while drawing, see bug [#32374] */
|
||||
if (this->m_curveMapping) {
|
||||
curvemapping_free(this->m_curveMapping);
|
||||
}
|
||||
this->m_curveMapping = curvemapping_copy(mapping);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ public:
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
void deinitExecution();
|
||||
|
||||
void setCurveMapping(CurveMapping *mapping) { this->m_curveMapping = mapping; }
|
||||
void setCurveMapping(CurveMapping *mapping);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -74,5 +74,6 @@ void HueSaturationValueCorrectOperation::executePixel(float output[4], float x,
|
||||
|
||||
void HueSaturationValueCorrectOperation::deinitExecution()
|
||||
{
|
||||
CurveBaseOperation::deinitExecution();
|
||||
this->m_inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -56,5 +56,6 @@ void VectorCurveOperation::executePixel(float output[4], float x, float y, Pixel
|
||||
|
||||
void VectorCurveOperation::deinitExecution()
|
||||
{
|
||||
CurveBaseOperation::deinitExecution();
|
||||
this->m_inputProgram = NULL;
|
||||
}
|
||||
|
||||
@@ -1355,8 +1355,14 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
|
||||
rcti scissor_new;
|
||||
int a;
|
||||
|
||||
cumap = (CurveMapping *)(but->editcumap ? but->editcumap : but->poin);
|
||||
cuma = cumap->cm + cumap->cur;
|
||||
if (but->editcumap) {
|
||||
cumap = but->editcumap;
|
||||
}
|
||||
else {
|
||||
cumap = (CurveMapping *)but->poin;
|
||||
}
|
||||
|
||||
cuma = &cumap->cm[cumap->cur];
|
||||
|
||||
/* need scissor test, curve can draw outside of boundary */
|
||||
glGetIntegerv(GL_VIEWPORT, scissor);
|
||||
@@ -1485,8 +1491,9 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
|
||||
cmp = cuma->table;
|
||||
|
||||
/* first point */
|
||||
if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0)
|
||||
if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
|
||||
glVertex2f(rect->xmin, rect->ymin + zoomy * (cmp[0].y - offsy));
|
||||
}
|
||||
else {
|
||||
fx = rect->xmin + zoomx * (cmp[0].x - offsx + cuma->ext_in[0]);
|
||||
fy = rect->ymin + zoomy * (cmp[0].y - offsy + cuma->ext_in[1]);
|
||||
@@ -1498,8 +1505,9 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
|
||||
glVertex2f(fx, fy);
|
||||
}
|
||||
/* last point */
|
||||
if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0)
|
||||
if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
|
||||
glVertex2f(rect->xmax, rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy));
|
||||
}
|
||||
else {
|
||||
fx = rect->xmin + zoomx * (cmp[CM_TABLE].x - offsx - cuma->ext_out[0]);
|
||||
fy = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy - cuma->ext_out[1]);
|
||||
|
||||
Reference in New Issue
Block a user