Previous 199869 Revisions Next

r36053 Sunday 22nd February, 2015 at 15:39:25 UTC by Couriersud
More alignment of code:
- HDC is passed differently to gdi renderer (the only one using it).
- Merged sdl_window_config and win_window_config into osd_window_config.
- Use osd_window_config instead of replicating individual member
variables in osd_window.
[/branches/kale/src/osd/sdl]draw13.c drawogl.c drawsdl.c video.c video.h window.c window.h
[/branches/kale/src/osd/windows]drawbgfx.c drawd3d.c drawd3d.h drawdd.c drawgdi.c drawnone.c video.c video.h window.c window.h winmenu.c

branches/kale/src/osd/sdl/draw13.c
r244564r244565
151151    {}
152152
153153   /* virtual */ int create();
154   /* virtual */ int draw(const UINT32 dc, const int update);
154   /* virtual */ int draw(const int update);
155155   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
156156   /* virtual */ void destroy();
157157   /* virtual */ render_primitive_list *get_primitives()
r244564r244565
677677//  sdl_info::draw
678678//============================================================
679679
680int sdl_info13::draw(UINT32 dc, int update)
680int sdl_info13::draw(int update)
681681{
682682   render_primitive *prim;
683683   texture_info *texture=NULL;
branches/kale/src/osd/sdl/drawogl.c
r244564r244565
290290   }
291291
292292   /* virtual */ int create();
293#ifdef OSD_WINDOWS
294   /* virtual */ int draw(const HDC dc, const int update);
295#else
296   /* virtual */ int draw(const UINT32 dc, const int update);
297#endif
293   /* virtual */ int draw(const int update);
294
298295   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
299296   /* virtual */ void destroy();
300297   /* virtual */ render_primitive_list *get_primitives()
r244564r244565
13271324//  sdl_info::draw
13281325//============================================================
13291326
1330#ifdef OSD_WINDOWS
1331int sdl_info_ogl::draw(const HDC dc, const int update)
1332#else
1333int sdl_info_ogl::draw(const UINT32 dc, const int update)
1334#endif
1327int sdl_info_ogl::draw(const int update)
13351328{
13361329   render_primitive *prim;
13371330   texture_info *texture=NULL;
branches/kale/src/osd/sdl/drawsdl.c
r244564r244565
7171   { }
7272
7373   /* virtual */ int create();
74   /* virtual */ int draw(const UINT32 dc, const int update);
74   /* virtual */ int draw(const int update);
7575   /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
7676   /* virtual */ void destroy();
7777   /* virtual */ render_primitive_list *get_primitives()
r244564r244565
555555//  sdl_info::draw
556556//============================================================
557557
558int sdl_info::draw(UINT32 dc, int update)
558int sdl_info::draw(int update)
559559{
560560   const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
561561   UINT8 *surfptr;
branches/kale/src/osd/sdl/video.c
r244564r244565
8383static void check_osd_inputs(running_machine &machine);
8484
8585static float get_aspect(const char *defdata, const char *data, int report_error);
86static void get_resolution(const char *defdata, const char *data, sdl_window_config *config, int report_error);
86static void get_resolution(const char *defdata, const char *data, osd_window_config *config, int report_error);
8787
8888
8989//============================================================
r244564r244565
110110   // create the windows
111111   for (index = 0; index < video_config.numscreens; index++)
112112   {
113      sdl_window_config conf;
113      osd_window_config conf;
114114      memset(&conf, 0, sizeof(conf));
115115      get_resolution(options().resolution(), options().resolution(index), &conf, TRUE);
116116
r244564r244565
215215         static int first_call=0;
216216         static int cw = 0, ch = 0;
217217
218         SDL_VideoDriverName(m_monitor_device, ARRAY_LENGTH(m_name) - 1);
218         SDL_VideoDriverName(m_name, ARRAY_LENGTH(m_name) - 1);
219219         if (first_call==0)
220220         {
221221            const char *dimstr = osd_getenv(SDLENV_DESKTOPDIM);
r244564r244565
779779//  get_resolution
780780//============================================================
781781
782static void get_resolution(const char *defdata, const char *data, sdl_window_config *config, int report_error)
782static void get_resolution(const char *defdata, const char *data, osd_window_config *config, int report_error)
783783{
784784   config->width = config->height = config->depth = config->refresh = 0;
785785   if (strcmp(data, OSDOPTVAL_AUTO) == 0)
branches/kale/src/osd/sdl/video.h
r244564r244565
108108};
109109
110110
111struct sdl_window_config
111struct osd_window_config
112112{
113   float               aspect;                     // decoded aspect ratio
113   osd_window_config() : aspect(0.0f), width(0), height(0), depth(0), refresh(0) {}
114
115   float               aspect;                     // decoded aspect ratio FIXME: not used on windows
114116   int                 width;                      // decoded width
115117   int                 height;                     // decoded height
116   int                 depth;                      // decoded depth
118   int                 depth;                      // decoded depth - only SDL
117119   int                 refresh;                    // decoded refresh
118120};
119121
branches/kale/src/osd/sdl/window.c
r244564r244565
894894            size_score *= 0.1f;
895895
896896         // if we're looking for a particular mode, that's a winner
897         if (mode.w == m_maxwidth && mode.h == m_maxheight)
897         if (mode.w == m_win_config.width && mode.h == m_win_config.height)
898898            size_score = 2.0f;
899899
900900         // refresh adds some points
901         if (m_refresh)
902            size_score *= 1.0f / (1.0f + fabsf(m_refresh - mode.refresh_rate) / 10.0f);
901         if (m_win_config.refresh)
902            size_score *= 1.0f / (1.0f + fabsf(m_win_config.refresh - mode.refresh_rate) / 10.0f);
903903
904904         osd_printf_verbose("%4dx%4d@%2d -> %f\n", (int)mode.w, (int)mode.h, (int) mode.refresh_rate, size_score);
905905
r244564r244565
953953   }
954954   else if (modes == (SDL_Rect **)-1)  // all modes are possible
955955   {
956      *fswidth = m_maxwidth;
957      *fsheight = m_maxheight;
956      *fswidth = m_win_config.width;
957      *fsheight = m_win_config.height;
958958   }
959959   else
960960   {
r244564r244565
972972            size_score *= 0.1f;
973973
974974         // if we're looking for a particular mode, that's a winner
975         if (modes[i]->w == m_maxwidth && modes[i]->h == m_maxheight)
975         if (modes[i]->w == m_win_config.width && modes[i]->h == m_win_config.height)
976976            size_score = 2.0f;
977977
978978         osd_printf_verbose("%4dx%4d -> %f\n", (int)modes[i]->w, (int)modes[i]->h, size_score);
r244564r244565
11201120            instead of letting sdlwindow_blit_surface_size() resize it
11211121            this stops the window from "flashing" from the wrong aspect
11221122            size to the right one at startup. */
1123         tempwidth = (window->m_maxwidth != 0) ? window->m_maxwidth : 640;
1124         tempheight = (window->m_maxheight != 0) ? window->m_maxheight : 480;
1123         tempwidth = (window->m_win_config.width != 0) ? window->m_win_config.width : 640;
1124         tempheight = (window->m_win_config.height != 0) ? window->m_win_config.height : 480;
11251125
11261126         window->get_min_bounds(&tempwidth, &tempheight, video_config.keepaspect );
11271127      }
r244564r244565
11871187      window->m_original_mode = mode;
11881188      mode.w = tempwidth;
11891189      mode.h = tempheight;
1190      if (window->m_refresh)
1191         mode.refresh_rate = window->m_refresh;
1190      if (window->m_win_config.refresh)
1191         mode.refresh_rate = window->m_win_config.refresh;
11921192
11931193      SDL_SetWindowDisplayMode(window->sdl_window(), &mode);    // Try to set mode
11941194#ifndef SDLMAME_WIN32
r244564r244565
12661266//  (window thread)
12671267//============================================================
12681268
1269void sdl_window_info::measure_fps(UINT32 dc, int update)
1269void sdl_window_info::measure_fps(int update)
12701270{
12711271   const unsigned long frames_skip4fps = 100;
12721272   static int64_t lastTime=0, sumdt=0, startTime=0;
r244564r244565
12811281
12821282   t0 = osd_ticks();
12831283
1284   renderer().draw(dc, update);
1284   renderer().draw(update);
12851285
12861286   frames++;
12871287   currentTime = osd_ticks();
r244564r244565
13101310
13111311OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt )
13121312{
1313   UINT32  dc =        0;
13141313   int     update =    1;
13151314   worker_param *wp = (worker_param *) param;
13161315   sdl_window_info *window = wp->window();
r244564r244565
13571356   else
13581357   {
13591358      if( video_config.perftest )
1360         window->measure_fps(dc, update);
1359         window->measure_fps(update);
13611360      else
1362         window->renderer().draw(dc, update);
1361         window->renderer().draw(update);
13631362   }
13641363
13651364   /* all done, ready for next */
r244564r244565
14321431   else
14331432   {
14341433      // further clamp to the maximum width/height in the window
1435      if (this->m_maxwidth != 0)
1436         maxwidth = MIN(maxwidth, this->m_maxwidth + extrawidth);
1437      if (this->m_maxheight != 0)
1438         maxheight = MIN(maxheight, this->m_maxheight + extraheight);
1434      if (this->m_win_config.width != 0)
1435         maxwidth = MIN(maxwidth, this->m_win_config.width + extrawidth);
1436      if (this->m_win_config.height != 0)
1437         maxheight = MIN(maxheight, this->m_win_config.height + extraheight);
14391438   }
14401439
14411440   // clamp to the maximum
r244564r244565
15141513   maxheight = m_monitor->position_size().h;
15151514
15161515   // clamp to the window's max
1517   if (this->m_maxwidth != 0)
1516   if (this->m_win_config.width != 0)
15181517   {
1519      int temp = this->m_maxwidth + WINDOW_DECORATION_WIDTH;
1518      int temp = this->m_win_config.width + WINDOW_DECORATION_WIDTH;
15201519      if (temp < maxwidth)
15211520         maxwidth = temp;
15221521   }
1523   if (this->m_maxheight != 0)
1522   if (this->m_win_config.height != 0)
15241523   {
1525      int temp = this->m_maxheight + WINDOW_DECORATION_HEIGHT;
1524      int temp = this->m_win_config.height + WINDOW_DECORATION_HEIGHT;
15261525      if (temp < maxheight)
15271526         maxheight = temp;
15281527   }
branches/kale/src/osd/sdl/window.h
r244564r244565
4949   :
5050#ifdef OSD_SDL
5151#else
52      m_hwnd(0), m_focus_hwnd(0), m_resize_state(0),
53      m_maxwidth(0), m_maxheight(0),
54      m_refresh(0),
52      m_hwnd(0), m_dc(0), m_focus_hwnd(0), m_resize_state(0),
5553#endif
5654      m_prescale(1),
5755      m_primlist(NULL)
r244564r244565
8482
8583   // window handle and info
8684   HWND               m_hwnd;
85   HDC                  m_dc;      // only used by GDI renderer!
8786   // FIXME: this is the same as win_window_list->m_hwnd, i.e. first window.
8887   // During modularization, this should be passed in differently
8988   HWND                   m_focus_hwnd;
9089
9190   int                    m_resize_state;
92   int                    m_maxwidth, m_maxheight;
93   int                    m_refresh;
9491#endif
9592
93   osd_window_config      m_win_config;
9694   int                  m_prescale;
9795   render_primitive_list    *m_primlist;
9896};
r244564r244565
106104   static const int FLAG_NEEDS_OPENGL          = 0x0001;
107105   static const int FLAG_HAS_VECTOR_SCREEN      = 0x0002;
108106
109#if (!(SDLMAME_SDL2))
110107   /* SDL 1.2 flags */
111108   static const int FLAG_NEEDS_DOUBLEBUF       = 0x0100;
112109   static const int FLAG_NEEDS_ASYNCBLIT       = 0x0200;
113#endif
114110
115111   osd_renderer(osd_window *window, const int flags)
116112   : m_window(window), m_flags(flags) { }
r244564r244565
130126   virtual int create() = 0;
131127   virtual render_primitive_list *get_primitives() = 0;
132128
129   virtual int draw(const int update) = 0;
133130#ifdef OSD_SDL
134   virtual int draw(const UINT32 dc, const int update) = 0;
135131   virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0;
136132#else
137   virtual int draw(HDC dc, int update) = 0;
138133   virtual void save() = 0;
139134   virtual void record() = 0;
140135   virtual void toggle_fsfx() = 0;
r244564r244565
158153{
159154public:
160155   sdl_window_info(running_machine &a_machine, int index, sdl_monitor_info *a_monitor,
161         const sdl_window_config *config)
156         const osd_window_config *config)
162157   : osd_window(), m_next(NULL),
163158      // Following three are used by input code to defer resizes
164159#if (SDLMAME_SDL2)
r244564r244565
176171#endif
177172      m_machine(a_machine), m_monitor(a_monitor), m_fullscreen(0), m_index(0)
178173   {
179      m_maxwidth = config->width;
180      m_maxheight = config->height;
181      m_depth = config->depth;
182      m_refresh = config->refresh;
174      m_win_config = *config;
183175      m_index = index;
184176
185177      //FIXME: these should be per_window in config-> or even better a bit set
r244564r244565
247239
248240   // diverse flags
249241   int                 m_minwidth, m_minheight;
250   int                 m_maxwidth, m_maxheight;
251   int                 m_refresh;
252   int                 m_depth;
253242   int                 m_windowed_width;
254243   int                 m_windowed_height;
255244
r244564r244565
303292   static OSDWORK_CALLBACK( notify_changed_wt );
304293   static OSDWORK_CALLBACK( update_cursor_state_wt );
305294
306   void measure_fps(UINT32 dc, int update);
295   void measure_fps(int update);
307296
308297};
309298
branches/kale/src/osd/windows/drawbgfx.c
r244564r244565
3232
3333   virtual int create();
3434   virtual render_primitive_list *get_primitives();
35   virtual int draw(HDC dc, int update);
35   virtual int draw(int update);
3636   virtual void save() {};
3737   virtual void record() {};
3838   virtual void toggle_fsfx() {};
r244564r244565
134134//  drawbgfx_window_draw
135135//============================================================
136136
137int renderer_bgfx::draw(HDC dc, int update)
137int renderer_bgfx::draw(int update)
138138{
139139   RECT client;
140140   GetClientRect(window().m_hwnd, &client);
branches/kale/src/osd/windows/drawd3d.c
r244564r244565
287287//  drawd3d_window_draw
288288//============================================================
289289
290int d3d::renderer::draw(HDC dc, int update)
290int d3d::renderer::draw(const int update)
291291{
292292   int check = pre_window_draw_check();
293293   if (check >= 0)
r244564r244565
13341334         size_score *= 0.1f;
13351335
13361336      // if we're looking for a particular mode, that's a winner
1337      if (mode.Width == window().m_maxwidth && mode.Height == window().m_maxheight)
1337      if (mode.Width == window().m_win_config.width && mode.Height == window().m_win_config.height)
13381338         size_score = 2.0f;
13391339
13401340      // compute refresh score
r244564r244565
13451345         refresh_score *= 0.1f;
13461346
13471347      // if we're looking for a particular refresh, make sure it matches
1348      if (mode.RefreshRate == window().m_refresh)
1348      if (mode.RefreshRate == window().m_win_config.refresh)
13491349         refresh_score = 2.0f;
13501350
13511351      // weight size and refresh equally
branches/kale/src/osd/windows/drawd3d.h
r244564r244565
104104
105105   virtual int create();
106106   virtual render_primitive_list *get_primitives();
107   virtual int draw(HDC dc, int update);
107   virtual int draw(const int update);
108108   virtual void save();
109109   virtual void record();
110110   virtual void toggle_fsfx();
branches/kale/src/osd/windows/drawdd.c
r244564r244565
6565
6666   virtual int create();
6767   virtual render_primitive_list *get_primitives();
68   virtual int draw(HDC dc, int update);
68   virtual int draw(const int update);
6969   virtual void save() {};
7070   virtual void record() {};
7171   virtual void toggle_fsfx() {};
r244564r244565
310310//  drawdd_window_draw
311311//============================================================
312312
313int renderer_dd::draw(HDC dc, int update)
313int renderer_dd::draw(const int update)
314314{
315315   render_primitive *prim;
316316   int usemembuffer = FALSE;
r244564r244565
12261226      size_score *= 0.1f;
12271227
12281228   // if we're looking for a particular mode, that's a winner
1229   if (desc->dwWidth == einfo->window->m_maxwidth && desc->dwHeight == einfo->window->m_maxheight)
1229   if (desc->dwWidth == einfo->window->m_win_config.width && desc->dwHeight == einfo->window->m_win_config.height)
12301230      size_score = 2.0f;
12311231
12321232   // compute refresh score
r244564r244565
12371237      refresh_score *= 0.1f;
12381238
12391239   // if we're looking for a particular refresh, make sure it matches
1240   if (desc->dwRefreshRate == einfo->window->m_refresh)
1240   if (desc->dwRefreshRate == einfo->window->m_win_config.refresh)
12411241      refresh_score = 2.0f;
12421242
12431243   // weight size and refresh equally
branches/kale/src/osd/windows/drawgdi.c
r244564r244565
3232
3333   virtual int create();
3434   virtual render_primitive_list *get_primitives();
35   virtual int draw(HDC dc, int update);
35   virtual int draw(const int update);
3636   virtual void save() {};
3737   virtual void record() {};
3838   virtual void toggle_fsfx() {};
r244564r244565
143143//  drawgdi_window_draw
144144//============================================================
145145
146int renderer_gdi::draw(HDC dc, int update)
146int renderer_gdi::draw(const int update)
147147{
148148   int width, height, pitch;
149149   RECT bounds;
r244564r244565
178178   bminfo.bmiHeader.biHeight = -height;
179179
180180   // blit to the screen
181   StretchDIBits(dc, 0, 0, width, height,
181   StretchDIBits(window().m_dc, 0, 0, width, height,
182182            0, 0, width, height,
183183            bmdata, &bminfo, DIB_RGB_COLORS, SRCCOPY);
184184   return 0;
branches/kale/src/osd/windows/drawnone.c
r244564r244565
2727
2828   virtual int create();
2929   virtual render_primitive_list *get_primitives();
30   virtual int draw(HDC dc, int update);
30   virtual int draw(const int update);
3131   virtual void save() { };
3232   virtual void record() { };
3333   virtual void toggle_fsfx() { };
r244564r244565
116116//  drawnone_window_draw
117117//============================================================
118118
119int renderer_none::draw(HDC dc, int update)
119int renderer_none::draw(const int update)
120120{
121121   return 0;
122122}
branches/kale/src/osd/windows/video.c
r244564r244565
5656static void check_osd_inputs(running_machine &machine);
5757
5858static float get_aspect(const char *defdata, const char *data, int report_error);
59static void get_resolution(const char *defdata, const char *data, win_window_config *config, int report_error);
59static void get_resolution(const char *defdata, const char *data, osd_window_config *config, int report_error);
6060
6161
6262
r244564r244565
443443//  get_resolution
444444//============================================================
445445
446static void get_resolution(const char *defdata, const char *data, win_window_config *config, int report_error)
446static void get_resolution(const char *defdata, const char *data, osd_window_config *config, int report_error)
447447{
448448   config->width = config->height = config->refresh = 0;
449449   if (strcmp(data, OSDOPTVAL_AUTO) == 0)
branches/kale/src/osd/windows/video.h
r244564r244565
6868};
6969
7070
71struct win_window_config
71struct osd_window_config
7272{
73   float               aspect;                     // decoded aspect ratio FIXME:Not used!
73   osd_window_config() : aspect(0.0f), width(0), height(0), depth(0), refresh(0) {}
74
75   float               aspect;                     // decoded aspect ratio FIXME: not used on windows
7476   int                 width;                      // decoded width
7577   int                 height;                     // decoded height
78   int                 depth;                      // decoded depth - only SDL
7679   int                 refresh;                    // decoded refresh
7780};
7881
r244564r244565
8790   render_layer_config layerconfig;                // default configuration of layers
8891
8992   // per-window configuration
90   win_window_config   window[MAX_WINDOWS];        // configuration data per-window
93   osd_window_config   window[MAX_WINDOWS];        // configuration data per-window
9194
9295   // hardware options
9396   int                 mode;                       // output mode
branches/kale/src/osd/windows/window.c
r244564r244565
121121//============================================================
122122
123123static void winwindow_video_window_destroy(win_window_info *window);
124static void draw_video_contents(win_window_info *window, HDC dc, int update);
125124
126125static unsigned __stdcall thread_entry(void *param);
127126static int complete_create(win_window_info *window);
r244564r244565
660659//  (main thread)
661660//============================================================
662661
663void winwindow_video_window_create(running_machine &machine, int index, win_monitor_info *monitor, const win_window_config *config)
662void winwindow_video_window_create(running_machine &machine, int index, win_monitor_info *monitor, const osd_window_config *config)
664663{
665664   win_window_info *window, *win;
666665
r244564r244565
669668   // allocate a new window object
670669   window = global_alloc(win_window_info(machine));
671670   //printf("%d, %d\n", config->width, config->height);
672   window->m_maxwidth = config->width;
673   window->m_maxheight = config->height;
674   window->m_refresh = config->refresh;
671   window->m_win_config = *config;
675672   window->m_monitor = monitor;
676673   window->m_fullscreen = !video_config.windowed;
677674
r244564r244565
12131210      return 0;
12141211
12151212   // adjust the window position to the initial width/height
1216   tempwidth = (window->m_maxwidth != 0) ? window->m_maxwidth : 640;
1217   tempheight = (window->m_maxheight != 0) ? window->m_maxheight : 480;
1213   tempwidth = (window->m_win_config.width != 0) ? window->m_win_config.width : 640;
1214   tempheight = (window->m_win_config.height != 0) ? window->m_win_config.height : 480;
12181215   SetWindowPos(window->m_hwnd, NULL, monitorbounds.left + 20, monitorbounds.top + 20,
12191216         monitorbounds.left + tempwidth + wnd_extra_width(window),
12201217         monitorbounds.top + tempheight + wnd_extra_height(window),
r244564r244565
12521249//  (window thread)
12531250//============================================================
12541251
1255LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
1252LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
12561253{
12571254   LONG_PTR ptr = GetWindowLongPtr(wnd, GWLP_USERDATA);
12581255   win_window_info *window = (win_window_info *)ptr;
r244564r244565
12721269      {
12731270         PAINTSTRUCT pstruct;
12741271         HDC hdc = BeginPaint(wnd, &pstruct);
1275         draw_video_contents(window, hdc, TRUE);
1272         window->draw_video_contents(hdc, TRUE);
12761273         if (window->win_has_menu())
12771274            DrawMenuBar(window->m_hwnd);
12781275         EndPaint(wnd, &pstruct);
r244564r244565
14211418
14221419         mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW begin");
14231420         window->m_primlist = (render_primitive_list *)lparam;
1424         draw_video_contents(window, hdc, FALSE);
1421         window->draw_video_contents(hdc, FALSE);
14251422         mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW end");
14261423
14271424         ReleaseDC(wnd, hdc);
r244564r244565
14701467//  (window thread)
14711468//============================================================
14721469
1473static void draw_video_contents(win_window_info *window, HDC dc, int update)
1470void win_window_info::draw_video_contents(HDC dc, int update)
14741471{
14751472   assert(GetCurrentThreadId() == window_threadid);
14761473
14771474   mtlog_add("draw_video_contents: begin");
14781475
14791476   mtlog_add("draw_video_contents: render lock acquire");
1480   osd_lock_acquire(window->m_render_lock);
1477   osd_lock_acquire(m_render_lock);
14811478   mtlog_add("draw_video_contents: render lock acquired");
14821479
14831480   // if we're iconic, don't bother
1484   if (window->m_hwnd != NULL && !IsIconic(window->m_hwnd))
1481   if (m_hwnd != NULL && !IsIconic(m_hwnd))
14851482   {
14861483      // if no bitmap, just fill
1487      if (window->m_primlist == NULL)
1484      if (m_primlist == NULL)
14881485      {
14891486         RECT fill;
1490         GetClientRect(window->m_hwnd, &fill);
1487         GetClientRect(m_hwnd, &fill);
14911488         FillRect(dc, &fill, (HBRUSH)GetStockObject(BLACK_BRUSH));
14921489      }
14931490
14941491      // otherwise, render with our drawing system
14951492      else
14961493      {
1497         window->m_renderer->draw(dc, update);
1494         // update DC
1495         m_dc = dc;
1496         m_renderer->draw(update);
14981497         mtlog_add("draw_video_contents: drawing finished");
14991498      }
15001499   }
15011500
1502   osd_lock_release(window->m_render_lock);
1501   osd_lock_release(m_render_lock);
15031502   mtlog_add("draw_video_contents: render lock released");
15041503
15051504   mtlog_add("draw_video_contents: end");
r244564r244565
15751574      maxheight = rect_height(&monitor->usuable_position_size()) - extraheight;
15761575
15771576      // further clamp to the maximum width/height in the window
1578      if (window->m_maxwidth != 0)
1579         maxwidth = MIN(maxwidth, window->m_maxwidth + extrawidth);
1580      if (window->m_maxheight != 0)
1581         maxheight = MIN(maxheight, window->m_maxheight + extraheight);
1577      if (window->m_win_config.width != 0)
1578         maxwidth = MIN(maxwidth, window->m_win_config.width + extrawidth);
1579      if (window->m_win_config.height != 0)
1580         maxheight = MIN(maxheight, window->m_win_config.height + extraheight);
15821581   }
15831582
15841583   // clamp to the maximum
r244564r244565
17031702   maximum = window->m_monitor->usuable_position_size();
17041703
17051704   // clamp to the window's max
1706   if (window->m_maxwidth != 0)
1705   if (window->m_win_config.width != 0)
17071706   {
1708      int temp = window->m_maxwidth + wnd_extra_width(window);
1707      int temp = window->m_win_config.width + wnd_extra_width(window);
17091708      if (temp < rect_width(&maximum))
17101709         maximum.right = maximum.left + temp;
17111710   }
1712   if (window->m_maxheight != 0)
1711   if (window->m_win_config.height != 0)
17131712   {
1714      int temp = window->m_maxheight + wnd_extra_height(window);
1713      int temp = window->m_win_config.height + wnd_extra_height(window);
17151714      if (temp < rect_height(&maximum))
17161715         maximum.bottom = maximum.top + temp;
17171716   }
branches/kale/src/osd/windows/window.h
r244564r244565
4949   :
5050#ifdef OSD_SDL
5151#else
52      m_hwnd(0), m_focus_hwnd(0), m_resize_state(0),
53      m_maxwidth(0), m_maxheight(0),
54      m_refresh(0),
52      m_hwnd(0), m_dc(0), m_focus_hwnd(0), m_resize_state(0),
5553#endif
5654      m_prescale(1),
5755      m_primlist(NULL)
r244564r244565
8482
8583   // window handle and info
8684   HWND               m_hwnd;
85   HDC                  m_dc;      // only used by GDI renderer!
8786   // FIXME: this is the same as win_window_list->m_hwnd, i.e. first window.
8887   // During modularization, this should be passed in differently
8988   HWND                   m_focus_hwnd;
9089
9190   int                    m_resize_state;
92   int                    m_maxwidth, m_maxheight;
93   int                    m_refresh;
9491#endif
9592
93   osd_window_config      m_win_config;
9694   int                  m_prescale;
9795   render_primitive_list *   m_primlist;
9896};
r244564r244565
128126   virtual int create() = 0;
129127   virtual render_primitive_list *get_primitives() = 0;
130128
129   virtual int draw(const int update) = 0;
131130#ifdef OSD_SDL
132   virtual int draw(const UINT32 dc, const int update) = 0;
133131   virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0;
134132#else
135   virtual int draw(HDC dc, int update) = 0;
136133   virtual void save() = 0;
137134   virtual void record() = 0;
138135   virtual void toggle_fsfx() = 0;
r244564r244565
180177
181178   win_monitor_info *monitor() const { return m_monitor; }
182179
180   // static callbacks
181
182   static LRESULT CALLBACK video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
183
184   // member variables
185
183186   win_window_info *   m_next;
184187   volatile int        m_init_state;
185188
r244564r244565
212215   osd_renderer *      m_renderer;
213216
214217private:
218   void draw_video_contents(HDC dc, int update);
219
215220   running_machine &   m_machine;
216221};
217222
r244564r244565
237242//============================================================
238243
239244// creation/deletion of windows
240void winwindow_video_window_create(running_machine &machine, int index, win_monitor_info *monitor, const win_window_config *config);
245void winwindow_video_window_create(running_machine &machine, int index, win_monitor_info *monitor, const osd_window_config *config);
241246
242247BOOL winwindow_has_focus(void);
243248void winwindow_update_cursor_state(running_machine &machine);
244249
245LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
246250extern LRESULT CALLBACK winwindow_video_window_proc_ui(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
247251
248252void winwindow_toggle_full_screen(void);
branches/kale/src/osd/windows/winmenu.c
r244564r244565
2121
2222LRESULT CALLBACK winwindow_video_window_proc_ui(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
2323{
24   return winwindow_video_window_proc(wnd, message, wparam, lparam);
24   return win_window_info::video_window_proc(wnd, message, wparam, lparam);
2525}
2626
2727//============================================================


Previous 199869 Revisions Next


© 1997-2024 The MAME Team