From e2d75337dbcd1ed92d170a39a9ba2304b1da3e97 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Thu, 27 Oct 2011 22:25:02 +0000 Subject: [PATCH] A bit of simplification of SubtitlesPreview. Originally committed to SVN as r5788. --- aegisub/src/subs_preview.cpp | 20 ++++++-------------- aegisub/src/subs_preview.h | 2 +- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/aegisub/src/subs_preview.cpp b/aegisub/src/subs_preview.cpp index d640ff647..204010b55 100644 --- a/aegisub/src/subs_preview.cpp +++ b/aegisub/src/subs_preview.cpp @@ -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(); } diff --git a/aegisub/src/subs_preview.h b/aegisub/src/subs_preview.h index a2dfb9dc3..71ff00b44 100644 --- a/aegisub/src/subs_preview.h +++ b/aegisub/src/subs_preview.h @@ -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);