fix more memory leaks in lua drawing (rectangle, pixel, line, bezier)
This commit is contained in:
parent
36aed5008e
commit
fec1ee0958
|
@ -517,10 +517,13 @@ namespace BizHawk.MultiClient
|
||||||
int int_y = LuaInt(Y);
|
int int_y = LuaInt(Y);
|
||||||
int int_width = LuaInt(width);
|
int int_width = LuaInt(width);
|
||||||
int int_height = LuaInt(height);
|
int int_height = LuaInt(height);
|
||||||
g.DrawRectangle(GetPen(line), int_x, int_y, int_width, int_height);
|
using (var pen = GetPen(line))
|
||||||
if (background != null)
|
{
|
||||||
using(var brush = GetBrush(background))
|
g.DrawRectangle(pen, int_x, int_y, int_width, int_height);
|
||||||
g.FillRectangle(brush, int_x, int_y, int_width, int_height);
|
if (background != null)
|
||||||
|
using (var brush = GetBrush(background))
|
||||||
|
g.FillRectangle(brush, int_x, int_y, int_width, int_height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch(Exception)
|
||||||
{
|
{
|
||||||
|
@ -537,7 +540,8 @@ namespace BizHawk.MultiClient
|
||||||
float x = LuaInt(X) + 0.1F;
|
float x = LuaInt(X) + 0.1F;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
g.DrawLine(GetPen(color), LuaInt(X), LuaInt(Y), x, LuaInt(Y));
|
using(var pen = GetPen(color))
|
||||||
|
g.DrawLine(pen, LuaInt(X), LuaInt(Y), x, LuaInt(Y));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -551,9 +555,10 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (color == null)
|
if (color == null)
|
||||||
color = "black";
|
color = "black";
|
||||||
g.DrawLine(GetPen(color), LuaInt(x1), LuaInt(y1), LuaInt(x2), LuaInt(y2));
|
using(var pen = GetPen(color))
|
||||||
|
g.DrawLine(pen, LuaInt(x1), LuaInt(y1), LuaInt(x2), LuaInt(y2));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -634,7 +639,8 @@ namespace BizHawk.MultiClient
|
||||||
if (i >= 4)
|
if (i >= 4)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g.DrawBezier(GetPen(color), Points[0], Points[1], Points[2], Points[3]);
|
using(var pen = GetPen(color))
|
||||||
|
g.DrawBezier(pen, Points[0], Points[1], Points[2], Points[3]);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue