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