X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_atom_viewport.c;h=d10f1840df6ac3db0210a04d7fc07a2ee8f3c627;hb=69a07be3e527dbc2148a4e20c50e60266225f5f2;hp=4b51521470bf962a2b2b479a83ea72bb3796df5f;hpb=c3a8a41faabed4c9b84a6fbaf7a86a089b8fcbba;p=mesa.git diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index 4b51521470b..d10f1840df6 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -26,8 +26,7 @@ **************************************************************************/ -#include "context.h" -#include "colormac.h" +#include "main/context.h" #include "st_context.h" #include "st_atom.h" #include "pipe/p_context.h" @@ -42,14 +41,14 @@ static void update_viewport( struct st_context *st ) { - GLcontext *ctx = st->ctx; + struct gl_context *ctx = st->ctx; GLfloat yScale, yBias; /* _NEW_BUFFERS */ if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) { yScale = -1; - yBias = ctx->DrawBuffer->Height ; + yBias = (GLfloat)ctx->DrawBuffer->Height; } else { yScale = 1.0; @@ -59,12 +58,12 @@ update_viewport( struct st_context *st ) /* _NEW_VIEWPORT */ { - GLfloat x = ctx->Viewport.X; - GLfloat y = ctx->Viewport.Y; + GLfloat x = (GLfloat)ctx->Viewport.X; + GLfloat y = (GLfloat)ctx->Viewport.Y; GLfloat z = ctx->Viewport.Near; - GLfloat half_width = ctx->Viewport.Width / 2.0; - GLfloat half_height = ctx->Viewport.Height / 2.0; - GLfloat half_depth = (ctx->Viewport.Far - ctx->Viewport.Near) / 2.0; + GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f; + GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f; + GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f; st->state.viewport.scale[0] = half_width; st->state.viewport.scale[1] = half_height * yScale;