/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 7.1
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2008 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"),
zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
const GLvoid *src, GLenum format )
{
+ SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan zoomed;
- SWspanarrays zoomed_arrays; /* this is big! */
GLint x0, x1, y0, y1;
GLint zoomedWidth;
return; /* totally clipped */
}
+ if (!swrast->ZoomedArrays) {
+ /* allocate on demand */
+ swrast->ZoomedArrays = (SWspanarrays *) CALLOC(sizeof(SWspanarrays));
+ if (!swrast->ZoomedArrays)
+ return;
+ }
+
zoomedWidth = x1 - x0;
ASSERT(zoomedWidth > 0);
ASSERT(zoomedWidth <= MAX_WIDTH);
INIT_SPAN(zoomed, GL_BITMAP);
zoomed.x = x0;
zoomed.end = zoomedWidth;
- zoomed.array = &zoomed_arrays;
- zoomed_arrays.ChanType = span->array->ChanType;
- if (zoomed_arrays.ChanType == GL_UNSIGNED_BYTE)
- zoomed_arrays.rgba = (GLchan (*)[4]) zoomed_arrays.rgba8;
- else if (zoomed_arrays.ChanType == GL_UNSIGNED_SHORT)
- zoomed_arrays.rgba = (GLchan (*)[4]) zoomed_arrays.rgba16;
+ zoomed.array = swrast->ZoomedArrays;
+ zoomed.array->ChanType = span->array->ChanType;
+ if (zoomed.array->ChanType == GL_UNSIGNED_BYTE)
+ zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->rgba8;
+ else if (zoomed.array->ChanType == GL_UNSIGNED_SHORT)
+ zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->rgba16;
else
- zoomed_arrays.rgba = (GLchan (*)[4]) zoomed_arrays.attribs[FRAG_ATTRIB_COL0];
+ zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[FRAG_ATTRIB_COL0];
COPY_4V(zoomed.attrStart[FRAG_ATTRIB_WPOS], span->attrStart[FRAG_ATTRIB_WPOS]);
COPY_4V(zoomed.attrStepX[FRAG_ATTRIB_WPOS], span->attrStepX[FRAG_ATTRIB_WPOS]);