use BCOPY macro on FreeBSD
[mesa.git] / src / mesa / main / polygon.c
index ca284c2fff26f3cf0d407933310c11638c8f6b40..13f0a50c8625332fe423d48239933b31b1e25f45 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: polygon.c,v 1.5 1999/11/08 07:36:44 brianp Exp $ */
+/* $Id: polygon.c,v 1.11 2000/03/13 18:32:37 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.1
+ * Version:  3.3
  * 
- * Copyright (C) 1999  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2000  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"),
  */
 
 
-/* $XFree86: xc/lib/GL/mesa/src/polygon.c,v 1.3 1999/04/04 00:20:29 dawes Exp $ */
-
 #ifdef PC_HEADER
 #include "all.h"
 #else
-#ifndef XFree86Server
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#else
-#include "GL/xf86glx.h"
-#endif
+#include "glheader.h"
 #include "context.h"
 #include "image.h"
 #include "enums.h"
 #include "macros.h"
+#include "mem.h"
 #include "polygon.h"
 #include "types.h"
 #endif
 
 
 
-void gl_CullFace( GLcontext *ctx, GLenum mode )
+void
+_mesa_CullFace( GLenum mode )
 {
+   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCullFace");
 
    if (MESA_VERBOSE&VERBOSE_API)
@@ -69,8 +63,10 @@ void gl_CullFace( GLcontext *ctx, GLenum mode )
 
 
 
-void gl_FrontFace( GLcontext *ctx, GLenum mode )
+void
+_mesa_FrontFace( GLenum mode )
 {
+   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFrontFace");
 
    if (MESA_VERBOSE&VERBOSE_API)
@@ -82,7 +78,7 @@ void gl_FrontFace( GLcontext *ctx, GLenum mode )
    }
 
    ctx->Polygon.FrontFace = mode;
-   ctx->Polygon.FrontBit = (mode == GL_CW);
+   ctx->Polygon.FrontBit = (GLboolean) (mode == GL_CW);
    ctx->NewState |= NEW_POLYGON;
 
    if (ctx->Driver.FrontFace)
@@ -91,8 +87,10 @@ void gl_FrontFace( GLcontext *ctx, GLenum mode )
 
 
 
-void gl_PolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
+void
+_mesa_PolygonMode( GLenum face, GLenum mode )
 {
+   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonMode");
 
    if (MESA_VERBOSE&VERBOSE_API)
@@ -134,40 +132,45 @@ void gl_PolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
 
 
 
-/*
- * NOTE:  stipple pattern has already been unpacked.
- */
-void gl_PolygonStipple( GLcontext *ctx, const GLuint pattern[32] )
+void
+_mesa_PolygonStipple( const GLubyte *pattern )
 {
+   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonStipple");
 
    if (MESA_VERBOSE&VERBOSE_API)
       fprintf(stderr, "glPolygonStipple\n");
 
-   MEMCPY( ctx->PolygonStipple, pattern, 32 * 4 );
+   _mesa_unpack_polygon_stipple(pattern, ctx->PolygonStipple, &ctx->Unpack);
 
    if (ctx->Polygon.StippleFlag) {
       ctx->NewState |= NEW_RASTER_OPS;
    }
+   
+   if (ctx->Driver.PolygonStipple)
+      ctx->Driver.PolygonStipple( ctx, (const GLubyte *) ctx->PolygonStipple );
 }
 
 
 
-void gl_GetPolygonStipple( GLcontext *ctx, GLubyte *dest )
+void
+_mesa_GetPolygonStipple( GLubyte *dest )
 {
+   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset");
 
    if (MESA_VERBOSE&VERBOSE_API)
       fprintf(stderr, "glGetPolygonStipple\n");
 
-   gl_pack_polygon_stipple( ctx, ctx->PolygonStipple, dest );
+   _mesa_pack_polygon_stipple(ctx->PolygonStipple, dest, &ctx->Pack);
 }
 
 
 
-void gl_PolygonOffset( GLcontext *ctx,
-                       GLfloat factor, GLfloat units )
+void
+_mesa_PolygonOffset( GLfloat factor, GLfloat units )
 {
+   GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffset");
 
    if (MESA_VERBOSE&VERBOSE_API)
@@ -177,3 +180,12 @@ void gl_PolygonOffset( GLcontext *ctx,
    ctx->Polygon.OffsetUnits = units;
 }
 
+
+
+void
+_mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPolygonOffsetEXT");
+   _mesa_PolygonOffset(factor, bias * ctx->Visual->DepthMaxF );
+}