Remove the at least questionable b_sqrt() function and replace it with the
normal sqrt(). The stated goal of the function was to avoid a dependency to the math library, which in our case does not apply anyway. This removes one case of broken strict aliasing rules... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25034 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -97,35 +97,11 @@ static uint32 visible_mask_bottom[6] = {
|
||||
};
|
||||
|
||||
/* Private functions used only internally. */
|
||||
float b_sqrt(float x);
|
||||
bool ProjectStar(star *s, geometry *geo);
|
||||
bool CheckClipping(star *s, buffer *buf, bool reset_clipping);
|
||||
void DrawStar(star *s, buffer *buf);
|
||||
void EraseStar(star *s, buffer *buf);
|
||||
|
||||
/* Good approximation of square root, for x > 0.0 That resolves
|
||||
the problem of having a dependency with the math library, and
|
||||
it's good enough for what we need. */
|
||||
float b_sqrt(float x) {
|
||||
uint32 val;
|
||||
float y,z,t;
|
||||
float flottant, tampon;
|
||||
|
||||
flottant = x;
|
||||
val = *((uint32*)&flottant);
|
||||
val >>= 1;
|
||||
val += 0x1FC00000L;
|
||||
*((uint32*)&tampon) = val;
|
||||
y = tampon;
|
||||
z = y*y+x;
|
||||
t = y*y-x;
|
||||
y *= (float)4.0;
|
||||
x = z*z;
|
||||
t = t*t;
|
||||
y = z*y;
|
||||
t = (float)2.0*x-t;
|
||||
return t/y;
|
||||
}
|
||||
|
||||
/* This function initialise the 32 sizes of anti-aliased star, each one
|
||||
represented in 4 different half-pixel alignement :
|
||||
@@ -159,7 +135,7 @@ void InitPatterns()
|
||||
x = ((float)pattern_dh[k] + ROUNDING) - x0;
|
||||
y = ((float)pattern_dv[k] + ROUNDING) - y0;
|
||||
|
||||
dist = b_sqrt(x*x + y*y);
|
||||
dist = sqrt(x*x + y*y);
|
||||
/* process non source pixel */
|
||||
if (dist > 0.5) {
|
||||
delta = radius - dist + 0.5;
|
||||
|
||||
Reference in New Issue
Block a user