Lua - fix gui.drawLine/Pie/Ellipse/Polygon/Pixel/Bezier from commit 2908, the way those were done was causing exceptions after the 1st draw

This commit is contained in:
andres.delikat 2012-09-11 14:47:41 +00:00
parent bf504d1220
commit 0afd4f3c09
1 changed files with 20 additions and 33 deletions

View File

@ -672,7 +672,9 @@ namespace BizHawk.MultiClient
int int_height = LuaInt(height);
g.DrawRectangle(GetPen(line), int_x, int_y, int_width, int_height);
if (background != null)
{
g.FillRectangle(GetBrush(background), int_x, int_y, int_width, int_height);
}
}
catch (Exception)
{
@ -715,7 +717,9 @@ namespace BizHawk.MultiClient
g.DrawRectangle(GetPen(line), int_x, int_y, int_width, int_height);
if (background != null)
{
g.FillRectangle(GetBrush(background), int_x, int_y, int_width, int_height);
}
}
catch (Exception)
{
@ -732,10 +736,7 @@ namespace BizHawk.MultiClient
float x = LuaInt(X) + 0.1F;
try
{
if (color == null)
color = "black";
using (var pen = GetPen(color))
g.DrawLine(pen, LuaInt(X), LuaInt(Y), x, LuaInt(Y));
g.DrawLine(GetPen(color ?? "black"), LuaInt(X), LuaInt(Y), x, LuaInt(Y));
}
catch (Exception)
{
@ -750,10 +751,7 @@ namespace BizHawk.MultiClient
{
try
{
if (color == null)
color = "black";
using (var pen = GetPen(color))
g.DrawLine(pen, LuaInt(x1), LuaInt(y1), LuaInt(x2), LuaInt(y2));
g.DrawLine(GetPen(color ?? "black"), LuaInt(x1), LuaInt(y1), LuaInt(x2), LuaInt(y2));
}
catch (Exception)
{
@ -768,16 +766,12 @@ namespace BizHawk.MultiClient
{
try
{
using (var pen = GetPen(line))
g.DrawEllipse(GetPen(line), LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height));
if (background != null)
{
g.DrawEllipse(pen, LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height));
if (background != null)
{
var brush = GetBrush(background);
g.FillEllipse(brush, LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height));
}
var brush = GetBrush(background);
g.FillEllipse(brush, LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height));
}
}
catch (Exception)
{
@ -802,14 +796,11 @@ namespace BizHawk.MultiClient
i++;
}
using (var pen = GetPen(line))
g.DrawPolygon(GetPen(line), Points);
if (background != null)
{
g.DrawPolygon(pen, Points);
if (background != null)
{
var brush = GetBrush(background);
g.FillPolygon(brush, Points);
}
var brush = GetBrush(background);
g.FillPolygon(brush, Points);
}
}
catch (Exception)
@ -834,8 +825,8 @@ namespace BizHawk.MultiClient
if (i >= 4)
break;
}
using (var pen = GetPen(color))
g.DrawBezier(pen, Points[0], Points[1], Points[2], Points[3]);
g.DrawBezier(GetPen(color), Points[0], Points[1], Points[2], Points[3]);
}
catch (Exception)
{
@ -851,16 +842,12 @@ namespace BizHawk.MultiClient
{
try
{
using (var pen = GetPen(line))
g.DrawPie(GetPen(line), LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height), LuaInt(startangle), LuaInt(sweepangle));
if (background != null)
{
g.DrawPie(pen, LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height), LuaInt(startangle), LuaInt(sweepangle));
if (background != null)
{
var brush = GetBrush(background);
g.FillPie(brush, LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height), LuaInt(startangle), LuaInt(sweepangle));
}
var brush = GetBrush(background);
g.FillPie(brush, LuaInt(X), LuaInt(Y), LuaInt(width), LuaInt(height), LuaInt(startangle), LuaInt(sweepangle));
}
}
catch (Exception)
{