From bef344645bee1bd0d72182d37eeebe0e9a49baf4 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sun, 1 Apr 2007 23:13:29 +0000 Subject: [PATCH] Fixed memory handling in dummy provider. Originally committed to SVN as r974. --- aegisub/video_provider_dummy.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/aegisub/video_provider_dummy.cpp b/aegisub/video_provider_dummy.cpp index 4b843cc49..d841d9c68 100644 --- a/aegisub/video_provider_dummy.cpp +++ b/aegisub/video_provider_dummy.cpp @@ -44,6 +44,7 @@ class DummyVideoProvider : public VideoProvider { private: int lastFrame; + AegiVideoFrame frame; protected: const AegiVideoFrame DoGetFrame(int n); @@ -74,6 +75,15 @@ public: // Constructor DummyVideoProvider::DummyVideoProvider(wxString filename, double fps) { lastFrame = -1; + + frame = AegiVideoFrame(640,480,FORMAT_RGB32); + unsigned char *dst = frame.data[0]; + for (int i=frame.pitch[0]*frame.h/frame.GetBpp();--i>=0;) { + *dst++ = 254; + *dst++ = 163; + *dst++ = 47; + *dst++ = 0; + } } @@ -87,14 +97,6 @@ DummyVideoProvider::~DummyVideoProvider() { // Get frame const AegiVideoFrame DummyVideoProvider::DoGetFrame(int n) { lastFrame = n; - AegiVideoFrame frame(640,480,FORMAT_RGB32); - unsigned char *dst = frame.data[0]; - for (int i=frame.pitch[0]*frame.h/frame.GetBpp();--i>=0;) { - *dst++ = 254; - *dst++ = 163; - *dst++ = 47; - *dst++ = 0; - } return frame; }