A bit of simplification of SubtitlesPreview.

Originally committed to SVN as r5788.
This commit is contained in:
Niels Martin Hansen 2011-10-27 22:25:02 +00:00
parent 8870eac2e9
commit e2d75337db
2 changed files with 7 additions and 15 deletions

View File

@ -114,15 +114,10 @@ void SubtitlesPreview::SetText(wxString text) {
////////////////
// Update image
void SubtitlesPreview::UpdateBitmap(int w,int h) {
// Visible?
void SubtitlesPreview::UpdateBitmap() {
if (!IsShownOnScreen()) return;
// Get size
if (w == -1) {
w = GetClientSize().GetWidth();
h = GetClientSize().GetHeight();
}
int w, h;
GetClientSize(&w, &h);
// Delete old bmp if needed
if (bmp) {
@ -173,11 +168,8 @@ void SubtitlesPreview::UpdateBitmap(int w,int h) {
}
// Convert frame to bitmap
wxMemoryDC dc(*bmp);
wxBitmap tempBmp(frame.GetImage());
frame.Clear();
dc.DrawBitmap(tempBmp,0,0);
Refresh();
*bmp = wxBitmap(frame.GetImage());
Refresh(false);
}
@ -203,7 +195,7 @@ void SubtitlesPreview::OnPaint(wxPaintEvent &event) {
void SubtitlesPreview::OnSize(wxSizeEvent &event) {
delete vid;
vid = NULL;
UpdateBitmap(event.GetSize().GetWidth(),event.GetSize().GetHeight());
UpdateBitmap();
}

View File

@ -60,7 +60,7 @@ private:
VideoProvider *vid;
wxColour backColour;
void UpdateBitmap(int w=-1,int h=-1);
void UpdateBitmap();
void OnSize(wxSizeEvent &event);
void OnPaint(wxPaintEvent &event);