X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fswrast%2Fs_zoom.c;h=26567fa3c83a7989b28af25bbb8e85361ce33ea5;hb=2ef866d1fc0a5cc5ef8543d65744dfd4da4dbbaf;hp=b331be13069287d992870ce25f4aa25a3191e5c0;hpb=674012f083dde5a58742a74a6b4adf266ea17ed7;p=mesa.git diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index b331be13069..26567fa3c83 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -1,10 +1,10 @@ -/* $Id: s_zoom.c,v 1.7 2001/12/17 04:54:35 brianp Exp $ */ +/* $Id: s_zoom.c,v 1.8 2002/01/21 18:12:34 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -26,6 +26,8 @@ #include "glheader.h" #include "macros.h" +#include "mem.h" +#include "colormac.h" #include "s_context.h" #include "s_span.h" @@ -33,6 +35,36 @@ #include "s_zoom.h" +#ifdef DEBUG + +#define SAVE_SPAN(span) struct sw_span tmp_span = (span); + +#define RESTORE_SPAN(span) \ +{ \ + GLint i; \ + for (i=tmp_span.start; iDrawBuffer->Width, MAX_WIDTH ); - const GLuint *srcRGBA32 = (const GLuint *) rgba; - GLuint *dstRGBA32 = (GLuint *) zrgba; + const GLint maxwidth = MIN2( ctx->DrawBuffer->Width, MAX_WIDTH ); + + SW_SPAN_RESET (dstspan); /* compute width of output row */ - m = (GLint) ABSF( n * ctx->Pixel.ZoomX ); - if (m==0) { + dstspan.end = (GLint) ABSF( n * ctx->Pixel.ZoomX ); + if (dstspan.end == 0) { return; } + /*here ok or better latter? like it was before */ + else if (dstspan.end > maxwidth) { + dstspan.end = maxwidth; + } + if (ctx->Pixel.ZoomX<0.0) { /* adjust x coordinate for left/right mirroring */ - x = x - m; + dstspan.x = x - dstspan.end; } + else + dstspan.x = x; + /* compute which rows to draw */ row = y-y0; @@ -93,47 +131,53 @@ _mesa_write_zoomed_rgba_span( GLcontext *ctx, } /* check if left edge is outside window */ - skipcol = 0; - if (x<0) { - skipcol = -x; - m += x; + if (dstspan.x < 0) { + dstspan.start = -x; } + /* make sure span isn't too long or short */ - if (m>maxwidth) { + /* if (m>maxwidth) { m = maxwidth; - } - else if (m<=0) { + }*/ + + if (dstspan.end <= dstspan.start) { return; } - ASSERT( m <= MAX_WIDTH ); + ASSERT( dstspan.end <= MAX_WIDTH ); /* zoom the span horizontally */ if (ctx->Pixel.ZoomX==-1.0F) { + SW_SPAN_SET_FLAG(dstspan.filledColor); + SW_SPAN_SET_FLAG(dstspan.filledAlpha); + SW_SPAN_SET_FLAG(dstspan.filledDepth); /* n==m */ - for (j=0;jFog.Enabled) { - for (j=0;jPixel.ZoomX; - for (j=0;jPixel.ZoomX; + SW_SPAN_SET_FLAG(dstspan.filledColor); + SW_SPAN_SET_FLAG(dstspan.filledAlpha); + SW_SPAN_SET_FLAG(dstspan.filledDepth); + for (j=dstspan.start; jFog.Enabled) { - for (j=0;j