1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-06 08:15:56 +01:00

Fixed floating point constants defined as double but expected as float

To preserve the accuracy of the operation, the C standard request that the
mathematical operation is performed using double precision, but in many
case this is not necessary so this patch fixes a few constants to avoid
that conversion.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-05-24 15:49:06 +02:00
committed by Carlos R. Mafra
parent 1df08cc492
commit 79a95d7173
8 changed files with 31 additions and 31 deletions

View File

@@ -47,7 +47,7 @@ void RCombineAlpha(unsigned char *d, unsigned char *s, int s_has_alpha,
cratio = 0;
} else {
ratio = (float)sa / alpha;
cratio = 1.0 - ratio;
cratio = 1.0F - ratio;
}
*d = (int)*d * cratio + (int)*s * ratio;

View File

@@ -438,7 +438,7 @@ static void gatherconfig(RContext * context, int screen_n)
ptr = mygetenv("WRASTER_GAMMA", screen_n);
if (ptr) {
float g1, g2, g3;
if (sscanf(ptr, "%f/%f/%f", &g1, &g2, &g3) != 3 || g1 <= 0.0 || g2 <= 0.0 || g3 <= 0.0) {
if (sscanf(ptr, "%f/%f/%f", &g1, &g2, &g3) != 3 || g1 <= 0.0F || g2 <= 0.0F || g3 <= 0.0F) {
printf("wrlib: invalid value(s) for gamma correction \"%s\"\n", ptr);
} else {
context->attribs->flags |= RC_GammaCorrection;

View File

@@ -48,26 +48,26 @@ RImage *RRotateImage(RImage *image, float angle)
* candidate for an Epsilon when trying to compare angle
* to known values
*/
static const float min_usable_angle = 0.00699;
static const float min_usable_angle = 0.00699F;
angle = fmod(angle, 360.0);
if (angle < 0.0)
angle += 360.0;
if (angle < 0.0F)
angle += 360.0F;
if (angle < min_usable_angle) {
/* Rotate by 0 degree */
return RCloneImage(image);
} else if ((angle > 90.0 - min_usable_angle) &&
(angle < 90.0 + min_usable_angle)) {
} else if ((angle > 90.0F - min_usable_angle) &&
(angle < 90.0F + min_usable_angle)) {
return rotate_image_90(image);
} else if ((angle > 180.0 - min_usable_angle) &&
(angle < 180.0 + min_usable_angle)) {
} else if ((angle > 180.0F - min_usable_angle) &&
(angle < 180.0F + min_usable_angle)) {
return wraster_rotate_image_180(image);
} else if ((angle > 270.0 - min_usable_angle) &&
(angle < 270.0 + min_usable_angle)) {
} else if ((angle > 270.0F - min_usable_angle) &&
(angle < 270.0F + min_usable_angle)) {
return rotate_image_270(image);
} else {
@@ -341,8 +341,8 @@ static RImage *rotate_image_any(RImage *source, float angle)
int dpr, dpru, p;
/* only 180o for now */
if (angle > 180.0)
angle -= 180.0;
if (angle > 180.0F)
angle -= 180.0F;
angle = (angle * WM_PI) / 180.0;