Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

GLVideoDriver: Fixed DrawHLine & DrawVLine, implemented DrawCircle (w…

…ith DrawEllipse)
  • Loading branch information...
commit 30953a117efe8d2b6171ef3408d62d5d6e1f2af9 1 parent 8dc4125
@BehoIder BehoIder authored lynxlynxlynx committed
View
32 gemrb/plugins/SDLVideo/SDL20GLVideo.cpp
@@ -589,8 +589,20 @@ void GLVideoDriver::DrawRect(const Region& rgn, const Color& color, bool fill, b
}
}
-void GLVideoDriver::DrawHLine(short x1, short y, short x2, const Color& color, bool /*clipped*/)
+void GLVideoDriver::DrawHLine(short x1, short y, short x2, const Color& color, bool clipped)
{
+ if (x1 > x2)
+ {
+ short tmpx = x1;
+ x1 = x2;
+ x2 = tmpx;
+ }
+ if (clipped)
+ {
+ x1 = x1 + xCorr - Viewport.x;
+ x2 = x2 + xCorr - Viewport.x;
+ y = y + yCorr - Viewport.y;
+ }
Region rgn;
rgn.x = x1;
rgn.y = y;
@@ -599,8 +611,20 @@ void GLVideoDriver::DrawHLine(short x1, short y, short x2, const Color& color, b
return drawColoredRect(rgn, color);
}
-void GLVideoDriver::DrawVLine(short x, short y1, short y2, const Color& color, bool /*clipped*/)
+void GLVideoDriver::DrawVLine(short x, short y1, short y2, const Color& color, bool clipped)
{
+ if (y1 > y2)
+ {
+ short tmpy = y1;
+ y1 = y2;
+ y2 = tmpy;
+ }
+ if (clipped)
+ {
+ x = x + xCorr - Viewport.x;
+ y1 = y1 + yCorr - Viewport.y;
+ y2 = y2 + yCorr - Viewport.y;
+ }
Region rgn;
rgn.x = x;
rgn.y = y1;
@@ -626,6 +650,10 @@ void GLVideoDriver::DrawEllipse(short cx, short cy, unsigned short xr, unsigned
return drawEllipse(cx, cy, xr, yr, 3, color);
}
+void GLVideoDriver::DrawCircle(short cx, short cy, unsigned short r, const Color& color, bool clipped)
+{
+ return DrawEllipse(cx, cy, r, r, color, clipped);
+}
int GLVideoDriver::SwapBuffers()
{
View
1  gemrb/plugins/SDLVideo/SDL20GLVideo.h
@@ -63,6 +63,7 @@ namespace GemRB
void DrawHLine(short x1, short y, short x2, const Color& color, bool clipped = false);
void DrawVLine(short x, short y1, short y2, const Color& color, bool clipped = false);
void DrawEllipse(short cx, short cy, unsigned short xr, unsigned short yr, const Color& color, bool clipped = true);
+ void DrawCircle(short cx, short cy, unsigned short r, const Color& color, bool clipped = true);
void DestroyMovieScreen();
Sprite2D* GetScreenshot(Region r);
};
View
2  gemrb/plugins/SDLVideo/SDLVideo.h
@@ -106,7 +106,7 @@ class SDLVideoDriver : public Video {
void SetPixel(short x, short y, const Color& color, bool clipped = true);
/** Gets the pixel of the backbuffer surface */
void GetPixel(short x, short y, Color& color);
- void DrawCircle(short cx, short cy, unsigned short r, const Color& color, bool clipped = true);
+ virtual void DrawCircle(short cx, short cy, unsigned short r, const Color& color, bool clipped = true);
/** This functions Draws an Ellipse Segment */
void DrawEllipseSegment(short cx, short cy, unsigned short xr, unsigned short yr, const Color& color,
double anglefrom, double angleto, bool drawlines = true, bool clipped = true);
Please sign in to comment.
Something went wrong with that request. Please try again.