diff -r 9af5c039b678 -r 96d65f841791 src/sampler.cc --- a/src/sampler.cc Mon May 05 15:31:14 2008 +0200 +++ b/src/sampler.cc Tue May 06 09:39:58 2008 +0200 @@ -60,7 +60,7 @@ if ( phase == 1 ) { // finalize subsampling - const Float subsample2 = 1.0/(subsample*subsample); + const Float subsample2 = 1.0f / (subsample*subsample); int num_samples = 0; Colour ic; phase = 2; @@ -95,10 +95,10 @@ for (int i = 0; i < subsample; i++) for (int j = 0; j < subsample; j++) { - ic = c1*(subsample-i)*(subsample-j)*subsample2 - + c2*(i)*(subsample-j)*subsample2 - + c3*(subsample-i)*(j)*subsample2 - + c4*(i)*(j)*subsample2; + ic = c1*(Float)((subsample-i)*(subsample-j)*subsample2) + + c2*(Float)((i)*(subsample-j)*subsample2) + + c3*(Float)((subsample-i)*(j)*subsample2) + + c4*(Float)((i)*(j)*subsample2); p = buffer + 3*((y1+j)*w + x1+i); *(p + 0) = ic.r; *(p + 1) = oversample ? -ic.g : ic.g; @@ -130,13 +130,13 @@ } else { - *buf = *buf * (1.0/samples); - *(buf+1) = *(buf+1) * (1.0/samples); - *(buf+2) = *(buf+2) * (1.0/samples); + *buf = *buf * (1.0f/samples); + *(buf+1) = *(buf+1) * (1.0f/samples); + *(buf+2) = *(buf+2) * (1.0f/samples); } else for (buf = buffer; buf != buffer + w*h*3; buf++) - *buf = *buf * (1.0/samples); + *buf = *buf * (1.0f/samples); } phase = -1; return 0; @@ -153,8 +153,8 @@ if (sx < 0) { // first sample - s->x = -(Float)w/h/2.0; - s->y = -0.5; + s->x = -(Float)w/h/2.0f; + s->y = -0.5f; sx = 0; sy = 0; osa_samp = 0; @@ -177,26 +177,26 @@ sx = w-1; } - s->x = (Float)sx/h - (Float)w/h/2.0; - s->y = (Float)sy/h - 0.5; + s->x = (Float)sx/h - (Float)w/h/2.0f; + s->y = (Float)sy/h - 0.5f; } } else if (phase == 2) { /* grid oversampling */ static const int gridsamples[] = {1,4,9,16}; - static const Float osa4x[] = {-0.25, +0.25, +0.25, -0.25}; - static const Float osa4y[] = {-0.25, -0.25, +0.25, +0.25}; - static const Float osa9x[] = {-0.34, 0.00, +0.34, - -0.34, 0.00, +0.34, -0.34, 0.00, +0.34}; - static const Float osa9y[] = {-0.34, -0.34, -0.34, - 0.00, 0.00, 0.00, +0.34, +0.34, +0.34}; - static const Float osa16x[] = {-0.375, -0.125, +0.125, +0.375, - -0.375, -0.125, +0.125, +0.375, -0.375, -0.125, +0.125, +0.375, - -0.375, -0.125, +0.125, +0.375}; - static const Float osa16y[] = {-0.375, -0.375, -0.375, -0.375, - -0.125, -0.125, -0.125, -0.125, +0.125, +0.125, +0.125, +0.125, - +0.375, +0.375, +0.375, +0.375}; + static const Float osa4x[] = {-0.25f, +0.25f, +0.25f, -0.25f}; + static const Float osa4y[] = {-0.25f, -0.25f, +0.25f, +0.25f}; + static const Float osa9x[] = {-0.34f, 0.00f, +0.34f, + -0.34f, 0.00f, +0.34f, -0.34f, 0.00f, +0.34f}; + static const Float osa9y[] = {-0.34f, -0.34f, -0.34f, + 0.00f, 0.00f, 0.00f, +0.34f, +0.34f, +0.34f}; + static const Float osa16x[] = {-0.375f, -0.125f, +0.125f, +0.375f, + -0.375f, -0.125f, +0.125f, +0.375f, -0.375f, -0.125f, +0.125f, +0.375f, + -0.375f, -0.125f, +0.125f, +0.375f}; + static const Float osa16y[] = {-0.375f, -0.375f, -0.375f, -0.375f, + -0.125f, -0.125f, -0.125f, -0.125f, +0.125f, +0.125f, +0.125f, +0.125f, + +0.375f, +0.375f, +0.375f, +0.375f}; static const Float *osaSx[] = {NULL, osa4x, osa9x, osa16x}; static const Float *osaSy[] = {NULL, osa4y, osa9y, osa16y}; const int samples = gridsamples[oversample]; @@ -206,8 +206,8 @@ if (sx < 0) { // first sample - s->x = -(Float)w/h/2.0; - s->y = -0.5; + s->x = -(Float)w/h/2.0f; + s->y = -0.5f; sx = 0; sy = 0; osa_samp = 0; @@ -218,8 +218,8 @@ if (oversample && oversample <= 3 && osa_samp < samples) { - s->x = osax[osa_samp]/h + (Float)sx/h - (Float)w/h/2.0; - s->y = osay[osa_samp]/h + (Float)sy/h - 0.5; + s->x = osax[osa_samp]/h + (Float)sx/h - (Float)w/h/2.0f; + s->y = osay[osa_samp]/h + (Float)sy/h - 0.5f; } else { @@ -279,8 +279,8 @@ return false; } - s->x = (Float)sx/h - (Float)w/h/2.0; - s->y = (Float)sy/h - 0.5; + s->x = (Float)sx/h - (Float)w/h/2.0f; + s->y = (Float)sy/h - 0.5f; osa_samp = 0; } }