correct my bullshit on bitmaps :E

This commit is contained in:
milang 2019-08-29 14:35:36 +02:00
parent bcbab0342a
commit eb69825bd3
No known key found for this signature in database
GPG Key ID: D287C9D6C33D9035
4 changed files with 9 additions and 14 deletions

Binary file not shown.

Binary file not shown.

View File

@ -6,11 +6,11 @@ inline uint8_t bitmap_get_pixel_r(const bitmap_rich * bmp, uint32_t x, uint32_t
if (x >= bmp->size_px_x || y >= bmp->size_px_y)
return 0;
const uint32_t indice = y * bmp->size_o_y + x >> 5;
const uint32_t indice = y * bmp->size_o_y + (x >> 5);
const uint32_t numero_bit = 31 - x % 32;
return ( bmp->layout[indice] | 1 << numero_bit ) << 1 + ( bmp->color[indice] | 1 << numero_bit );
return (( bmp->layout[indice] | 1 << numero_bit ) << 1) + ( bmp->color[indice] | 1 << numero_bit );
}

View File

@ -8,7 +8,7 @@ const double pi2 = pi * 2;
const double pi_sur_2 = pi / 2;
static double reducted_cos(const double a)
inline double reducted_cos(const double a)
{
double u= 1.0;
const double a2 = a * a;
@ -27,19 +27,14 @@ double modulo_2pi(double a)
return a;
}
static double cos_recursive(double angle)
{
if (angle<0)
return cos_recursive(-angle);
if (angle>=pi_sur_2)
return -reducted_cos(angle - pi);
return reducted_cos(angle); // OK
}
double cos(double angle)
{
angle = modulo_2pi(angle);
return cos_recursive(angle);
if (angle<0)
angle=-angle;
if (angle>=pi_sur_2)
return -reducted_cos(angle - pi);
return reducted_cos(angle);
}
double sin(double angle)
@ -120,4 +115,4 @@ void render_set(const double dh, const double dv, const double roulis, const FE_
// assigner delta
memcpy(&delta, camera, sizeof(FE_integer_position));
}
}