Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove separate draw calls from iV_ShadowBox, instead reuse iV_Box().

  • Loading branch information...
commit 1ae50316d52fc032022234d08fc9fa9fa5a1423b 1 parent f58dd93
Per Inge Mathisen perim authored
Showing with 8 additions and 32 deletions.
  1. +6 −31 lib/ivis_opengl/pieblitfunc.cpp
  2. +2 −1  lib/ivis_opengl/pieblitfunc.h
37 lib/ivis_opengl/pieblitfunc.cpp
View
@@ -209,50 +209,25 @@ void iV_ShadowBox(int x0, int y0, int x1, int y1, int pad, PIELIGHT first, PIELI
pie_SetRendMode(REND_OPAQUE);
pie_SetTexturePage(TEXPAGE_NONE);
pie_DrawRect(x0 + pad, y0 + pad, x1 - pad, y1 - pad, fill); // necessary side-effect: sets alpha test off
- glColor4ubv(first.vector);
- glBegin(GL_LINES);
- glVertex2i(x0, y1);
- glVertex2i(x0, y0);
- glVertex2i(x0, y0);
- glVertex2i(x1, y0);
- glEnd();
- glColor4ubv(second.vector);
- glBegin(GL_LINES);
- glVertex2i(x1, y0);
- glVertex2i(x1, y1);
- glVertex2i(x0, y1);
- glVertex2i(x1, y1);
- glEnd();
+ iV_Box2(x0, y0, x1, y1, first, second);
}
/***************************************************************************/
-void iV_Box(int x0,int y0, int x1, int y1, PIELIGHT colour)
+void iV_Box2(int x0,int y0, int x1, int y1, PIELIGHT first, PIELIGHT second)
{
pie_SetTexturePage(TEXPAGE_NONE);
pie_SetAlphaTest(false);
- if (x0>rendSurface.clip.right || x1<rendSurface.clip.left ||
- y0>rendSurface.clip.bottom || y1<rendSurface.clip.top)
- {
- return;
- }
-
- if (x0<rendSurface.clip.left)
- x0 = rendSurface.clip.left;
- if (x1>rendSurface.clip.right)
- x1 = rendSurface.clip.right;
- if (y0<rendSurface.clip.top)
- y0 = rendSurface.clip.top;
- if (y1>rendSurface.clip.bottom)
- y1 = rendSurface.clip.bottom;
-
- glColor4ubv(colour.vector);
+ glColor4ubv(first.vector);
glBegin(GL_LINES);
glVertex2i(x0, y1);
glVertex2i(x0, y0);
glVertex2i(x0, y0);
glVertex2i(x1, y0);
+ glEnd();
+ glColor4ubv(second.vector);
+ glBegin(GL_LINES);
glVertex2i(x1, y0);
glVertex2i(x1, y1);
glVertex2i(x0, y1);
3  lib/ivis_opengl/pieblitfunc.h
View
@@ -105,7 +105,8 @@ class GFX
/***************************************************************************/
void iV_ShadowBox(int x0, int y0, int x1, int y1, int pad, PIELIGHT first, PIELIGHT second, PIELIGHT fill);
extern void iV_Line(int x0, int y0, int x1, int y1, PIELIGHT colour);
-extern void iV_Box(int x0,int y0, int x1, int y1, PIELIGHT colour);
+extern void iV_Box2(int x0,int y0, int x1, int y1, PIELIGHT first, PIELIGHT second);
+static inline void iV_Box(int x0,int y0, int x1, int y1, PIELIGHT first) { iV_Box2(x0, y0, x1, y1, first, first); }
extern void pie_BoxFill(int x0,int y0, int x1, int y1, PIELIGHT colour);
extern void iV_DrawImage(IMAGEFILE *ImageFile, UWORD ID, int x, int y);
void iV_DrawImage2(const QString &filename, float x, float y, float width = -0.0f, float height = -0.0f);
Please sign in to comment.
Something went wrong with that request. Please try again.