UINT32 pc1512_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { if (m_vdu_mode & MODE_ENABLE_VIDEO) { m_blink_ctr++; if (m_blink_ctr == 0x08) { m_cursor = !m_cursor; } else if (m_blink_ctr == 0x10) { m_cursor = !m_cursor; m_blink = !m_blink; m_blink_ctr = 0; } switch (get_display_mode(m_vdu_mode)) { case ALPHA_40: case GRAPHICS_1: screen.set_visible_area(0, 359, 0, 245); break; case ALPHA_80: case GRAPHICS_2: screen.set_visible_area(0, 831, 0, 245); break; } switch (get_display_mode(m_vdu_mode)) { case ALPHA_40: case ALPHA_80: case GRAPHICS_1: bitmap.fill(PALETTE[m_vdu_color & 0x0f], cliprect); break; case GRAPHICS_2: bitmap.fill(PALETTE[m_vdu_border & 0x0f], cliprect); break; } m_vdu->screen_update(screen, bitmap, cliprect); } else { bitmap.fill(RGB_BLACK, cliprect); } return 0; }
void init_video (void) { if (! al_init_image_addon ()) error (-1, 0, "%s (void): failed to initialize image addon", __func__); al_set_new_display_flags (al_get_new_display_flags () | (display_mode < 0 ? ALLEGRO_WINDOWED : ALLEGRO_FULLSCREEN) | ALLEGRO_RESIZABLE | ALLEGRO_GENERATE_EXPOSE_EVENTS); display_width = display_width ? display_width : DISPLAY_WIDTH; display_height = display_height ? display_height : DISPLAY_HEIGHT; if (display_mode >= 0) { ALLEGRO_DISPLAY_MODE d; get_display_mode (display_mode, &d); display_width = d.width; display_height = d.height; al_set_new_display_refresh_rate (d.refresh_rate); al_set_new_display_flags (al_get_new_display_flags () & ~ALLEGRO_FULLSCREEN_WINDOW); } al_set_new_display_option (ALLEGRO_SINGLE_BUFFER, 1, ALLEGRO_SUGGEST); display = al_create_display (display_width, display_height); if (! display) error (-1, 0, "%s (void): failed to initialize display", __func__); set_target_backbuffer (display); al_set_new_bitmap_flags (ALLEGRO_VIDEO_BITMAP); al_set_window_title (display, WINDOW_TITLE); icon = load_bitmap (ICON); al_set_display_icon (display, icon); cutscene = true; if (mr.fit_w == 0 && mr.fit_h == 0) { mr.fit_w = 2; mr.fit_h = 2; } set_multi_room (1, 1); effect_buffer = create_bitmap (CUTSCENE_WIDTH, CUTSCENE_HEIGHT); black_screen = create_bitmap (CUTSCENE_WIDTH, CUTSCENE_HEIGHT); uscreen = create_bitmap (CUTSCENE_WIDTH, CUTSCENE_HEIGHT); iscreen = create_bitmap (display_width, display_height); clear_bitmap (uscreen, TRANSPARENT_COLOR); video_timer = create_timer (1.0 / EFFECT_HZ); al_init_font_addon (); builtin_font = al_create_builtin_font (); if (! builtin_font) error (-1, 0, "%s (void): cannot create builtin font", __func__); if (! al_init_primitives_addon ()) error (-1, 0, "%s (void): failed to initialize primitives addon", __func__); }
decklink_producer(const core::video_format_desc& format_desc, size_t device_index, const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filter) : decklink_(get_device(device_index)) , input_(decklink_) , attributes_(decklink_) , model_name_(get_model_name(decklink_)) , device_index_(device_index) , filter_(filter) , format_desc_(format_desc) , audio_cadence_(format_desc.audio_cadence) , muxer_(format_desc.fps, frame_factory, filter) , sync_buffer_(format_desc.audio_cadence.size()) , frame_factory_(frame_factory) { hints_ = 0; frame_buffer_.set_capacity(2); graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f)); graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.3f)); graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f)); graph_->set_color("dropped-frame", diagnostics::color(0.3f, 0.6f, 0.3f)); graph_->set_color("output-buffer", diagnostics::color(0.0f, 1.0f, 0.0f)); graph_->set_text(print()); diagnostics::register_graph(graph_); auto display_mode = get_display_mode(input_, format_desc_.format, bmdFormat8BitYUV, bmdVideoInputFlagDefault); // NOTE: bmdFormat8BitARGB is currently not supported by any decklink card. (2011-05-08) if(FAILED(input_->EnableVideoInput(display_mode, bmdFormat8BitYUV, bmdVideoInputFlagDefault))) BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Could not enable video input.") << boost::errinfo_api_function("EnableVideoInput")); if(FAILED(input_->EnableAudioInput(bmdAudioSampleRate48kHz, bmdAudioSampleType32bitInteger, format_desc_.audio_channels))) BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Could not enable audio input.") << boost::errinfo_api_function("EnableAudioInput")); if (FAILED(input_->SetCallback(this)) != S_OK) BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to set input callback.") << boost::errinfo_api_function("SetCallback")); if(FAILED(input_->StartStreams())) BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(narrow(print()) + " Failed to start input stream.") << boost::errinfo_api_function("StartStreams")); }
void pc1512_state::draw_alpha(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param) { offs_t char_rom_offset = get_char_rom_offset(); UINT32 *p = &bitmap.pix32(y + VFP_HIRES, HFP_HIRES); if (get_display_mode(m_vdu_mode) == ALPHA_40) p = &bitmap.pix32(y + VFP_LORES, HFP_LORES); if (y > 199) return; for (int column = 0; column < x_count; column++) { UINT8 code = m_video_ram[(ma + column) << 1]; UINT8 attr = m_video_ram[((ma + column) << 1) + 1]; int fg = attr & 0x0f; int bg = attr >> 4; if (m_vdu_mode & MODE_BLINK) { bg &= 0x07; if (BIT(attr, 7) && !m_blink) { fg = bg; } } offs_t addr = char_rom_offset | (code << 3) | (ra & 0x07); UINT8 data = m_char_rom->base()[addr & 0x1fff]; if ((column == cursor_x) && m_cursor) { data = 0xff; } for (int bit = 0; bit < 8; bit++) { int color = BIT(data, 7) ? fg : bg; *p = PALETTE[color]; p++; data <<= 1; } } }
int BC_FileBox::create_objects() { int x = 10, y = 10; BC_Resources *resources = BC_WindowBase::get_resources(); int directory_title_margin = MAX(20, resources->filebox_text_images[0]->get_h()); // Create recent dir list create_history(); // Directories aren't filtered in FileSystem so skip this if(!want_directory) { filter_list.append(new BC_ListBoxItem("*")); filter_list.append(new BC_ListBoxItem("[*.ifo][*.vob]")); filter_list.append(new BC_ListBoxItem("[*.mp2][*.mp3][*.wav]")); filter_list.append(new BC_ListBoxItem("[*.avi][*.mpg][*.m2v][*.m1v][*.mov]")); filter_list.append(new BC_ListBoxItem("heroine*")); filter_list.append(new BC_ListBoxItem("*.xml")); fs->set_filter(get_resources()->filebox_filter); } fs->update(directory); create_icons(); create_tables(); add_subwindow(ok_button = new BC_FileBoxOK(this)); if(want_directory) add_subwindow(usethis_button = new BC_FileBoxUseThis(this)); add_subwindow(cancel_button = new BC_FileBoxCancel(this)); add_subwindow(new BC_Title(x, y, caption)); x = get_w() - resources->filebox_icons_images[0]->get_w() - 10; add_subwindow(icon_button = new BC_FileBoxIcons(x, y, this)); x -= resources->filebox_text_images[0]->get_w() + 5; add_subwindow(text_button = new BC_FileBoxText(x, y, this)); x -= resources->filebox_newfolder_images[0]->get_w() + 5; add_subwindow(folder_button = new BC_FileBoxNewfolder(x, y, this)); x -= resources->filebox_delete_images[0]->get_w() + 5; add_subwindow(delete_button = new BC_FileBoxDelete(x, y, this)); x -= resources->filebox_reload_images[0]->get_w() + 5; add_subwindow(reload_button = new BC_FileBoxReload(x, y, this)); x -= resources->filebox_updir_images[0]->get_w() + 5; add_subwindow(updir_button = new BC_FileBoxUpdir(x, y, this)); x = 10; y += directory_title_margin + 3; add_subwindow(recent_popup = new BC_FileBoxRecent(this, x, y)); add_subwindow(directory_title = new BC_FileBoxDirectoryText(x, y, this)); directory_title->reposition_window( x, y, get_w() - recent_popup->get_w() - 20, 1); recent_popup->reposition_window( x + directory_title->get_w(), y, directory_title->get_w(), 200); x = 10; y += directory_title->get_h() + 5; listbox = 0; create_listbox(x, y, get_display_mode()); y += listbox->get_h() + 10; add_subwindow(textbox = new BC_FileBoxTextBox(x, y, this)); y += textbox->get_h() + 10; if(!want_directory) { add_subwindow(filter_text = new BC_FileBoxFilterText(x, y, this)); add_subwindow(filter_popup = new BC_FileBoxFilterMenu(x + filter_text->get_w(), y, this));; } // listbox has to be active because refresh might be called from newfolder_thread listbox->activate(); newfolder_thread = new BC_NewFolderThread(this); show_window(); return 0; }