Previous 199869 Revisions Next

r35007 Thursday 12th February, 2015 at 21:10:08 UTC by Couriersud
More code alignment for windows and renderer. (nw)
[src/osd/sdl]draw13.c drawbgfx.c drawogl.c drawsdl.c video.c window.h
[src/osd/windows]drawbgfx.c drawd3d.c drawdd.c drawgdi.c drawnone.c video.c video.h window.c window.h winmain.c

trunk/src/osd/sdl/draw13.c
r243518r243519
163163         m_blitwidth = nw; m_blitheight = nh;
164164         notify_changed();
165165      }
166      window().target()->set_bounds(m_blitwidth, m_blitheight, window().monitor()->aspect());
166      window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
167167      return &window().target()->get_primitives();
168168   }
169169
trunk/src/osd/sdl/drawbgfx.c
r243518r243519
9393         m_blitwidth = nw; m_blitheight = nh;
9494         notify_changed();
9595      }
96      window().target()->set_bounds(m_blitwidth, m_blitheight, window().monitor()->aspect());
96      window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
9797      return &window().target()->get_primitives();
9898   }
9999
trunk/src/osd/sdl/drawogl.c
r243518r243519
265265         m_blitwidth = nw; m_blitheight = nh;
266266         notify_changed();
267267      }
268      window().target()->set_bounds(m_blitwidth, m_blitheight, window().monitor()->aspect());
268      window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
269269      return &window().target()->get_primitives();
270270   }
271271
trunk/src/osd/sdl/drawsdl.c
r243518r243519
8383         m_blitwidth = nw; m_blitheight = nh;
8484         notify_changed();
8585      }
86      window().target()->set_bounds(m_blitwidth, m_blitheight, window().monitor()->aspect());
86      window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
8787      return &window().target()->get_primitives();
8888   }
8989
trunk/src/osd/sdl/video.c
r243518r243519
207207            m_dimensions.h = xineinfo[0].height;
208208
209209            XFree(xineinfo);
210            printf("XineneraActive\n");
211210         }
212211      }
213212      else
trunk/src/osd/sdl/window.h
r243518r243519
4949   :
5050#ifdef OSD_SDL
5151#else
52      m_hwnd(0), m_focus_hwnd(0), m_monitor(NULL), m_resize_state(0),
52      m_hwnd(0), m_focus_hwnd(0), m_resize_state(0),
5353      m_maxwidth(0), m_maxheight(0),
5454      m_refresh(0),
5555#endif
r243518r243519
6464
6565   int prescale() const { return m_prescale; };
6666
67   float aspect() const { return monitor()->aspect(); }
68
6769#ifdef OSD_SDL
6870   virtual void blit_surface_size(int &blitwidth, int &blitheight) = 0;
6971   virtual sdl_monitor_info *monitor() const = 0;
r243518r243519
7476   virtual SDL_Surface *sdl_surface() = 0;
7577#endif
7678#else
79   virtual win_monitor_info *monitor() const = 0;
7780   virtual bool win_has_menu() = 0;
81   // FIXME: cann we replace winwindow_video_window_monitor(NULL) with monitor() ?
7882   virtual win_monitor_info *winwindow_video_window_monitor(const RECT *proposed) = 0;
7983
8084   // window handle and info
r243518r243519
8387   // During modularization, this should be passed in differently
8488   HWND                   m_focus_hwnd;
8589
86   // monitor info
87   win_monitor_info *     m_monitor;
8890   int                    m_resize_state;
8991   int                    m_maxwidth, m_maxheight;
9092   int                    m_refresh;
trunk/src/osd/windows/drawbgfx.c
r243518r243519
124124{
125125   RECT client;
126126   GetClientRect(window().m_hwnd, &client);
127   window().target()->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
127   window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
128128   return &window().target()->get_primitives();
129129}
130130
trunk/src/osd/windows/drawd3d.c
r243518r243519
247247   GetClientRectExceptMenu(window().m_hwnd, &client, window().fullscreen());
248248   if (rect_width(&client) > 0 && rect_height(&client) > 0)
249249   {
250      window().target()->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
250      window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
251251      window().target()->set_max_update_rate((get_refresh() == 0) ? get_origmode().RefreshRate : get_refresh());
252252   }
253253   return &window().target()->get_primitives();
r243518r243519
12201220      // make sure it's a pixel format we can get behind
12211221      if (m_pixformat != D3DFMT_X1R5G5B5 && m_pixformat != D3DFMT_R5G6B5 && m_pixformat != D3DFMT_X8R8G8B8)
12221222      {
1223         char *utf8_device = utf8_from_tstring(window().m_monitor->info.szDevice);
1224         if (utf8_device != NULL)
1225         {
1226            osd_printf_error("Device %s currently in an unsupported mode\n", utf8_device);
1227            osd_free(utf8_device);
1228         }
1223         osd_printf_error("Device %s currently in an unsupported mode\n", window().monitor()->devicename());
12291224         return 1;
12301225      }
12311226   }
r243518r243519
12481243   result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !window().fullscreen());
12491244   if (result != D3D_OK)
12501245   {
1251      char *utf8_device = utf8_from_tstring(window().m_monitor->info.szDevice);
1252      if (utf8_device != NULL)
1253      {
1254         osd_printf_error("Proposed video mode not supported on device %s\n", utf8_device);
1255         osd_free(utf8_device);
1256      }
1246      osd_printf_error("Proposed video mode not supported on device %s\n", window().monitor()->devicename());
12571247      return 1;
12581248   }
12591249   return 0;
r243518r243519
12761266      HMONITOR curmonitor = (*d3dintf->d3d.get_adapter_monitor)(d3dintf, adapternum);
12771267
12781268      // if we match the proposed monitor, this is it
1279      if (curmonitor == window().m_monitor->handle)
1269      if (curmonitor == window().monitor()->handle)
12801270      {
12811271         return adapternum;
12821272      }
trunk/src/osd/windows/drawdd.c
r243518r243519
856856      if (video_config.keepaspect)
857857      {
858858         win_monitor_info *monitor = window().winwindow_video_window_monitor(NULL);
859         window().target()->compute_visible_area(target_width, target_height, monitor->get_aspect(), window().target()->orientation(), target_width, target_height);
859         window().target()->compute_visible_area(target_width, target_height, monitor->aspect(), window().target()->orientation(), target_width, target_height);
860860         desired_aspect = (float)target_width / (float)target_height;
861861      }
862862
r243518r243519
10001000   else if (video_config.keepaspect)
10011001   {
10021002      // compute the appropriate visible area
1003      window().target()->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->get_aspect(), window().target()->orientation(), dstwidth, dstheight);
1003      window().target()->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->aspect(), window().target()->orientation(), dstwidth, dstheight);
10041004   }
10051005
10061006   // center within
r243518r243519
10821082   HRESULT result;
10831083
10841084   // choose the monitor number
1085   get_adapter_for_monitor(window().m_monitor);
1085   get_adapter_for_monitor(window().monitor());
10861086
10871087   // create a temporary DirectDraw object
10881088   result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
trunk/src/osd/windows/drawgdi.c
r243518r243519
133133{
134134   RECT client;
135135   GetClientRect(window().m_hwnd, &client);
136   window().target()->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
136   window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
137137   return &window().target()->get_primitives();
138138}
139139
trunk/src/osd/windows/drawnone.c
r243518r243519
106106{
107107   RECT client;
108108   GetClientRect(window().m_hwnd, &client);
109   window().target()->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
109   window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
110110   return &window().target()->get_primitives();
111111}
112112
trunk/src/osd/windows/video.c
r243518r243519
112112win_monitor_info::win_monitor_info()
113113   : next(NULL),
114114      handle(NULL),
115      aspect(0.0f),
115      m_aspect(0.0f),
116116      reqwidth(0),
117      reqheight(0)
117      reqheight(0),
118      m_name(NULL)
118119{
119120}
120121
121122win_monitor_info::~win_monitor_info()
122123{
124   if (m_name != NULL)
125      osd_free(m_name);
123126}
124127
125128//============================================================
r243518r243519
134137   info.cbSize = sizeof(info);
135138   result = GetMonitorInfo(handle, (LPMONITORINFO)&info);
136139   assert(result);
140   if (m_name != NULL)
141      osd_free(m_name);
142   m_name = utf8_from_tstring(info.szDevice);
137143   (void)result; // to silence gcc 4.6
138144}
139145
r243518r243519
143149//  winvideo_monitor_get_aspect
144150//============================================================
145151
146float win_monitor_info::get_aspect()
152float win_monitor_info::aspect()
147153{
148154   // refresh the monitor information and compute the aspect
149155   if (video_config.keepaspect)
r243518r243519
152158      refresh();
153159      width = rect_width(&info.rcMonitor);
154160      height = rect_height(&info.rcMonitor);
155      return aspect / ((float)width / (float)height);
161      return m_aspect / ((float)width / (float)height);
156162   }
157163   return 0.0f;
158164}
r243518r243519
219225      win_monitor_info *monitor;
220226      for (monitor = win_monitor_list; monitor != NULL; monitor = monitor->next)
221227      {
222         char *utf8_device = utf8_from_tstring(monitor->info.szDevice);
223         if (utf8_device != NULL)
224         {
225            osd_printf_verbose("Video: Monitor %p = \"%s\" %s\n", monitor->handle, utf8_device, (monitor == primary_monitor) ? "(primary)" : "");
226            osd_free(utf8_device);
227         }
228         osd_printf_verbose("Video: Monitor %p = \"%s\" %s\n", monitor->handle, monitor->devicename(), (monitor == primary_monitor) ? "(primary)" : "");
228229      }
229230   }
230231}
r243518r243519
298299   if (scrname[0] != 0)
299300      for (monitor = win_monitor_list; monitor != NULL; monitor = monitor->next)
300301      {
301         char *utf8_device;
302302         int rc = 1;
303303
304304         moncount++;
305305
306         utf8_device = utf8_from_tstring(monitor->info.szDevice);
307         if (utf8_device != NULL)
308         {
309            rc = strcmp(scrname, utf8_device);
310            osd_free(utf8_device);
311         }
306         rc = strcmp(scrname, monitor->devicename());
307
312308         if (rc == 0)
313309            goto finishit;
314310      }
trunk/src/osd/windows/video.h
r243518r243519
3737   virtual ~win_monitor_info();
3838
3939   void refresh();
40   float get_aspect();
41   void set_aspect(float a) { aspect = a; }
40   float aspect();
41   void set_aspect(float a) { m_aspect = a; }
42   const char *devicename() { refresh(); return (m_name != NULL) ? m_name : "UNKNOWN"; }
4243
4344   win_monitor_info  * next;                   // pointer to next monitor in list
4445   HMONITOR            handle;                 // handle to the monitor
4546   MONITORINFOEX       info;                   // most recently retrieved info
4647private:
47   float               aspect;                 // computed/configured aspect ratio of the physical device
48   float               m_aspect;               // computed/configured aspect ratio of the physical device
4849   int                 reqwidth;               // requested width for this monitor
4950   int                 reqheight;              // requested height for this monitor
51   char *             m_name;
5052};
5153
5254
5355struct win_window_config
5456{
55   float               aspect;                     // decoded aspect ratio
57   float               aspect;                     // decoded aspect ratio FIXME:Not used!
5658   int                 width;                      // decoded width
5759   int                 height;                     // decoded height
5860   int                 refresh;                    // decoded refresh
trunk/src/osd/windows/window.c
r243518r243519
302302      m_startmaximized(0),
303303      m_isminimized(0),
304304      m_ismaximized(0),
305      m_monitor(NULL),
305306      m_fullscreen(0),
306307      m_fullscreen_safe(0),
307308      m_aspect(0),
r243518r243519
15211522   assert(GetCurrentThreadId() == window_threadid);
15221523
15231524   // get the pixel aspect ratio for the target monitor
1524   pixel_aspect = monitor->get_aspect();
1525   pixel_aspect = monitor->aspect();
15251526
15261527   // determine the proposed width/height
15271528   propwidth = rect_width(rect) - extrawidth;
trunk/src/osd/windows/window.h
r243518r243519
4848   osd_window()
4949   :
5050#ifdef OSD_SDL
51      m_start_viewscreen(0),
5251#else
53      m_hwnd(0), m_focus_hwnd(0), m_monitor(NULL), m_resize_state(0),
52      m_hwnd(0), m_focus_hwnd(0), m_resize_state(0),
5453      m_maxwidth(0), m_maxheight(0),
5554      m_refresh(0),
5655#endif
r243518r243519
6564
6665   int prescale() const { return m_prescale; };
6766
67   float aspect() const { return monitor()->aspect(); }
68
6869#ifdef OSD_SDL
6970   virtual void blit_surface_size(int &blitwidth, int &blitheight) = 0;
7071   virtual sdl_monitor_info *monitor() const = 0;
r243518r243519
7576   virtual SDL_Surface *sdl_surface() = 0;
7677#endif
7778#else
79   virtual win_monitor_info *monitor() const = 0;
7880   virtual bool win_has_menu() = 0;
81   // FIXME: cann we replace winwindow_video_window_monitor(NULL) with monitor() ?
7982   virtual win_monitor_info *winwindow_video_window_monitor(const RECT *proposed) = 0;
8083
8184   // window handle and info
r243518r243519
8487   // During modularization, this should be passed in differently
8588   HWND                   m_focus_hwnd;
8689
87   // monitor info
88   win_monitor_info *     m_monitor;
8990   int                    m_resize_state;
9091   int                    m_maxwidth, m_maxheight;
9192   int                    m_refresh;
r243518r243519
168169      return GetMenu(m_hwnd) ? true : false;
169170   }
170171
172   win_monitor_info *monitor() const { return m_monitor; }
173
171174   win_window_info *   m_next;
172175   volatile int        m_init_state;
173176
r243518r243519
179182   int                 m_ismaximized;
180183
181184   // monitor info
185   win_monitor_info *  m_monitor;
182186   int                 m_fullscreen;
183187   int                 m_fullscreen_safe;
184188   float               m_aspect;
trunk/src/osd/windows/winmain.c
r243518r243519
590590   astring tempstring;
591591   for (win_window_info *info = win_window_list; info != NULL; info = info->m_next)
592592   {
593      char *tmp = utf8_from_tstring(info->m_monitor->info.szDevice);
594      tempstring.printf("Orientation(%s)", tmp);
593      tempstring.printf("Orientation(%s)", info->m_monitor->devicename());
595594      output_set_value(tempstring, info->m_targetorient);
596      osd_free(tmp);
597595   }
598596
599597   // hook up the debugger log


Previous 199869 Revisions Next


© 1997-2024 The MAME Team