swrast: Avoid aliasing violation.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Matt Turner 2016-05-26 15:52:33 -07:00
parent 149309a424
commit a1e9b72102

View file

@ -56,8 +56,8 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
* Note that we're not using span->array->mask[] here. We could...
*/
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
/* treat 4xGLubyte as 1xGLuint */
const GLuint srcMask = *((GLuint *) ctx->Color.ColorMask[buf]);
GLuint srcMask;
memcpy(&srcMask, ctx->Color.ColorMask[buf], sizeof(srcMask));
const GLuint dstMask = ~srcMask;
const GLuint *dst = (const GLuint *) rbPixels;
GLuint *src = (GLuint *) span->array->rgba8;