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>
static wxBitmap *make_spectrum(wxBitmap *bitmap, Func func) {
unsigned char *spec = (unsigned char *)malloc(256*256*3);
if (!spec) throw std::bad_alloc();
func(spec);
wxImage spectrum_image(256, 256, spec);
wxImage spectrum_image(256, 256);
func(spectrum_image.GetData());
*bitmap = wxBitmap(spectrum_image);
return bitmap;
}