Previous 199869 Revisions Next

r34186 Monday 5th January, 2015 at 02:10:11 UTC by Couriersud
Renamed draw[sdl2|ogl|sdl]_window_get_primitives and related variables
to set_target_bounds. That's what is really done here. Moved common code
back to window.c. (nw)
[src/osd/sdl]draw13.c drawogl.c drawsdl.c sdlwork.c window.c window.h

trunk/src/osd/sdl/draw13.c
r242697r242698
200200static void drawsdl2_window_resize(sdl_window_info *window, int width, int height);
201201static void drawsdl2_window_destroy(sdl_window_info *window);
202202static int drawsdl2_window_draw(sdl_window_info *window, UINT32 dc, int update);
203static render_primitive_list &drawsdl2_window_get_primitives(sdl_window_info *window);
203static void drawsdl2_set_target_bounds(sdl_window_info *window);
204204static void drawsdl2_destroy_all_textures(sdl_window_info *window);
205205static void drawsdl2_window_clear(sdl_window_info *window);
206206static int drawsdl2_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
r242697r242698
559559   // fill in the callbacks
560560   window->create = drawsdl2_window_create;
561561   window->resize = drawsdl2_window_resize;
562   window->get_primitives = drawsdl2_window_get_primitives;
562   window->set_target_bounds = drawsdl2_set_target_bounds;
563563   window->draw = drawsdl2_window_draw;
564564   window->destroy = drawsdl2_window_destroy;
565565   window->destroy_all_textures = drawsdl2_destroy_all_textures;
r242697r242698
687687//  drawsdl2_window_get_primitives
688688//============================================================
689689
690static render_primitive_list &drawsdl2_window_get_primitives(sdl_window_info *window)
690static void drawsdl2_set_target_bounds(sdl_window_info *window)
691691{
692   if ((!window->fullscreen()) || (video_config.switchres))
693   {
694      window->blit_surface_size(window->width, window->height);
695   }
696   else
697   {
698      window->blit_surface_size(window->monitor()->center_width, window->monitor()->center_height);
699   }
700692   window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
701   return window->target->get_primitives();
702693}
703694
704695//============================================================
trunk/src/osd/sdl/drawogl.c
r242697r242698
367367static void drawogl_window_resize(sdl_window_info *window, int width, int height);
368368static void drawogl_window_destroy(sdl_window_info *window);
369369static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update);
370static render_primitive_list &drawogl_window_get_primitives(sdl_window_info *window);
370static void drawogl_set_target_bounds(sdl_window_info *window);
371371static void drawogl_destroy_all_textures(sdl_window_info *window);
372372static void drawogl_window_clear(sdl_window_info *window);
373373static int drawogl_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
r242697r242698
454454   // fill in the callbacks
455455   window->create = drawogl_window_create;
456456   window->resize = drawogl_window_resize;
457   window->get_primitives = drawogl_window_get_primitives;
457   window->set_target_bounds = drawogl_set_target_bounds;
458458   window->draw = drawogl_window_draw;
459459   window->destroy = drawogl_window_destroy;
460460   window->destroy_all_textures = drawogl_destroy_all_textures;
r242697r242698
840840//  drawogl_window_get_primitives
841841//============================================================
842842
843static render_primitive_list &drawogl_window_get_primitives(sdl_window_info *window)
843static void drawogl_set_target_bounds(sdl_window_info *window)
844844{
845   if ((!window->fullscreen()) || (video_config.switchres))
846   {
847      window->blit_surface_size(window->width, window->height);
848   }
849   else
850   {
851      window->blit_surface_size(window->monitor()->center_width, window->monitor()->center_height);
852   }
853845   window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
854   return window->target->get_primitives();
855846}
856847
857848//============================================================
trunk/src/osd/sdl/drawsdl.c
r242697r242698
105105static int drawsdl_window_create(sdl_window_info *window, int width, int height);
106106static void drawsdl_window_resize(sdl_window_info *window, int width, int height);
107107static void drawsdl_window_destroy(sdl_window_info *window);
108static render_primitive_list &drawsdl_window_get_primitives(sdl_window_info *window);
108static void drawsdl_set_target_bounds(sdl_window_info *window);
109109static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update);
110110static void drawsdl_destroy_all_textures(sdl_window_info *window);
111111static void drawsdl_window_clear(sdl_window_info *window);
r242697r242698
221221   // fill in the callbacks
222222   window->create = drawsdl_window_create;
223223   window->resize = drawsdl_window_resize;
224   window->get_primitives = drawsdl_window_get_primitives;
224   window->set_target_bounds = drawsdl_set_target_bounds;
225225   window->draw = drawsdl_window_draw;
226226   window->destroy = drawsdl_window_destroy;
227227   window->destroy_all_textures = drawsdl_destroy_all_textures;
r242697r242698
460460
461461         if (!found)
462462         {
463            osd_printf_verbose("window: Scale mode %s not supported!\n", sm->name);
464            window->machine().ui().popup_time(3, "Scale mode %s not supported!", sm->name);
463            fatalerror("window: Scale mode %s not supported!", sm->name);
465464         }
466465      }
467466   }
r242697r242698
618617//  drawsdl_window_get_primitives
619618//============================================================
620619
621static render_primitive_list &drawsdl_window_get_primitives(sdl_window_info *window)
620static void drawsdl_set_target_bounds(sdl_window_info *window)
622621{
623622   sdl_info *sdl = (sdl_info *) window->dxdata;
624623   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
625624
626   if ((!window->fullscreen()) || (video_config.switchres))
627   {
628      window->blit_surface_size(window->width, window->height);
629   }
630   else
631   {
632      window->blit_surface_size(window->monitor()->center_width, window->monitor()->center_height);
633   }
634
635625   if (!sm->is_scale)
636626      window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
637627   else
638628      window->target->set_bounds(sdl->hw_scale_width, sdl->hw_scale_height);
639
640   return window->target->get_primitives();
641629}
642630
643631//============================================================
trunk/src/osd/sdl/sdlwork.c
r242697r242698
687687   // loop until everything is processed
688688   while (true)
689689   {
690      osd_work_item *item;
690      osd_work_item *item = NULL;
691691
692692      bool end_loop = false;
693693
r242697r242698
767767   osd_scalable_lock_release(queue->lock, lockslot);
768768   return has_list_items;
769769}
770#endif // SDLMAME_NOASM
No newline at end of file
770#endif // SDLMAME_NOASM
trunk/src/osd/sdl/window.c
r242697r242698
109109   : m_window(awindow), m_list(NULL), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
110110   {
111111   }
112   worker_param(running_machine &amachine, sdl_window_info *awindow, render_primitive_list *alist)
113   : m_window(awindow), m_list(alist), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
112   worker_param(running_machine &amachine, sdl_window_info *awindow, render_primitive_list &alist)
113   : m_window(awindow), m_list(&alist), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
114114   {
115115   }
116116   worker_param(sdl_window_info *awindow, int anew_width, int anew_height)
r242697r242698
980980
981981      if (osd_event_wait(rendered_event, event_wait_ticks))
982982      {
983          if ((!fullscreen()) || (video_config.switchres))
984          {
985              blit_surface_size(width, height);
986          }
987          else
988          {
989              blit_surface_size(monitor()->center_width, monitor()->center_height);
990          }
991
983992         // ensure the target bounds are up-to-date, and then get the primitives
984         render_primitive_list *primlist = &get_primitives(this);
993          set_target_bounds(this);
985994
995         render_primitive_list &primlist = target->get_primitives();
996
986997         // and redraw now
987998
988999         execute_async(&draw_video_contents_wt, worker_param(machine, this, primlist));
trunk/src/osd/sdl/window.h
r242697r242698
9494   int (*create)(sdl_window_info *window, int width, int height);
9595   void (*resize)(sdl_window_info *window, int width, int height);
9696   int (*draw)(sdl_window_info *window, UINT32 dc, int update);
97   render_primitive_list &(*get_primitives)(sdl_window_info *window);
97   void (*set_target_bounds)(sdl_window_info *window);
9898   int (*xy_to_render_target)(sdl_window_info *window, int x, int y, int *xt, int *yt);
9999   void (*destroy_all_textures)(sdl_window_info *window);
100100   void (*destroy)(sdl_window_info *window);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team