summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-18 13:46:18 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-18 13:46:18 (GMT)
commit1a13c3edec3b2683e0204e4e65acab62b0130b0a (patch)
treedfdc6385d622db6076c201b99136b089a90bf454 /src
parent2717a1712755f6b6e44c28562fe987b43448c522 (diff)
downloadpowder-1a13c3edec3b2683e0204e4e65acab62b0130b0a.zip
powder-1a13c3edec3b2683e0204e4e65acab62b0130b0a.tar.gz
Use C++ allocation and deletion for Brush memory
Diffstat (limited to 'src')
-rw-r--r--src/game/Brush.h12
-rw-r--r--src/game/EllipseBrush.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/game/Brush.h b/src/game/Brush.h
index 34354c0..0adcd95 100644
--- a/src/game/Brush.h
+++ b/src/game/Brush.h
@@ -25,8 +25,8 @@ protected:
if(!bitmap)
return;
if(outline)
- free(outline);
- outline = (unsigned char *)calloc(size.X*size.Y, sizeof(unsigned char));
+ delete[] outline;
+ outline = new unsigned char[size.X*size.Y];
for(int x = 0; x < size.X; x++)
{
for(int y = 0; y < size.Y; y++)
@@ -69,9 +69,9 @@ public:
}
virtual ~Brush() {
if(bitmap)
- delete bitmap;
+ delete[] bitmap;
if(outline)
- delete outline;
+ delete[] outline;
}
virtual void RenderRect(Graphics * g, ui::Point position1, ui::Point position2)
{
@@ -109,8 +109,8 @@ public:
virtual void GenerateBitmap()
{
if(bitmap)
- free(bitmap);
- bitmap = (unsigned char *)calloc((size.X*size.Y), sizeof(unsigned char));
+ delete[] bitmap;
+ bitmap = new unsigned char[size.X*size.Y];
for(int x = 0; x < size.X; x++)
{
for(int y = 0; y < size.Y; y++)
diff --git a/src/game/EllipseBrush.h b/src/game/EllipseBrush.h
index 8a1dc9a..ac05ef7 100644
--- a/src/game/EllipseBrush.h
+++ b/src/game/EllipseBrush.h
@@ -22,8 +22,8 @@ public:
virtual void GenerateBitmap()
{
if(bitmap)
- free(bitmap);
- bitmap = (unsigned char*)calloc((size.X*size.Y), sizeof(unsigned char));
+ delete[] bitmap;
+ bitmap = new unsigned char[size.X*size.Y];
int rx = radius.X;
int ry = radius.Y;
for(int x = 0; x <= radius.X*2; x++)