| 1 | /* $Id: rect.c,v 1.3 2000-05-23 20:40:52 jeroen Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * Mesa 3-D graphics library | 
|---|
| 5 | * Version:  3.1 | 
|---|
| 6 | * | 
|---|
| 7 | * Copyright (C) 1999  Brian Paul   All Rights Reserved. | 
|---|
| 8 | * | 
|---|
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a | 
|---|
| 10 | * copy of this software and associated documentation files (the "Software"), | 
|---|
| 11 | * to deal in the Software without restriction, including without limitation | 
|---|
| 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | 
|---|
| 13 | * and/or sell copies of the Software, and to permit persons to whom the | 
|---|
| 14 | * Software is furnished to do so, subject to the following conditions: | 
|---|
| 15 | * | 
|---|
| 16 | * The above copyright notice and this permission notice shall be included | 
|---|
| 17 | * in all copies or substantial portions of the Software. | 
|---|
| 18 | * | 
|---|
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | 
|---|
| 20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
|---|
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | 
|---|
| 22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | 
|---|
| 23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | 
|---|
| 24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 
|---|
| 25 | */ | 
|---|
| 26 | /* $XFree86: xc/lib/GL/mesa/src/rect.c,v 1.2 1999/04/04 00:20:30 dawes Exp $ */ | 
|---|
| 27 |  | 
|---|
| 28 |  | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 |  | 
|---|
| 32 | #ifdef PC_HEADER | 
|---|
| 33 | #include "all.h" | 
|---|
| 34 | #else | 
|---|
| 35 | #include "glheader.h" | 
|---|
| 36 | #include "types.h" | 
|---|
| 37 | #include "context.h" | 
|---|
| 38 | #include "macros.h" | 
|---|
| 39 | #include "rect.h" | 
|---|
| 40 | #include "vbfill.h" | 
|---|
| 41 | #endif | 
|---|
| 42 |  | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 | /* | 
|---|
| 46 | * Execute a glRect*() function. | 
|---|
| 47 | */ | 
|---|
| 48 | void | 
|---|
| 49 | _mesa_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) | 
|---|
| 50 | { | 
|---|
| 51 | /* | 
|---|
| 52 | * TODO: we could examine a bunch of state variables and ultimately | 
|---|
| 53 | * call the Driver->RectFunc() function to draw a screen-aligned | 
|---|
| 54 | * filled rectangle.  Someday... | 
|---|
| 55 | * | 
|---|
| 56 | * KW: What happens to cull mode here? | 
|---|
| 57 | */ | 
|---|
| 58 | GET_CURRENT_CONTEXT(ctx); | 
|---|
| 59 | ASSERT_OUTSIDE_BEGIN_END(ctx, "glRect"); | 
|---|
| 60 | RESET_IMMEDIATE(ctx); | 
|---|
| 61 | gl_Begin( ctx, GL_QUADS ); | 
|---|
| 62 | gl_Vertex2f( ctx, x1, y1 ); | 
|---|
| 63 | gl_Vertex2f( ctx, x2, y1 ); | 
|---|
| 64 | gl_Vertex2f( ctx, x2, y2 ); | 
|---|
| 65 | gl_Vertex2f( ctx, x1, y2 ); | 
|---|
| 66 | gl_End( ctx ); | 
|---|
| 67 | } | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 | void | 
|---|
| 71 | _mesa_Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) | 
|---|
| 72 | { | 
|---|
| 73 | _mesa_Rectf(x1, y1, x2, y2); | 
|---|
| 74 | } | 
|---|
| 75 |  | 
|---|
| 76 | void | 
|---|
| 77 | _mesa_Rectdv(const GLdouble *v1, const GLdouble *v2) | 
|---|
| 78 | { | 
|---|
| 79 | _mesa_Rectf(v1[0], v1[1], v2[0], v2[1]); | 
|---|
| 80 | } | 
|---|
| 81 |  | 
|---|
| 82 | void | 
|---|
| 83 | _mesa_Rectfv(const GLfloat *v1, const GLfloat *v2) | 
|---|
| 84 | { | 
|---|
| 85 | _mesa_Rectf(v1[0], v1[1], v2[0], v2[1]); | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | void | 
|---|
| 89 | _mesa_Recti(GLint x1, GLint y1, GLint x2, GLint y2) | 
|---|
| 90 | { | 
|---|
| 91 | _mesa_Rectf(x1, y1, x2, y2); | 
|---|
| 92 | } | 
|---|
| 93 |  | 
|---|
| 94 | void | 
|---|
| 95 | _mesa_Rectiv(const GLint *v1, const GLint *v2) | 
|---|
| 96 | { | 
|---|
| 97 | _mesa_Rectf(v1[0], v1[1], v2[0], v2[1]); | 
|---|
| 98 | } | 
|---|
| 99 |  | 
|---|
| 100 | void | 
|---|
| 101 | _mesa_Rects(GLshort x1, GLshort y1, GLshort x2, GLshort y2) | 
|---|
| 102 | { | 
|---|
| 103 | _mesa_Rectf(x1, y1, x2, y2); | 
|---|
| 104 | } | 
|---|
| 105 |  | 
|---|
| 106 | void | 
|---|
| 107 | _mesa_Rectsv(const GLshort *v1, const GLshort *v2) | 
|---|
| 108 | { | 
|---|
| 109 | _mesa_Rectf(v1[0], v1[1], v2[0], v2[1]); | 
|---|
| 110 | } | 
|---|
| 111 |  | 
|---|