Fix T53178: Casting in Blur node with Relative

In this case the user expects rounding.
This commit is contained in:
Germano Cavalcante 2020-01-16 23:32:45 -03:00
parent 6257cdc376
commit 9b3c9ab61a
Notes: blender-bot 2023-02-14 06:26:35 +01:00
Referenced by issue #53178, Blur node
1 changed files with 10 additions and 8 deletions

View File

@ -44,20 +44,22 @@ void BlurBaseOperation::initExecution()
this->m_data.image_in_width = this->getWidth();
this->m_data.image_in_height = this->getHeight();
if (this->m_data.relative) {
int sizex, sizey;
switch (this->m_data.aspect) {
case CMP_NODE_BLUR_ASPECT_NONE:
this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width);
this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height);
break;
case CMP_NODE_BLUR_ASPECT_Y:
this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_width);
this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_width);
sizex = sizey = this->m_data.image_in_width;
break;
case CMP_NODE_BLUR_ASPECT_X:
this->m_data.sizex = (int)(this->m_data.percentx * 0.01f * this->m_data.image_in_height);
this->m_data.sizey = (int)(this->m_data.percenty * 0.01f * this->m_data.image_in_height);
sizex = sizey = this->m_data.image_in_height;
break;
default:
BLI_assert(this->m_data.aspect == CMP_NODE_BLUR_ASPECT_NONE);
sizex = this->m_data.image_in_width;
sizey = this->m_data.image_in_height;
break;
}
this->m_data.sizex = round_fl_to_int(this->m_data.percentx * 0.01f * sizex);
this->m_data.sizey = round_fl_to_int(this->m_data.percenty * 0.01f * sizey);
}
QualityStepHelper::initExecution(COM_QH_MULTIPLY);