ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/video_vosf.h
(Generate patch)

Comparing BasiliskII/src/Unix/video_vosf.h (file contents):
Revision 1.29 by gbeauche, 2001-07-14T18:41:01Z vs.
Revision 1.31 by cebix, 2002-04-25T11:00:31Z

# Line 1 | Line 1
1   /*
2   *  video_vosf.h - Video/graphics emulation, video on SEGV signals support
3   *
4 < *  Basilisk II (C) 1997-2001 Christian Bauer
4 > *  Basilisk II (C) 1997-2002 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 163 | Line 163 | static uint32 page_extend(uint32 size)
163  
164   static bool screen_fault_handler(sigsegv_address_t fault_address, sigsegv_address_t fault_instruction);
165  
166 < static bool video_vosf_init(void)
166 > static bool video_vosf_init(X11_monitor_desc &monitor)
167   {
168 +        const video_mode &mode = monitor.get_current_mode();
169 +
170          const uintptr page_size = getpagesize();
171          const uintptr page_mask = page_size - 1;
172          
# Line 196 | Line 198 | static bool video_vosf_init(void)
198          
199          uint32 a = 0;
200          for (unsigned i = 0; i < mainBuffer.pageCount; i++) {
201 <                unsigned y1 = a / VideoMonitor.mode.bytes_per_row;
202 <                if (y1 >= VideoMonitor.mode.y)
203 <                        y1 = VideoMonitor.mode.y - 1;
204 <
205 <                unsigned y2 = (a + mainBuffer.pageSize) / VideoMonitor.mode.bytes_per_row;
206 <                if (y2 >= VideoMonitor.mode.y)
207 <                        y2 = VideoMonitor.mode.y - 1;
201 >                unsigned y1 = a / mode.bytes_per_row;
202 >                if (y1 >= mode.y)
203 >                        y1 = mode.y - 1;
204 >
205 >                unsigned y2 = (a + mainBuffer.pageSize) / mode.bytes_per_row;
206 >                if (y2 >= mode.y)
207 >                        y2 = mode.y - 1;
208  
209                  mainBuffer.pageInfo[i].top = y1;
210                  mainBuffer.pageInfo[i].bottom = y2;
# Line 330 | Line 332 | There are two cases to check:
332  
333   static inline void update_display_window_vosf(driver_window *drv)
334   {
335 +        const video_mode &mode = drv->monitor.get_current_mode();
336 +
337          int page = 0;
338          for (;;) {
339                  const unsigned first_page = find_next_page_set(page);
# Line 349 | Line 353 | static inline void update_display_window
353                  const int y2 = mainBuffer.pageInfo[page - 1].bottom;
354                  const int height = y2 - y1 + 1;
355                  
356 <                if (VideoMonitor.mode.depth < VDEPTH_8BIT) {
356 >                if (mode.depth < VDEPTH_8BIT) {
357  
358                          // Update the_host_buffer and copy of the_buffer
359 <                        const int src_bytes_per_row = VideoMonitor.mode.bytes_per_row;
359 >                        const int src_bytes_per_row = mode.bytes_per_row;
360                          const int dst_bytes_per_row = drv->img->bytes_per_line;
361 <                        const int pixels_per_byte = VideoMonitor.mode.x / src_bytes_per_row;
361 >                        const int pixels_per_byte = mode.x / src_bytes_per_row;
362                          int i1 = y1 * src_bytes_per_row, i2 = y1 * dst_bytes_per_row, j;
363                          for (j = y1; j <= y2; j++) {
364 <                                Screen_blit(the_host_buffer + i2, the_buffer + i1, VideoMonitor.mode.x / pixels_per_byte);
364 >                                Screen_blit(the_host_buffer + i2, the_buffer + i1, mode.x / pixels_per_byte);
365                                  i1 += src_bytes_per_row;
366                                  i2 += dst_bytes_per_row;
367                          }
# Line 365 | Line 369 | static inline void update_display_window
369                  } else {
370  
371                          // Update the_host_buffer and copy of the_buffer
372 <                        const int src_bytes_per_row = VideoMonitor.mode.bytes_per_row;
372 >                        const int src_bytes_per_row = mode.bytes_per_row;
373                          const int dst_bytes_per_row = drv->img->bytes_per_line;
374 <                        const int bytes_per_pixel = src_bytes_per_row / VideoMonitor.mode.x;
374 >                        const int bytes_per_pixel = src_bytes_per_row / mode.x;
375                          int i1 = y1 * src_bytes_per_row, i2 = y1 * dst_bytes_per_row, j;
376                          for (j = y1; j <= y2; j++) {
377 <                                Screen_blit(the_host_buffer + i2, the_buffer + i1, bytes_per_pixel * VideoMonitor.mode.x);
377 >                                Screen_blit(the_host_buffer + i2, the_buffer + i1, bytes_per_pixel * mode.x);
378                                  i1 += src_bytes_per_row;
379                                  i2 += dst_bytes_per_row;
380                          }
381                  }
382  
383                  if (drv->have_shm)
384 <                        XShmPutImage(x_display, drv->w, drv->gc, drv->img, 0, y1, 0, y1, VideoMonitor.mode.x, height, 0);
384 >                        XShmPutImage(x_display, drv->w, drv->gc, drv->img, 0, y1, 0, y1, mode.x, height, 0);
385                  else
386 <                        XPutImage(x_display, drv->w, drv->gc, drv->img, 0, y1, 0, y1, VideoMonitor.mode.x, height);
386 >                        XPutImage(x_display, drv->w, drv->gc, drv->img, 0, y1, 0, y1, mode.x, height);
387          }
388          mainBuffer.dirty = false;
389   }
# Line 393 | Line 397 | static inline void update_display_window
397   #if REAL_ADDRESSING || DIRECT_ADDRESSING
398   static inline void update_display_dga_vosf(void)
399   {
400 +        const video_mode &mode = drv->monitor.get_current_mode();
401 +
402          int page = 0;
403          for (;;) {
404                  const unsigned first_page = find_next_page_set(page);
# Line 411 | Line 417 | static inline void update_display_dga_vo
417                  const int y1 = mainBuffer.pageInfo[first_page].top;
418                  const int y2 = mainBuffer.pageInfo[page - 1].bottom;
419                  
420 <                const int bytes_per_row = VideoMonitor.mode.bytes_per_row;
421 <                const int bytes_per_pixel = VideoMonitor.mode.bytes_per_row / VideoMonitor.mode.x;
420 >                const int bytes_per_row = mode.bytes_per_row;
421 >                const int bytes_per_pixel = mode.bytes_per_row / mode.x;
422                  int i, j;
423                  
424                  // Check for first column from left and first column
425                  // from right that have changed
426 <                int x1 = VideoMonitor.mode.x * bytes_per_pixel - 1;
426 >                int x1 = mode.x * bytes_per_pixel - 1;
427                  for (j = y1; j <= y2; j++) {
428                          uint8 * const p1 = &the_buffer[j * bytes_per_row];
429                          uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
# Line 434 | Line 440 | static inline void update_display_dga_vo
440                  for (j = y2; j >= y1; j--) {
441                          uint8 * const p1 = &the_buffer[j * bytes_per_row];
442                          uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
443 <                        for (i = VideoMonitor.mode.x * bytes_per_pixel - 1; i > x2; i--) {
443 >                        for (i = mode.x * bytes_per_pixel - 1; i > x2; i--) {
444                                  if (p1[i] != p2[i]) {
445                                          x2 = i;
446                                          break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines