From 1d03da68440ea33fe947d3476af87dbe575d2a77 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Sun, 1 Apr 2007 23:07:29 +0000 Subject: [PATCH] Added a hack to video loading to allow the creation of a context in some platforms, and changed the colour of dummy video provider to sky-blue. Originally committed to SVN as r973. --- aegisub/frame_main.cpp | 2 ++ aegisub/video_display.cpp | 5 ++++- aegisub/video_provider_dummy.cpp | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/aegisub/frame_main.cpp b/aegisub/frame_main.cpp index a9f00b62b..6de86022d 100644 --- a/aegisub/frame_main.cpp +++ b/aegisub/frame_main.cpp @@ -973,7 +973,9 @@ void FrameMain::LoadVideo(wxString file,bool autoload) { VFR_Output.Unload(); } } + SetDisplayMode(1,-1); VideoContext::Get()->SetVideo(file); + SetDisplayMode(0,-1); } catch (const wchar_t *error) { wxString err(error); diff --git a/aegisub/video_display.cpp b/aegisub/video_display.cpp index 6727e8966..227796772 100644 --- a/aegisub/video_display.cpp +++ b/aegisub/video_display.cpp @@ -134,9 +134,12 @@ void VideoDisplay::Render() { // Is shown? if (!IsShownOnScreen()) return; - // Set GL context + // Get video context VideoContext *context = VideoContext::Get(); wxASSERT(context); + if (!context->IsLoaded()) return; + + // Set GL context SetCurrent(*context->GetGLContext(this)); // Get sizes diff --git a/aegisub/video_provider_dummy.cpp b/aegisub/video_provider_dummy.cpp index 134cbfb4b..4b843cc49 100644 --- a/aegisub/video_provider_dummy.cpp +++ b/aegisub/video_provider_dummy.cpp @@ -87,7 +87,15 @@ DummyVideoProvider::~DummyVideoProvider() { // Get frame const AegiVideoFrame DummyVideoProvider::DoGetFrame(int n) { lastFrame = n; - return AegiVideoFrame(640,480); + 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; }