forked from mia/Aegisub
Use gil in ColourButton rather than wxMemoryDC
Basic drawing with wxMemoryDC is relatively slow.
This commit is contained in:
parent
991569463a
commit
e2022449d9
2 changed files with 5 additions and 6 deletions
|
@ -21,7 +21,7 @@
|
|||
#include "compat.h"
|
||||
#include "dialog_colorpicker.h"
|
||||
|
||||
#include <wx/dcmemory.h>
|
||||
#include <boost/gil/gil_all.hpp>
|
||||
|
||||
wxDEFINE_EVENT(EVT_COLOR, wxThreadEvent);
|
||||
|
||||
|
@ -45,9 +45,8 @@ ColourButton::ColourButton(wxWindow *parent, wxSize const& size, bool alpha, agi
|
|||
}
|
||||
|
||||
void ColourButton::UpdateBitmap() {
|
||||
wxMemoryDC dc;
|
||||
dc.SelectObject(bmp);
|
||||
dc.SetBrush(wxBrush(to_wx(colour)));
|
||||
dc.DrawRectangle(0, 0, bmp.GetWidth(), bmp.GetHeight());
|
||||
using namespace boost::gil;
|
||||
fill_pixels(interleaved_view(bmp.GetWidth(), bmp.GetHeight(), (bgr8_pixel_t*)bmp.GetData(), 3 * bmp.GetWidth()),
|
||||
bgr8_pixel_t(colour.r, colour.g, colour.b));
|
||||
SetBitmapLabel(bmp);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ wxDECLARE_EVENT(EVT_COLOR, wxThreadEvent);
|
|||
/// A button which displays a currently-selected color and lets the user pick
|
||||
/// a new color when clicked
|
||||
class ColourButton: public wxButton {
|
||||
wxBitmap bmp; ///< The button's bitmap label
|
||||
wxImage bmp; ///< The button's bitmap label
|
||||
agi::Color colour; ///< The current colour
|
||||
|
||||
/// Update the bitmap label after the color is changed
|
||||
|
|
Loading…
Reference in a new issue