From: Derek Foreman Date: Mon, 2 Jun 2003 04:51:23 +0000 (+0000) Subject: Bevels are now supported. X-Git-Tag: gl2~1 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=7aa94d4c1ce944b21ec3de98e74c99c91edb013b;p=dana%2Fopenbox.git Bevels are now supported. --- diff --git a/render2/paint.c b/render2/paint.c index d1c40ff3..965e95b2 100644 --- a/render2/paint.c +++ b/render2/paint.c @@ -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; diff --git a/render2/planar.c b/render2/planar.c index 4afd7140..05501457 100644 --- a/render2/planar.c +++ b/render2/planar.c @@ -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(); +} + diff --git a/render2/planar.h b/render2/planar.h index 755b1220..8a970707 100644 --- a/render2/planar.h +++ b/render2/planar.h @@ -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