Use unique_ptr for bitmap

This commit is contained in:
Mike Walters
2015-06-24 13:26:45 +01:00
parent 858eafd91b
commit 2335fcd12e

View File

@@ -11,7 +11,7 @@ class wxImagePanel : public wxScrolled<wxPanel>
private:
InputSource *input_source = nullptr;
float *input_data = nullptr;
wxBitmap *image = nullptr;
std::unique_ptr<wxBitmap> image;
public:
wxImagePanel(wxFrame *parent, InputSource *input_source);
@@ -65,7 +65,6 @@ wxImagePanel::wxImagePanel(wxFrame *parent, InputSource *input_source) : wxScrol
wxImagePanel::~wxImagePanel()
{
free(input_data);
delete image;
}
void wxImagePanel::AllocateBuffers()
@@ -78,8 +77,7 @@ void wxImagePanel::AllocateBuffers()
input_data = (float*)realloc(input_data, width * height * sizeof(float));
delete image;
image = new wxBitmap(width, height, 24);
image.reset(new wxBitmap(width, height, 24));
}
int clamp(int a, int b, int c) {