Convert crlf->lf line endings.
[mesa.git] / src / mesa / drivers / allegro / direct.h
index 3998fc19d7bc0d424c5ca9b395c61599acc329a6..bd8b5eb49ddc7c5dcc7e3895a5ce81b1beb3ea3b 100644 (file)
-/*\r
- * Mesa 3-D graphics library\r
- * Version:  3.0\r
- * Copyright (C) 1995-1998  Brian Paul\r
- *\r
- * This library is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Library General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2 of the License, or (at your option) any later version.\r
- *\r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
- * Library General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Library General Public\r
- * License along with this library; if not, write to the Free\r
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
- */\r
-\r
-\r
-#define DESTINATION(BMP, X, Y, TYPE)                                \\r
-    ({                                                              \\r
-    BITMAP *_bmp = BMP;                                             \\r
-                                                                    \\r
-    (TYPE*)(_bmp->line[_bmp->h - (Y) - 1]) + (X);                   \\r
-    })\r
-\r
-\r
-#define IMPLEMENT_WRITE_RGBA_SPAN(DEPTH, TYPE)                                                   \\r
-static void write_rgba_span_##DEPTH (const GLcontext *ctx,                                       \\r
-                                     GLuint n, GLint x, GLint y,                                 \\r
-                                     const GLubyte rgba[][4],                                    \\r
-                                     const GLubyte mask[])                                       \\r
-    {                                                                                            \\r
-    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                       \\r
-    TYPE              *d = DESTINATION(context->Buffer->Active, x, y, TYPE);                     \\r
-                                                                                                 \\r
-    if (mask)                                                                                    \\r
-        {                                                                                        \\r
-        while (n--)                                                                              \\r
-            {                                                                                    \\r
-            if (mask[0]) d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]);  \\r
-            d++; rgba++; mask++;                                                                 \\r
-            }                                                                                    \\r
-        }                                                                                        \\r
-    else                                                                                         \\r
-        {                                                                                        \\r
-        while (n--)                                                                              \\r
-            {                                                                                    \\r
-            d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]);               \\r
-            d++; rgba++;                                                                         \\r
-            }                                                                                    \\r
-        }                                                                                        \\r
-    }\r
-\r
-\r
-#define IMPLEMENT_WRITE_RGB_SPAN(DEPTH, TYPE)                                                    \\r
-static void write_rgb_span_##DEPTH (const GLcontext *ctx,                                        \\r
-                                    GLuint n, GLint x, GLint y,                                  \\r
-                                    const GLubyte rgb[][3],                                      \\r
-                                    const GLubyte mask[])                                        \\r
-    {                                                                                            \\r
-    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                       \\r
-    TYPE              *d = DESTINATION(context->Buffer->Active, x, y, TYPE);                     \\r
-                                                                                                 \\r
-    if (mask)                                                                                    \\r
-        {                                                                                        \\r
-        while (n--)                                                                              \\r
-            {                                                                                    \\r
-            if (mask[0]) d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]);     \\r
-            d++; rgb++; mask++;                                                                  \\r
-            }                                                                                    \\r
-        }                                                                                        \\r
-    else                                                                                         \\r
-        {                                                                                        \\r
-        while (n--)                                                                              \\r
-            {                                                                                    \\r
-            d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]);                  \\r
-            d++; rgb++;                                                                          \\r
-            }                                                                                    \\r
-        }                                                                                        \\r
-    }\r
-\r
-\r
-#define IMPLEMENT_WRITE_MONO_RGBA_SPAN(DEPTH, TYPE)                                              \\r
-static void write_mono_rgba_span_##DEPTH (const GLcontext *ctx,                                  \\r
-                                          GLuint n, GLint x, GLint y,                            \\r
-                                          const GLubyte mask[])                                  \\r
-    {                                                                                            \\r
-    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                       \\r
-    TYPE           color = context->CurrentColor;                                                \\r
-    TYPE              *d = DESTINATION(context->Buffer->Active, x, y, TYPE);                     \\r
-                                                                                                 \\r
-    while (n--)                                                                                  \\r
-        {                                                                                        \\r
-        if (mask[0]) d[0] = color;                                                               \\r
-        d++; mask++;                                                                             \\r
-        }                                                                                        \\r
-    }\r
-\r
-\r
-#define IMPLEMENT_READ_RGBA_SPAN(DEPTH, TYPE)                           \\r
-static void read_rgba_span_##DEPTH (const GLcontext *ctx,                              \\r
-                                    GLuint n, GLint x, GLint y,                        \\r
-                                    GLubyte rgba[][4])                                 \\r
-    {                                                                                                                                  \\r
-    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                             \\r
-    BITMAP          *bmp = context->Buffer->Active;                     \\r
-    TYPE              *d = DESTINATION(bmp, x, y, TYPE);                \\r
-                                                                        \\r
-    while (n--)                                                         \\r
-        {                                                               \\r
-        rgba[0][RCOMP] = getr##DEPTH(d[0]);                             \\r
-        rgba[0][GCOMP] = getg##DEPTH(d[0]);                             \\r
-        rgba[0][BCOMP] = getb##DEPTH(d[0]);                             \\r
-        rgba[0][ACOMP] = 255;                                           \\r
-                                                                        \\r
-        d++; rgba++;                                                    \\r
-        }                                                               \\r
-    }\r
-\r
-\r
-#define IMPLEMENT_WRITE_RGBA_PIXELS(DEPTH, TYPE)                                                                                 \\r
-static void write_rgba_pixels_##DEPTH (const GLcontext *ctx,                                                                     \\r
-                                       GLuint n,                                                                                 \\r
-                                       const GLint x[],                                                                          \\r
-                                       const GLint y[],                                                                          \\r
-                                       const GLubyte rgba[][4],                                                                  \\r
-                                       const GLubyte mask[])                                                                     \\r
-    {                                                                                                                            \\r
-    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                                                       \\r
-    BITMAP          *bmp = context->Buffer->Active;                                                                              \\r
-                                                                                                                                 \\r
-    while (n--)                                                                                                                  \\r
-        {                                                                                                                        \\r
-        if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]);       \\r
-        rgba++; x++; y++; mask++;                                                                                                \\r
-        }                                                                                                                        \\r
-    }\r
-\r
-\r
-\r
-#define IMPLEMENT_WRITE_MONO_RGBA_PIXELS(DEPTH, TYPE)                                                                            \\r
-static void write_mono_rgba_pixels_##DEPTH (const GLcontext *ctx,                                                                \\r
-                                            GLuint n,                                                                            \\r
-                                            const GLint x[],                                                                     \\r
-                                            const GLint y[],                                                                     \\r
-                                            const GLubyte mask[])                                                                \\r
-    {                                                                                                                            \\r
-    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                                                       \\r
-    TYPE          color  = context->CurrentColor;                                                                                \\r
-    BITMAP          *bmp = context->Buffer->Active;                                                                              \\r
-                                                                                                                                 \\r
-    while (n--)                                                                                                                  \\r
-        {                                                                                                                        \\r
-        if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = color;                                                                \\r
-        x++; y++; mask++;                                                                                                        \\r
-        }                                                                                                                        \\r
-    }\r
-\r
-\r
-#define IMPLEMENT_READ_RGBA_PIXELS(DEPTH, TYPE)                         \\r
-static void read_rgba_pixels_##DEPTH (const GLcontext *ctx,                            \\r
-                                         GLuint n,                                                     \\r
-                                         const GLint x[],                                      \\r
-                                         const GLint y[],                                      \\r
-                                         GLubyte rgba[][4],                            \\r
-                                         const GLubyte mask[])                         \\r
-    {                                                                                                                                  \\r
-    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                             \\r
-    BITMAP          *bmp = context->Buffer->Active;                     \\r
-                                                                        \\r
-    while (n--)                                                         \\r
-        {                                                               \\r
-        if (mask[0])                                                    \\r
-            {                                                           \\r
-            int color = *DESTINATION(bmp, x[0], y[0], TYPE);            \\r
-                                                                        \\r
-            rgba[0][RCOMP] = getr##DEPTH(color);                        \\r
-            rgba[0][GCOMP] = getg##DEPTH(color);                        \\r
-            rgba[0][BCOMP] = getb##DEPTH(color);                        \\r
-            rgba[0][ACOMP] = 255;                                       \\r
-            }                                                           \\r
-                                                                        \\r
-        x++; y++; rgba++; mask++;                                       \\r
-        }                                                               \\r
-    }\r
-\r
+/*
+ * Mesa 3-D graphics library
+ * Version:  3.0
+ * Copyright (C) 1995-1998  Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+#define DESTINATION(BMP, X, Y, TYPE)                                \
+    ({                                                              \
+    BITMAP *_bmp = BMP;                                             \
+                                                                    \
+    (TYPE*)(_bmp->line[_bmp->h - (Y) - 1]) + (X);                   \
+    })
+
+
+#define IMPLEMENT_WRITE_RGBA_SPAN(DEPTH, TYPE)                                                   \
+static void write_rgba_span_##DEPTH (const GLcontext *ctx,                                       \
+                                     GLuint n, GLint x, GLint y,                                 \
+                                     const GLubyte rgba[][4],                                    \
+                                     const GLubyte mask[])                                       \
+    {                                                                                            \
+    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                       \
+    TYPE              *d = DESTINATION(context->Buffer->Active, x, y, TYPE);                     \
+                                                                                                 \
+    if (mask)                                                                                    \
+        {                                                                                        \
+        while (n--)                                                                              \
+            {                                                                                    \
+            if (mask[0]) d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]);  \
+            d++; rgba++; mask++;                                                                 \
+            }                                                                                    \
+        }                                                                                        \
+    else                                                                                         \
+        {                                                                                        \
+        while (n--)                                                                              \
+            {                                                                                    \
+            d[0] = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]);               \
+            d++; rgba++;                                                                         \
+            }                                                                                    \
+        }                                                                                        \
+    }
+
+
+#define IMPLEMENT_WRITE_RGB_SPAN(DEPTH, TYPE)                                                    \
+static void write_rgb_span_##DEPTH (const GLcontext *ctx,                                        \
+                                    GLuint n, GLint x, GLint y,                                  \
+                                    const GLubyte rgb[][3],                                      \
+                                    const GLubyte mask[])                                        \
+    {                                                                                            \
+    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                       \
+    TYPE              *d = DESTINATION(context->Buffer->Active, x, y, TYPE);                     \
+                                                                                                 \
+    if (mask)                                                                                    \
+        {                                                                                        \
+        while (n--)                                                                              \
+            {                                                                                    \
+            if (mask[0]) d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]);     \
+            d++; rgb++; mask++;                                                                  \
+            }                                                                                    \
+        }                                                                                        \
+    else                                                                                         \
+        {                                                                                        \
+        while (n--)                                                                              \
+            {                                                                                    \
+            d[0] = makecol##DEPTH(rgb[0][RCOMP], rgb[0][GCOMP], rgb[0][BCOMP]);                  \
+            d++; rgb++;                                                                          \
+            }                                                                                    \
+        }                                                                                        \
+    }
+
+
+#define IMPLEMENT_WRITE_MONO_RGBA_SPAN(DEPTH, TYPE)                                              \
+static void write_mono_rgba_span_##DEPTH (const GLcontext *ctx,                                  \
+                                          GLuint n, GLint x, GLint y,                            \
+                                          const GLubyte mask[])                                  \
+    {                                                                                            \
+    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                       \
+    TYPE           color = context->CurrentColor;                                                \
+    TYPE              *d = DESTINATION(context->Buffer->Active, x, y, TYPE);                     \
+                                                                                                 \
+    while (n--)                                                                                  \
+        {                                                                                        \
+        if (mask[0]) d[0] = color;                                                               \
+        d++; mask++;                                                                             \
+        }                                                                                        \
+    }
+
+
+#define IMPLEMENT_READ_RGBA_SPAN(DEPTH, TYPE)                           \
+static void read_rgba_span_##DEPTH (const GLcontext *ctx,                              \
+                                    GLuint n, GLint x, GLint y,                        \
+                                    GLubyte rgba[][4])                                 \
+    {                                                                                                                                  \
+    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                             \
+    BITMAP          *bmp = context->Buffer->Active;                     \
+    TYPE              *d = DESTINATION(bmp, x, y, TYPE);                \
+                                                                        \
+    while (n--)                                                         \
+        {                                                               \
+        rgba[0][RCOMP] = getr##DEPTH(d[0]);                             \
+        rgba[0][GCOMP] = getg##DEPTH(d[0]);                             \
+        rgba[0][BCOMP] = getb##DEPTH(d[0]);                             \
+        rgba[0][ACOMP] = 255;                                           \
+                                                                        \
+        d++; rgba++;                                                    \
+        }                                                               \
+    }
+
+
+#define IMPLEMENT_WRITE_RGBA_PIXELS(DEPTH, TYPE)                                                                                 \
+static void write_rgba_pixels_##DEPTH (const GLcontext *ctx,                                                                     \
+                                       GLuint n,                                                                                 \
+                                       const GLint x[],                                                                          \
+                                       const GLint y[],                                                                          \
+                                       const GLubyte rgba[][4],                                                                  \
+                                       const GLubyte mask[])                                                                     \
+    {                                                                                                                            \
+    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                                                       \
+    BITMAP          *bmp = context->Buffer->Active;                                                                              \
+                                                                                                                                 \
+    while (n--)                                                                                                                  \
+        {                                                                                                                        \
+        if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = makecol##DEPTH(rgba[0][RCOMP], rgba[0][GCOMP], rgba[0][BCOMP]);       \
+        rgba++; x++; y++; mask++;                                                                                                \
+        }                                                                                                                        \
+    }
+
+
+
+#define IMPLEMENT_WRITE_MONO_RGBA_PIXELS(DEPTH, TYPE)                                                                            \
+static void write_mono_rgba_pixels_##DEPTH (const GLcontext *ctx,                                                                \
+                                            GLuint n,                                                                            \
+                                            const GLint x[],                                                                     \
+                                            const GLint y[],                                                                     \
+                                            const GLubyte mask[])                                                                \
+    {                                                                                                                            \
+    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                                                                       \
+    TYPE          color  = context->CurrentColor;                                                                                \
+    BITMAP          *bmp = context->Buffer->Active;                                                                              \
+                                                                                                                                 \
+    while (n--)                                                                                                                  \
+        {                                                                                                                        \
+        if (mask[0]) *DESTINATION(bmp, x[0], y[0], TYPE) = color;                                                                \
+        x++; y++; mask++;                                                                                                        \
+        }                                                                                                                        \
+    }
+
+
+#define IMPLEMENT_READ_RGBA_PIXELS(DEPTH, TYPE)                         \
+static void read_rgba_pixels_##DEPTH (const GLcontext *ctx,                            \
+                                         GLuint n,                                                     \
+                                         const GLint x[],                                      \
+                                         const GLint y[],                                      \
+                                         GLubyte rgba[][4],                            \
+                                         const GLubyte mask[])                         \
+    {                                                                                                                                  \
+    AMesaContext context = (AMesaContext)(ctx->DriverCtx);                             \
+    BITMAP          *bmp = context->Buffer->Active;                     \
+                                                                        \
+    while (n--)                                                         \
+        {                                                               \
+        if (mask[0])                                                    \
+            {                                                           \
+            int color = *DESTINATION(bmp, x[0], y[0], TYPE);            \
+                                                                        \
+            rgba[0][RCOMP] = getr##DEPTH(color);                        \
+            rgba[0][GCOMP] = getg##DEPTH(color);                        \
+            rgba[0][BCOMP] = getb##DEPTH(color);                        \
+            rgba[0][ACOMP] = 255;                                       \
+            }                                                           \
+                                                                        \
+        x++; y++; rgba++; mask++;                                       \
+        }                                                               \
+    }
+