Bevels are now supported.
authorDerek Foreman <manmower@gmail.com>
Mon, 2 Jun 2003 04:51:23 +0000 (04:51 +0000)
committerDerek Foreman <manmower@gmail.com>
Mon, 2 Jun 2003 04:51:23 +0000 (04:51 +0000)
render2/paint.c
render2/planar.c
render2/planar.h

index d1c40ff3e21e5dfde9db241a9db6cee778827033..965e95b218ef8c5809d18ec1d794c6987c712be2 100644 (file)
@@ -102,40 +102,24 @@ void RrPaint(struct RrSurface *sur)
 
     switch (RrPlanarBevelType(sur)) {
     case RR_SUNKEN_OUTER:
-        glBegin(GL_LINES);
-        glEnd();
+        RrBevel(RrSurfaceX(sur), RrSurfaceY(sur),
+                RrSurfaceWidth(sur), RrSurfaceHeight(sur),
+                0, 0, 0);
     break;
     case RR_SUNKEN_INNER:
-        glBegin(GL_LINES);
-        glEnd();
+        RrBevel(RrSurfaceX(sur), RrSurfaceY(sur),
+                RrSurfaceWidth(sur), RrSurfaceHeight(sur),
+                0, 1, 0);
     break;
     case RR_RAISED_OUTER:
-        glColor4f(1.0, 1.0, 1.0, 0.25);
-        glBegin(GL_LINES);
-        glVertex2i(RrSurfaceX(sur) + 1, RrSurfaceY(sur) + 1);
-        glVertex2i(RrSurfaceX(sur) + 1,
-                   RrSurfaceY(sur) + RrSurfaceHeight(sur) - 2);
-
-
-        glVertex2i(RrSurfaceX(sur) + 1,
-                   RrSurfaceY(sur) + RrSurfaceHeight(sur) - 2);
-        glVertex2i(RrSurfaceX(sur) + RrSurfaceWidth(sur) - 2,
-                   RrSurfaceY(sur) + RrSurfaceHeight(sur) - 2);
-
-        glColor4f(0.0, 0.0, 0.0, 0.25);
-        glVertex2i(RrSurfaceX(sur) + RrSurfaceWidth(sur) - 2,
-                   RrSurfaceY(sur) + RrSurfaceHeight(sur) - 2);
-        glVertex2i(RrSurfaceX(sur) + RrSurfaceWidth(sur) - 2,
-                   RrSurfaceY(sur) + 1);
-
-        glVertex2i(RrSurfaceX(sur) + RrSurfaceWidth(sur) - 2,
-                   RrSurfaceY(sur) + 1);
-        glVertex2i(RrSurfaceX(sur) + 1, RrSurfaceY(sur) + 1);
-        glEnd();
+        RrBevel(RrSurfaceX(sur), RrSurfaceY(sur),
+                RrSurfaceWidth(sur), RrSurfaceHeight(sur),
+                0, 0, 1);
     break;
     case RR_RAISED_INNER:
-        glBegin(GL_LINES);
-        glEnd();
+        RrBevel(RrSurfaceX(sur), RrSurfaceY(sur),
+                RrSurfaceWidth(sur), RrSurfaceHeight(sur),
+                0, 1, 1);
     break;
     case RR_BEVEL_NONE:
     break;
index 4afd7140f94e9da43562fd77b3ac37e297d71a15..0550145754a59a7630c4fc0982d01737579d6559 100644 (file)
@@ -303,3 +303,34 @@ void RrPlanarMinSize(struct RrSurface *sur, int *w, int *h)
     *w = 0;
     *h = 0;
 }
+
+void RrBevel(int x, int y, int w, int h, int bwidth, int inset, int raise)
+{
+    int offset = bwidth + inset;
+    h--; w--;
+
+    if (raise)
+        glColor4f(1.0, 1.0, 1.0, 0.25);
+    else
+        glColor4f(0.0, 0.0, 0.0, 0.25);
+
+    glBegin(GL_LINES);
+    glVertex2i(x + offset, y + offset);
+    glVertex2i(x + offset, y + h - offset);
+
+    glVertex2i(x + offset, y + h - offset);
+    glVertex2i(x + w - offset, y + h - offset);
+
+    if (!raise)
+        glColor4f(1.0, 1.0, 1.0, 0.25);
+    else
+        glColor4f(0.0, 0.0, 0.0, 0.25);
+
+    glVertex2i(x + w - offset, y + h - offset);
+    glVertex2i(x + w - offset,  y + offset);
+               
+    glVertex2i(x + w - offset, y + offset);
+    glVertex2i(x + offset, y + offset);
+    glEnd();
+}
+
index 755b122043ba73b22647be78d2c26b0938b9af19..8a970707a077d927aebf17552422a94810489305 100644 (file)
@@ -21,6 +21,8 @@ struct RrPlanarSurface {
 
 void RrPlanarPaint(struct RrSurface *sur, int absx, int absy);
 
+void RrBevel(int x, int y, int w, int h, int bwidth, int inset, int raise);
+
 void RrPlanarMinSize(struct RrSurface *sur, int *w, int *h);
 
 #endif