imbuf, mathutils & readfile: floats were being implicitly promoted to doubles, adjust...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 27 Mar 2011 17:12:59 +0000 (17:12 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 27 Mar 2011 17:12:59 +0000 (17:12 +0000)
source/blender/blenloader/intern/readfile.c
source/blender/imbuf/intern/divers.c
source/blender/imbuf/intern/imageprocess.c
source/blender/imbuf/intern/rectop.c
source/blender/imbuf/intern/scaling.c
source/blender/imbuf/intern/tiff.c
source/blender/python/generic/mathutils.c
source/blender/python/generic/mathutils_Matrix.c
source/blender/python/generic/mathutils_Quaternion.c
source/blender/python/generic/mathutils_Vector.c
source/blender/python/generic/mathutils_geometry.c

index b6c0688ee5aed82a8834e435734cf7d98a7bbe96..e3b736bb7e80ffb635bfe1d1ef4966bd2b65066a 100644 (file)
@@ -2871,7 +2871,7 @@ static void direct_link_curve(FileData *fd, Curve *cu)
                        cu->tb = tb;
                        cu->tb[0].w = cu->linewidth;
                }               
-               if (cu->wordspace == 0.0) cu->wordspace = 1.0;
+               if (cu->wordspace == 0.0f) cu->wordspace = 1.0f;
        }
 
        cu->bev.first=cu->bev.last= NULL;
@@ -6951,9 +6951,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        if(main->versionfile <= 113) {
                Material *ma = main->mat.first;
                while(ma) {
-                       if(ma->flaresize==0.0) ma->flaresize= 1.0;
-                       ma->subsize= 1.0;
-                       ma->flareboost= 1.0;
+                       if(ma->flaresize==0.0f) ma->flaresize= 1.0f;
+                       ma->subsize= 1.0f;
+                       ma->flareboost= 1.0f;
                        ma= ma->id.next;
                }
        }
@@ -6961,13 +6961,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        if(main->versionfile <= 134) {
                Tex *tex = main->tex.first;
                while (tex) {
-                       if ((tex->rfac == 0.0) &&
-                               (tex->gfac == 0.0) &&
-                               (tex->bfac == 0.0)) {
-                               tex->rfac = 1.0;
-                               tex->gfac = 1.0;
-                               tex->bfac = 1.0;
-                               tex->filtersize = 1.0;
+                       if ((tex->rfac == 0.0f) &&
+                               (tex->gfac == 0.0f) &&
+                               (tex->bfac == 0.0f)) {
+                               tex->rfac = 1.0f;
+                               tex->gfac = 1.0f;
+                               tex->bfac = 1.0f;
+                               tex->filtersize = 1.0f;
                        }
                        tex = tex->id.next;
                }
@@ -6976,13 +6976,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                /* r-g-b-fac in texture */
                Tex *tex = main->tex.first;
                while (tex) {
-                       if ((tex->rfac == 0.0) &&
-                               (tex->gfac == 0.0) &&
-                               (tex->bfac == 0.0)) {
-                               tex->rfac = 1.0;
-                               tex->gfac = 1.0;
-                               tex->bfac = 1.0;
-                               tex->filtersize = 1.0;
+                       if ((tex->rfac == 0.0f) &&
+                               (tex->gfac == 0.0f) &&
+                               (tex->bfac == 0.0f)) {
+                               tex->rfac = 1.0f;
+                               tex->gfac = 1.0f;
+                               tex->bfac = 1.0f;
+                               tex->filtersize = 1.0f;
                        }
                        tex = tex->id.next;
                }
@@ -6990,7 +6990,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        if(main->versionfile <= 153) {
                Scene *sce = main->scene.first;
                while(sce) {
-                       if(sce->r.blurfac==0.0) sce->r.blurfac= 1.0;
+                       if(sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f;
                        sce= sce->id.next;
                }
        }
@@ -7111,8 +7111,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                TFace *tface= me->tface;
                                for(a=0; a<me->totface; a++, tface++) {
                                        for(b=0; b<4; b++) {
-                                               tface->uv[b][0]/= 32767.0;
-                                               tface->uv[b][1]/= 32767.0;
+                                               tface->uv[b][0]/= 32767.0f;
+                                               tface->uv[b][1]/= 32767.0f;
                                        }
                                }
                        }
@@ -7249,13 +7249,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                if(act->type==ACT_OBJECT) {
                                        oa= act->data;
 
-                                       oa->forceloc[0]*= 25.0;
-                                       oa->forceloc[1]*= 25.0;
-                                       oa->forceloc[2]*= 25.0;
+                                       oa->forceloc[0]*= 25.0f;
+                                       oa->forceloc[1]*= 25.0f;
+                                       oa->forceloc[2]*= 25.0f;
 
-                                       oa->forcerot[0]*= 10.0;
-                                       oa->forcerot[1]*= 10.0;
-                                       oa->forcerot[2]*= 10.0;
+                                       oa->forcerot[0]*= 10.0f;
+                                       oa->forcerot[1]*= 10.0f;
+                                       oa->forcerot[2]*= 10.0f;
                                }
                                act= act->next;
                        }
@@ -7264,8 +7264,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
                sound = main->sound.first;
                while (sound) {
-                       if (sound->volume < 0.01) {
-                               sound->volume = 1.0;
+                       if (sound->volume < 0.01f) {
+                               sound->volume = 1.0f;
                        }
                        sound = sound->id.next;
                }
@@ -7361,18 +7361,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                if (act->type==ACT_OBJECT) {
                                        /* multiply velocity with 50 in old files */
                                        oa= act->data;
-                                       if (fabs(oa->linearvelocity[0]) >= 0.01f)
-                                               oa->linearvelocity[0] *= 50.0;
-                                       if (fabs(oa->linearvelocity[1]) >= 0.01f)
-                                               oa->linearvelocity[1] *= 50.0;
-                                       if (fabs(oa->linearvelocity[2]) >= 0.01f)
-                                               oa->linearvelocity[2] *= 50.0;
-                                       if (fabs(oa->angularvelocity[0])>=0.01f)
-                                               oa->angularvelocity[0] *= 50.0;
-                                       if (fabs(oa->angularvelocity[1])>=0.01f)
-                                               oa->angularvelocity[1] *= 50.0;
-                                       if (fabs(oa->angularvelocity[2])>=0.01f)
-                                               oa->angularvelocity[2] *= 50.0;
+                                       if (fabsf(oa->linearvelocity[0]) >= 0.01f)
+                                               oa->linearvelocity[0] *= 50.0f;
+                                       if (fabsf(oa->linearvelocity[1]) >= 0.01f)
+                                               oa->linearvelocity[1] *= 50.0f;
+                                       if (fabsf(oa->linearvelocity[2]) >= 0.01f)
+                                               oa->linearvelocity[2] *= 50.0f;
+                                       if (fabsf(oa->angularvelocity[0])>=0.01f)
+                                               oa->angularvelocity[0] *= 50.0f;
+                                       if (fabsf(oa->angularvelocity[1])>=0.01f)
+                                               oa->angularvelocity[1] *= 50.0f;
+                                       if (fabsf(oa->angularvelocity[2])>=0.01f)
+                                               oa->angularvelocity[2] *= 50.0f;
                                }
                                act= act->next;
                        }
@@ -7394,7 +7394,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        sound->min_gain = 0.0;
                        sound->distance = 1.0;
 
-                       if (sound->attenuation > 0.0)
+                       if (sound->attenuation > 0.0f)
                                sound->flags |= SOUND_FLAGS_3D;
                        else
                                sound->flags &= ~SOUND_FLAGS_3D;
@@ -7452,7 +7452,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        ob->formfactor = 0.4f;
                        /* patch form factor , note that inertia equiv radius
                         * of a rotation symmetrical obj */
-                       if (ob->inertia != 1.0) {
+                       if (ob->inertia != 1.0f) {
                                ob->formfactor /= ob->inertia * ob->inertia;
                        }
                        ob = ob->id.next;
@@ -7814,7 +7814,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                SpaceLink *sl;
 
                                for (sl= sa->spacedata.first; sl; sl= sl->next) {
-                                       if(sl->blockscale==0.0) sl->blockscale= 0.7f;
+                                       if(sl->blockscale==0.0f) sl->blockscale= 0.7f;
                                        /* added: 5x better zoom in for action */
                                        if(sl->spacetype==SPACE_ACTION) {
                                                SpaceAction *sac= (SpaceAction *)sl;
@@ -7858,8 +7858,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
                /* introduction of raytrace */
                while(ma) {
-                       if(ma->fresnel_tra_i==0.0) ma->fresnel_tra_i= 1.25;
-                       if(ma->fresnel_mir_i==0.0) ma->fresnel_mir_i= 1.25;
+                       if(ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f;
+                       if(ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f;
 
                        ma->ang= 1.0;
                        ma->ray_depth= 2;
@@ -7871,23 +7871,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
                sce= main->scene.first;
                while(sce) {
-                       if(sce->r.gauss==0.0) sce->r.gauss= 1.0;
+                       if(sce->r.gauss==0.0f) sce->r.gauss= 1.0f;
                        sce= sce->id.next;
                }
                la= main->lamp.first;
                while(la) {
-                       if(la->k==0.0) la->k= 1.0;
+                       if(la->k==0.0f) la->k= 1.0;
                        if(la->ray_samp==0) la->ray_samp= 1;
                        if(la->ray_sampy==0) la->ray_sampy= 1;
                        if(la->ray_sampz==0) la->ray_sampz= 1;
-                       if(la->area_size==0.0) la->area_size= 1.0;
-                       if(la->area_sizey==0.0) la->area_sizey= 1.0;
-                       if(la->area_sizez==0.0) la->area_sizez= 1.0;
+                       if(la->area_size==0.0f) la->area_size= 1.0f;
+                       if(la->area_sizey==0.0f) la->area_sizey= 1.0f;
+                       if(la->area_sizez==0.0f) la->area_sizez= 1.0f;
                        la= la->id.next;
                }
                wrld= main->world.first;
                while(wrld) {
-                       if(wrld->range==0.0) {
+                       if(wrld->range==0.0f) {
                                wrld->range= 1.0f/wrld->exposure;
                        }
                        wrld= wrld->id.next;
@@ -7928,7 +7928,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                tex->flag |= TEX_CHECKER_ODD;
                        }
                        /* copied from kernel texture.c */
-                       if(tex->ns_outscale==0.0) {
+                       if(tex->ns_outscale==0.0f) {
                                /* musgrave */
                                tex->mg_H = 1.0f;
                                tex->mg_lacunarity = 2.0f;
@@ -7946,12 +7946,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
 
                while(wrld) {
-                       if(wrld->aodist==0.0) {
+                       if(wrld->aodist==0.0f) {
                                wrld->aodist= 10.0f;
                                wrld->aobias= 0.05f;
                        }
-                       if(wrld->aosamp==0.0) wrld->aosamp= 5;
-                       if(wrld->aoenergy==0.0) wrld->aoenergy= 1.0;
+                       if(wrld->aosamp==0) wrld->aosamp= 5;
+                       if(wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f;
                        wrld= wrld->id.next;
                }
 
@@ -7963,7 +7963,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        for (sa= sc->areabase.first; sa; sa= sa->next) {
                                SpaceLink *sl;
                                for (sl= sa->spacedata.first; sl; sl= sl->next) {
-                                       if(sl->blockscale==0.0) sl->blockscale= 0.7f;
+                                       if(sl->blockscale==0.0f) sl->blockscale= 0.7f;
 
                                        /* added: 5x better zoom in for nla */
                                        if(sl->spacetype==SPACE_NLA) {
@@ -7986,8 +7986,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                Object *ob= main->object.first;
                
                while(ma) {
-                       if(ma->rampfac_col==0.0) ma->rampfac_col= 1.0;
-                       if(ma->rampfac_spec==0.0) ma->rampfac_spec= 1.0;
+                       if(ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
+                       if(ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0;
                        if(ma->pr_lamp==0) ma->pr_lamp= 3;
                        ma= ma->id.next;
                }
@@ -8048,7 +8048,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                Editing *ed;
                
                while(tex) {
-                       if(tex->nabla==0.0) tex->nabla= 0.025f;
+                       if(tex->nabla==0.0f) tex->nabla= 0.025f;
                        tex= tex->id.next;
                }
                while(sce) {
@@ -8071,7 +8071,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                bScreen *sc;
 
                while(cam) {
-                       if(cam->ortho_scale==0.0) {
+                       if(cam->ortho_scale==0.0f) {
                                cam->ortho_scale= 256.0f/cam->lens;
                                if(cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
                        }
@@ -8099,7 +8099,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
                // init new shader vars
                for (ma= main->mat.first; ma; ma= ma->id.next) {
-                       if(ma->darkness==0.0) {
+                       if(ma->darkness==0.0f) {
                                ma->rms=0.1f;
                                ma->darkness=1.0f;
                        }
@@ -8108,8 +8108,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                /* softbody init new vars */
                for(ob= main->object.first; ob; ob= ob->id.next) {
                        if(ob->soft) {
-                               if(ob->soft->defgoal==0.0) ob->soft->defgoal= 0.7f;
-                               if(ob->soft->physics_speed==0.0) ob->soft->physics_speed= 1.0f;
+                               if(ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f;
+                               if(ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f;
                                
                                if(ob->soft->interval==0) {
                                        ob->soft->interval= 2;
@@ -8221,7 +8221,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
 
                for (lt=main->latt.first; lt; lt=lt->id.next) {
-                       if (lt->fu==0.0 && lt->fv==0.0 && lt->fw==0.0) {
+                       if (lt->fu==0.0f && lt->fv==0.0f && lt->fw==0.0f) {
                                calc_lat_fudu(lt->flag, lt->pntsu, &lt->fu, &lt->du);
                                calc_lat_fudu(lt->flag, lt->pntsv, &lt->fv, &lt->dv);
                                calc_lat_fudu(lt->flag, lt->pntsw, &lt->fw, &lt->dw);
@@ -8443,7 +8443,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                ntree_version_241(sce->nodetree);
 
                        /* uv calculation options moved to toolsettings */
-                       if (sce->toolsettings->uvcalc_radius == 0.0) {
+                       if (sce->toolsettings->uvcalc_radius == 0.0f) {
                                sce->toolsettings->uvcalc_radius = 1.0f;
                                sce->toolsettings->uvcalc_cubesize = 1.0f;
                                sce->toolsettings->uvcalc_mapdir = 1;
@@ -8499,7 +8499,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                }
                        }
                        /* transmissivity defaults */
-                       if(ma->tx_falloff==0.0) ma->tx_falloff= 1.0;
+                       if(ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f;
                }
                
                /* during 2.41 images with this name were used for viewer node output, lets fix that */
@@ -9720,7 +9720,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                Lamp *la;
 
                for(la=main->lamp.first; la; la= la->id.next) {
-                       if(la->atm_turbidity == 0.0) {
+                       if(la->atm_turbidity == 0.0f) {
                                la->sun_effect_type = 0;
                                la->horizon_brightness = 1.0f;
                                la->spread = 1.0f;
@@ -10192,7 +10192,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
                for(sce = main->scene.first; sce; sce = sce->id.next) {
                        ts= sce->toolsettings;
-                       if(ts->normalsize == 0.0 || !ts->uv_selectmode || ts->vgroup_weight == 0.0) {
+                       if(ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
                                ts->normalsize= 0.1f;
                                ts->selectmode= SCE_SELECT_VERTEX;
                                
@@ -11449,7 +11449,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        KeyBlock *kb;
                        
                        for (kb = key->block.first; kb; kb = kb->next) {
-                               if (IS_EQ(kb->slidermin, kb->slidermax) && IS_EQ(kb->slidermax, 0))
+                               if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQ(kb->slidermax, 0))
                                        kb->slidermax = kb->slidermin + 1.0f;
                        }
                }
index ff98ac6016627e6824e14ba8c86b101213ce3de9..6b35d7df397fa31caa696bf0007976fc6ce1d82c 100644 (file)
@@ -109,7 +109,7 @@ void IMB_rect_from_float(struct ImBuf *ibuf)
        /* quick method to convert floatbuf to byte */
        float *tof = (float *)ibuf->rect_float;
 //     int do_dither = ibuf->dither != 0.f;
-       float dither= ibuf->dither / 255.0;
+       float dither= ibuf->dither / 255.0f;
        float srgb[4];
        int i, channels= ibuf->channels;
        short profile= ibuf->profile;
@@ -141,7 +141,7 @@ void IMB_rect_from_float(struct ImBuf *ibuf)
                else if (channels == 4) {
                        if (dither != 0.f) {
                                for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof+=4) {
-                                       const float d = (BLI_frand()-0.5)*dither;
+                                       const float d = (BLI_frand()-0.5f)*dither;
                                        
                                        srgb[0]= d + linearrgb_to_srgb(tof[0]);
                                        srgb[1]= d + linearrgb_to_srgb(tof[1]);
@@ -170,7 +170,7 @@ void IMB_rect_from_float(struct ImBuf *ibuf)
                else {
                        if (dither != 0.f) {
                                for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof+=4) {
-                                       const float d = (BLI_frand()-0.5)*dither;
+                                       const float d = (BLI_frand()-0.5f)*dither;
                                        float col[4];
 
                                        col[0]= d + tof[0];
index ef787e8b7992a881f7fa8bcd9ad984b741e88a1c..fa5e951067d12ba8c3e20fab542aefc33ac80a76 100644 (file)
@@ -274,8 +274,8 @@ void bilinear_interpolation_color(struct ImBuf *in, unsigned char *outI, float *
                if (x2>in->x-1 || y2>in->y-1) row4= empty;
                else row4= (float *)in->rect_float + in->x * y2 * 4 + 4*x2;
                
-               a= u-floor(u);
-               b= v-floor(v);
+               a= u-floorf(u);
+               b= v-floorf(v);
                a_b= a*b; ma_b= (1.0f-a)*b; a_mb= a*(1.0f-b); ma_mb= (1.0f-a)*(1.0f-b);
                
                outF[0]= ma_mb*row1[0] + a_mb*row3[0] + ma_b*row2[0]+ a_b*row4[0];
@@ -297,8 +297,8 @@ void bilinear_interpolation_color(struct ImBuf *in, unsigned char *outI, float *
                if (x2>in->x-1 || y2>in->y-1) row4I= emptyI;
                else row4I= (unsigned char *)in->rect + in->x * y2 * 4 + 4*x2;
                
-               a= u-floor(u);
-               b= v-floor(v);
+               a= u-floorf(u);
+               b= v-floorf(v);
                a_b= a*b; ma_b= (1.0f-a)*b; a_mb= a*(1.0f-b); ma_mb= (1.0f-a)*(1.0f-b);
                
                /* need to add 0.5 to avoid rounding down (causes darken with the smear brush)
@@ -348,8 +348,8 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *outI, fl
                row3= (float *)in->rect_float + in->x * y1 * 4 + 4*x2;
                row4= (float *)in->rect_float + in->x * y2 * 4 + 4*x2;
                
-               a= u-floor(u);
-               b= v-floor(v);
+               a= u-floorf(u);
+               b= v-floorf(v);
                a_b= a*b; ma_b= (1.0f-a)*b; a_mb= a*(1.0f-b); ma_mb= (1.0f-a)*(1.0f-b);
                
                outF[0]= ma_mb*row1[0] + a_mb*row3[0] + ma_b*row2[0]+ a_b*row4[0];
@@ -364,8 +364,8 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *outI, fl
                row3I= (unsigned char *)in->rect + in->x * y1 * 4 + 4*x2;
                row4I= (unsigned char *)in->rect + in->x * y2 * 4 + 4*x2;
                
-               a= u-floor(u);
-               b= v-floor(v);
+               a= u-floorf(u);
+               b= v-floorf(v);
                a_b= a*b; ma_b= (1.0f-a)*b; a_mb= a*(1.0f-b); ma_mb= (1.0f-a)*(1.0f-b);
                
                /* need to add 0.5 to avoid rounding down (causes darken with the smear brush)
index a6556cc3a9a1e24b1cd1fa80ac0585fa102de10c..44af7ffdb3fa9c356d57fcd4a96b09ed7068907d 100644 (file)
@@ -164,7 +164,7 @@ unsigned int IMB_blend_color(unsigned int src1, unsigned int src2, int fac, IMB_
 
 static void blend_color_mix_float(float *cp, float *cp1, float *cp2, float fac)
 {
-       float mfac= 1.0-fac;
+       float mfac= 1.0f-fac;
        cp[0]= mfac*cp1[0] + fac*cp2[0];
        cp[1]= mfac*cp1[1] + fac*cp2[1];
        cp[2]= mfac*cp1[2] + fac*cp2[2];
@@ -194,7 +194,7 @@ static void blend_color_sub_float(float *cp, float *cp1, float *cp2, float fac)
 
 static void blend_color_mul_float(float *cp, float *cp1, float *cp2, float fac)
 {
-       float mfac= 1.0-fac;
+       float mfac= 1.0f-fac;
        
        cp[0]= mfac*cp1[0] + fac*(cp1[0]*cp2[0]);
        cp[1]= mfac*cp1[1] + fac*(cp1[1]*cp2[1]);
@@ -488,7 +488,7 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
        float a; /* alpha */
        float ai; /* alpha inverted */
        float aich; /* alpha, inverted, ai/255.0 - Convert char to float at the same time */
-       if ((!rect && !rectf) || (!col) || col[3]==0.0)
+       if ((!rect && !rectf) || (!col) || col[3]==0.0f)
                return;
        
        /* sanity checks for coords */
@@ -510,7 +510,7 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
                unsigned char chr=0, chg=0, chb=0;
                float fr=0, fg=0, fb=0;
                
-               if (a == 1.0) {
+               if (a == 1.0f) {
                        chr = FTOCHAR(col[0]);
                        chg = FTOCHAR(col[1]);
                        chb = FTOCHAR(col[2]);
@@ -523,7 +523,7 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
                        for (i = 0; i < x2-x1; i++) {
                                pixel = rect + 4 * (((y1 + j) * width) + (x1 + i));
                                if (pixel >= rect && pixel < rect+ (4 * (width * height))) {
-                                       if (a == 1.0) {
+                                       if (a == 1.0f) {
                                                pixel[0] = chr;
                                                pixel[1] = chg;
                                                pixel[2] = chb;
@@ -542,7 +542,7 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
                for (j = 0; j < y2-y1; j++) {
                        for (i = 0; i < x2-x1; i++) {
                                pixel = rectf + 4 * (((y1 + j) * width) + (x1 + i));
-                               if (a == 1.0) {
+                               if (a == 1.0f) {
                                        pixel[0] = col[0];
                                        pixel[1] = col[1];
                                        pixel[2] = col[2];
index 541f4586afb4d6740be61cd877829a9dd79d1a20..9d6748ec1fb46e73f63e03bd23237e57ba328c3c 100644 (file)
@@ -594,8 +594,8 @@ static void enlarge_picture_float(
        for (y_dst = 0; y_dst < dst_height; y_dst++) {
                float* line1 = src + ((int) y_src) * 4 * src_width;
                float* line2 = line1 + 4 * src_width;
-               float weight1y = 1.0 - (y_src - (int) y_src);
-               float weight2y = 1.0 - weight1y;
+               const float weight1y = (float)(1.0 - (y_src - (int) y_src));
+               const float weight2y = 1.0f - weight1y;
 
                if ((int) y_src == src_height - 1) {
                        line2 = line1;
@@ -603,13 +603,13 @@ static void enlarge_picture_float(
                       
                x_src = 0;
                for (x_dst = 0; x_dst < dst_width; x_dst++) {
-                       float weight1x = 1.0 - (x_src - (int) x_src);
-                       float weight2x = 1.0 - weight1x;
+                       const float weight1x = (float)(1.0 - (x_src - (int) x_src));
+                       const float weight2x = (float)(1.0f - weight1x);
 
-                       float w11 = weight1y * weight1x;
-                       float w21 = weight2y * weight1x;
-                       float w12 = weight1y * weight2x;
-                       float w22 = weight2y * weight2x;
+                       const float w11 = weight1y * weight1x;
+                       const float w21 = weight2y * weight1x;
+                       const float w12 = weight1y * weight2x;
+                       const float w22 = weight2y * weight2x;
 
                        uintptr_t x = ((int) x_src) * 4;
 
@@ -678,12 +678,12 @@ static void shrink_picture_float(
        y_counter = 1.0;
        for (y_src = 0; y_src < src_height; y_src++) {
                float* line = src + y_src * 4 * src_width;
-               uintptr_t weight1y = 1.0 - (y_dst - (int) y_dst);
-               uintptr_t weight2y = 1.0 - weight1y;
+               uintptr_t weight1y = 1.0f - (y_dst - (int) y_dst);
+               uintptr_t weight2y = 1.0f - weight1y;
                x_dst = 0;
                for (x_src = 0; x_src < src_width; x_src++) {
-                       uintptr_t weight1x = 1.0 - (x_dst - (int) x_dst);
-                       uintptr_t weight2x = 1.0 - weight1x;
+                       uintptr_t weight1x = 1.0f - (x_dst - (int) x_dst);
+                       uintptr_t weight2x = 1.0f - weight1x;
 
                        uintptr_t x = (int) x_dst;
 
@@ -731,10 +731,10 @@ static void shrink_picture_float(
                        uintptr_t x;
                        struct scale_outpix_float * temp;
 
-                       y_counter += 1.0;
+                       y_counter += 1.0f;
                        
                        for (x=0; x < dst_width; x++) {
-                               float f = 1.0 / dst_line1[x].weight;
+                               float f = 1.0f / dst_line1[x].weight;
                                *dst++ = dst_line1[x].r * f;
                                *dst++ = dst_line1[x].g * f;
                                *dst++ = dst_line1[x].b * f;
@@ -750,7 +750,7 @@ static void shrink_picture_float(
        if (dst - dst_begin < dst_width * dst_height * 4) {
                uintptr_t x;
                for (x = 0; x < dst_width; x++) {
-                       float f = 1.0 / dst_line1[x].weight;
+                       float f = 1.0f / dst_line1[x].weight;
                        *dst++ = dst_line1[x].r * f;
                        *dst++ = dst_line1[x].g * f;
                        *dst++ = dst_line1[x].b * f;
@@ -1026,8 +1026,8 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
                        
                        sample += add;
 
-                       while (sample >= 1.0) {
-                               sample -= 1.0;
+                       while (sample >= 1.0f) {
+                               sample -= 1.0f;
                                
                                if (do_rect) {
                                        nval[0] += rect[0];
@@ -1069,7 +1069,7 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
                                newrectf += skipx;
                        }
                        
-                       sample -= 1.0;
+                       sample -= 1.0f;
                }
        }       
 
@@ -1142,22 +1142,22 @@ static struct ImBuf *scaleupx(struct ImBuf *ibuf, int newx)
                        val_a = rect[0] ;
                        nval_a = rect[4];
                        diff_a = nval_a - val_a ;
-                       val_a += 0.5;
+                       val_a += 0.5f;
 
                        val_b = rect[1] ;
                        nval_b = rect[5];
                        diff_b = nval_b - val_b ;
-                       val_b += 0.5;
+                       val_b += 0.5f;
 
                        val_g = rect[2] ;
                        nval_g = rect[6];
                        diff_g = nval_g - val_g ;
-                       val_g += 0.5;
+                       val_g += 0.5f;
 
                        val_r = rect[3] ;
                        nval_r = rect[7];
                        diff_r = nval_r - val_r ;
-                       val_r += 0.5;
+                       val_r += 0.5f;
 
                        rect += 8;
                }
@@ -1181,29 +1181,29 @@ static struct ImBuf *scaleupx(struct ImBuf *ibuf, int newx)
                        rectf += 8;
                }
                for (x = newx ; x>0 ; x--){
-                       if (sample >= 1.0){
-                               sample -= 1.0;
+                       if (sample >= 1.0f){
+                               sample -= 1.0f;
 
                                if (do_rect) {
                                        val_a = nval_a ;
                                        nval_a = rect[0] ;
                                        diff_a = nval_a - val_a ;
-                                       val_a += 0.5;
+                                       val_a += 0.5f;
 
                                        val_b = nval_b ;
                                        nval_b = rect[1] ;
                                        diff_b = nval_b - val_b ;
-                                       val_b += 0.5;
+                                       val_b += 0.5f;
 
                                        val_g = nval_g ;
                                        nval_g = rect[2] ;
                                        diff_g = nval_g - val_g ;
-                                       val_g += 0.5;
+                                       val_g += 0.5f;
 
                                        val_r = nval_r ;
                                        nval_r = rect[3] ;
                                        diff_r = nval_r - val_r ;
-                                       val_r += 0.5;
+                                       val_r += 0.5f;
                                        rect += 4;
                                }
                                if (do_float) {
@@ -1312,22 +1312,22 @@ static struct ImBuf *scaleupy(struct ImBuf *ibuf, int newy)
                        val_a = rect[0] ;
                        nval_a = rect[skipx];
                        diff_a = nval_a - val_a ;
-                       val_a += 0.5;
+                       val_a += 0.5f;
 
                        val_b = rect[1] ;
                        nval_b = rect[skipx+1];
                        diff_b = nval_b - val_b ;
-                       val_b += 0.5;
+                       val_b += 0.5f;
 
                        val_g = rect[2] ;
                        nval_g = rect[skipx+2];
                        diff_g = nval_g - val_g ;
-                       val_g += 0.5;
+                       val_g += 0.5f;
 
                        val_r = rect[3] ;
                        nval_r = rect[skipx+4];
                        diff_r = nval_r - val_r ;
-                       val_r += 0.5;
+                       val_r += 0.5f;
 
                        rect += 2*skipx;
                }
@@ -1355,29 +1355,29 @@ static struct ImBuf *scaleupy(struct ImBuf *ibuf, int newy)
                }
                
                for (y = newy ; y>0 ; y--){
-                       if (sample >= 1.0){
-                               sample -= 1.0;
+                       if (sample >= 1.0f){
+                               sample -= 1.0f;
 
                                if (do_rect) {
                                        val_a = nval_a ;
                                        nval_a = rect[0] ;
                                        diff_a = nval_a - val_a ;
-                                       val_a += 0.5;
+                                       val_a += 0.5f;
 
                                        val_b = nval_b ;
                                        nval_b = rect[1] ;
                                        diff_b = nval_b - val_b ;
-                                       val_b += 0.5;
+                                       val_b += 0.5f;
 
                                        val_g = nval_g ;
                                        nval_g = rect[2] ;
                                        diff_g = nval_g - val_g ;
-                                       val_g += 0.5;
+                                       val_g += 0.5f;
 
                                        val_r = nval_r ;
                                        nval_r = rect[3] ;
                                        diff_r = nval_r - val_r ;
-                                       val_r += 0.5;
+                                       val_r += 0.5f;
                                        rect += skipx;
                                }
                                if (do_float) {
index 0c04887e606377d598fe8da0ba9a3cd24d1c5606..155696fb19969360ff0b8c3feb0e11d2be0ae852 100644 (file)
@@ -336,7 +336,7 @@ static void scanline_contig_32bit(float *rectf, float *fbuf, int scanline_w, int
                rectf[i*4 + 0] = fbuf[i*spp + 0];
                rectf[i*4 + 1] = fbuf[i*spp + 1];
                rectf[i*4 + 2] = fbuf[i*spp + 2];
-               rectf[i*4 + 3] = (spp==4)?fbuf[i*spp + 3]:1.0;
+               rectf[i*4 + 3] = (spp==4)?fbuf[i*spp + 3]:1.0f;
        }
 }
 
index 7cb1728f817a686b5b8029a1d7b17f71874e28ea..e94f7f798fc544a031a42418606da6806081a82e 100644 (file)
@@ -66,7 +66,7 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max
        i= size;
        do {
                i--;
-               if(((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0) && PyErr_Occurred()) {
+               if(((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) {
                        PyErr_Format(PyExc_ValueError, "%.200s: sequence index %d expected a number, found '%.200s' type, ", error_prefix, i, Py_TYPE(item)->tp_name);
                        Py_DECREF(value_fast);
                        return -1;
index c048058f63c198e5db76891aafb83d8781d2a700..936c761bf90d5362bf1fcb52411331666de47db8 100644 (file)
@@ -542,7 +542,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
        if(matSize == 2) {
                float const factor= PyFloat_AsDouble(fac);
 
-               if(factor==-1.0 && PyErr_Occurred()) {
+               if(factor==-1.0f && PyErr_Occurred()) {
                        PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix.Shear(): the factor to be a float");
                        return NULL;
                }
@@ -1520,12 +1520,12 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
                }
        }
        else if(mat2) {
-               if (((scalar= PyFloat_AsDouble(m1)) == -1.0 && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX */
+               if (((scalar= PyFloat_AsDouble(m1)) == -1.0f && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX */
                        return matrix_mul_float(mat2, scalar);
                }
        }
        else if(mat1) {
-               if (((scalar= PyFloat_AsDouble(m2)) == -1.0 && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX */
+               if (((scalar= PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred())==0) { /*FLOAT/INT * MATRIX */
                        return matrix_mul_float(mat1, scalar);
                }
        }
index 75d79d5afacd1f712fadfa52f7a67e3f4bc71cb7..43d3cbc62b0722da05613f9fbcf965096240e9aa 100644 (file)
@@ -723,12 +723,12 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
        }
        /* the only case this can happen (for a supported type is "FLOAT*QUAT") */
        else if(quat2) { /* FLOAT*QUAT */
-               if(((scalar= PyFloat_AsDouble(q1)) == -1.0 && PyErr_Occurred())==0) {
+               if(((scalar= PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred())==0) {
                        return quat_mul_float(quat2, scalar);
                }
        }
        else if (quat1) { /* QUAT*FLOAT */
-               if((((scalar= PyFloat_AsDouble(q2)) == -1.0 && PyErr_Occurred())==0)) {
+               if((((scalar= PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred())==0)) {
                        return quat_mul_float(quat1, scalar);
                }
        }
@@ -837,7 +837,7 @@ static PyObject *Quaternion_getAngle(QuaternionObject *self, void *UNUSED(closur
                return NULL;
 
        normalize_qt_qt(tquat, self->quat);
-       return PyFloat_FromDouble(2.0 * (saacos(tquat[0])));
+       return PyFloat_FromDouble(2.0f * (saacos(tquat[0])));
 }
 
 static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
@@ -856,7 +856,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN
 
        angle= PyFloat_AsDouble(value);
 
-       if(angle==-1.0f && PyErr_Occurred()) { /* parsed item not a number */
+       if(angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */
                PyErr_SetString(PyExc_TypeError, "quaternion.angle = value: float expected");
                return -1;
        }
index 0ea380d1ee6b0df7737f6ab6b1d87a73fd61baaa..f1e417b154e6526ba442ab9f49a6bcc61b309d59 100644 (file)
@@ -719,7 +719,7 @@ static PyObject *Vector_lerp(VectorObject *self, PyObject *args)
        if(BaseMath_ReadCallback(self) == -1)
                return NULL;
 
-       ifac= 1.0 - fac;
+       ifac= 1.0f - fac;
 
        for(x = 0; x < size; x++) {
                vec[x] = (ifac * self->vec[x]) + (fac * tvec[x]);
@@ -1111,12 +1111,12 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
                        mul_qt_v3(quat2->quat, tvec);
                        return newVectorObject(tvec, 3, Py_NEW, Py_TYPE(vec1));
                }
-               else if (((scalar= PyFloat_AsDouble(v2)) == -1.0 && PyErr_Occurred())==0) { /* VEC*FLOAT */
+               else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC*FLOAT */
                        return vector_mul_float(vec1, scalar);
                }
        }
        else if (vec2) {
-               if (((scalar= PyFloat_AsDouble(v1)) == -1.0 && PyErr_Occurred())==0) { /* VEC*FLOAT */
+               if (((scalar= PyFloat_AsDouble(v1)) == -1.0f && PyErr_Occurred())==0) { /* VEC*FLOAT */
                        return vector_mul_float(vec2, scalar);
                }
        }
@@ -1163,7 +1163,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
                }
                mul_qt_v3(quat2->quat, vec->vec);
        }
-       else if (((scalar= PyFloat_AsDouble(v2)) == -1.0 && PyErr_Occurred())==0) { /* VEC*=FLOAT */
+       else if (((scalar= PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred())==0) { /* VEC*=FLOAT */
                mul_vn_fl(vec->vec, vec->size, scalar);
        }
        else {
@@ -1197,7 +1197,7 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2)
                return NULL;
        }
 
-       if(scalar==0.0) {
+       if(scalar==0.0f) {
                PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error");
                return NULL;
        }
@@ -1223,7 +1223,7 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2)
                return NULL;
        }
 
-       if(scalar==0.0) {
+       if(scalar==0.0f) {
                PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error");
                return NULL;
        }
index a0991e00d07cfb209786971a2e5ac3d66afab7bf..fc821f2697a24873110fa9e46a5b8e2daadf02cc 100644 (file)
@@ -114,7 +114,7 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
        /* if determinant is near zero, ray lies in plane of triangle */
        det= dot_v3v3(e1, pvec);
 
-       if (det > -0.000001 && det < 0.000001) {
+       if (det > -0.000001f && det < 0.000001f) {
                Py_RETURN_NONE;
        }