Slightly simplify spectrum image generation in the colorpicker

This commit is contained in:
Thomas Goyne 2013-07-02 09:12:36 -07:00
parent e2022449d9
commit 5bf4f80920

View file

@ -918,12 +918,8 @@ void DialogColorPicker::UpdateSpectrumDisplay() {
template<typename Func> template<typename Func>
static wxBitmap *make_spectrum(wxBitmap *bitmap, Func func) { static wxBitmap *make_spectrum(wxBitmap *bitmap, Func func) {
unsigned char *spec = (unsigned char *)malloc(256*256*3); wxImage spectrum_image(256, 256);
if (!spec) throw std::bad_alloc(); func(spectrum_image.GetData());
func(spec);
wxImage spectrum_image(256, 256, spec);
*bitmap = wxBitmap(spectrum_image); *bitmap = wxBitmap(spectrum_image);
return bitmap; return bitmap;
} }