From: Matthew Fernandez Date: Wed, 19 May 2021 03:17:38 +0000 (-0700) Subject: consistently use float literals in glCompCalcWidget X-Git-Tag: 2.47.3~23^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29d526b2e4d4f62657ac294924ecc41c3ec4a8cb;p=graphviz consistently use float literals in glCompCalcWidget This is more reliable and predictable than the mixture of floats and implicit conversion from ints that was happening previously. --- diff --git a/lib/glcomp/glutils.c b/lib/glcomp/glutils.c index 5c7f15fec..bea79c49a 100644 --- a/lib/glcomp/glutils.c +++ b/lib/glcomp/glutils.c @@ -316,15 +316,15 @@ void glCompCalcWidget(glCompCommon * parent, glCompCommon * child, return; } if (parent->borderType == glBorderNone) - borderWidth = 0; + borderWidth = 0.0f; else borderWidth = parent->borderWidth; if (child->align != glAlignNone) //if alignment, make sure width and height is no greater than parent { if (child->width > parent->width) - ref->width = parent->width - (float) 2.0 *borderWidth; + ref->width = parent->width - 2.0f *borderWidth; if (child->height > parent->height) - ref->height = parent->height - (float) 2.0 *borderWidth;; + ref->height = parent->height - 2.0f *borderWidth;; } @@ -336,13 +336,13 @@ void glCompCalcWidget(glCompCommon * parent, glCompCommon * child, case glAlignLeft: ref->pos.x = parent->refPos.x + borderWidth; ref->pos.y = parent->refPos.y + borderWidth; - ref->height = parent->height - 2 * borderWidth; + ref->height = parent->height - 2.0f * borderWidth; break; case glAlignRight: ref->pos.x = parent->refPos.x + parent->width - child->width - borderWidth; ref->pos.y = parent->refPos.y + borderWidth; - ref->height = parent->height - 2 * borderWidth; + ref->height = parent->height - 2.0f * borderWidth; break; case glAlignTop: @@ -350,19 +350,19 @@ void glCompCalcWidget(glCompCommon * parent, glCompCommon * child, parent->refPos.y + parent->height - child->height - borderWidth; ref->pos.x = parent->refPos.x; - ref->width = parent->width - 2 * borderWidth; + ref->width = parent->width - 2.0f * borderWidth; break; case glAlignBottom: ref->pos.y = parent->refPos.y + borderWidth; ref->pos.x = parent->refPos.x + borderWidth; - ref->width = parent->width - 2 * borderWidth; + ref->width = parent->width - 2.0f * borderWidth; break; case glAlignParent: ref->pos.y = parent->refPos.y + borderWidth; ref->pos.x = parent->refPos.x + borderWidth;; - ref->width = parent->width - 2 * borderWidth;; - ref->height = parent->height - 2 * borderWidth; + ref->width = parent->width - 2.0f * borderWidth;; + ref->height = parent->height - 2.0f * borderWidth; break; case glAlignCenter: case glAlignNone: