Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
Macros | Functions
AdjustScreen.c File Reference
#include <intuition/intuition.h>
#include <graphics/gfxbase.h>
Include dependency graph for AdjustScreen.c:

Go to the source code of this file.

Macros

#define MAX_X   362
 
#define MAX_Y_NTSC   241
 
#define MAX_Y_PAL   283
 

Functions

void AdjustScreen (register struct Screen *screen, int *dx, int *dy)
 

Macro Definition Documentation

#define MAX_X   362

Definition at line 7 of file AdjustScreen.c.

#define MAX_Y_NTSC   241

Definition at line 8 of file AdjustScreen.c.

#define MAX_Y_PAL   283

Definition at line 9 of file AdjustScreen.c.

Function Documentation

void AdjustScreen ( register struct Screen screen,
int dx,
int dy 
)

Definition at line 12 of file AdjustScreen.c.

13 {
14  int c640, c320, r400, r200, w, h, max_x, max_y;
15  struct Preferences prefs;
16  extern struct GfxBase *GfxBase;
17 
18  GetPrefs(&prefs, sizeof(prefs));
19  c640 = 640 + prefs.ColumnSizeChange;
20  c320 = c640 / 2;
21  r200 = 200 + prefs.RowSizeChange;
22  r400 = r200 * 2;
23 
24  max_y = (GfxBase->DisplayFlags & PAL) ? MAX_Y_PAL : MAX_Y_NTSC;
25  if (screen->ViewPort.Modes & LACE){
26  max_y *= 2;
27  }
28  max_x = MAX_X;
29  if (screen->ViewPort.Modes & HIRES){
30  max_x *= 2;
31  }
32  if (screen->ViewPort.DWidth <= max_x) {
33  w = screen->ViewPort.DWidth;
34  }else{
35  w = max_x;
36  }
37  if (screen->ViewPort.DHeight <= max_y) {
38  h = screen->ViewPort.DHeight;
39  }else{
40  h = max_y;
41  }
42 
43  if (screen->ViewPort.Modes & HIRES){
44  if (w > c640) {
45  screen->ViewPort.DxOffset += (c640 - w) / 2;
46  }
47  *dx = screen->ViewPort.DxOffset / 2;
48  }else{
49  if (w > c320) {
50  screen->ViewPort.DxOffset += (c320 - w) / 2;
51  }
52  *dx = screen->ViewPort.DxOffset;
53  }
54  if (screen->ViewPort.Modes & LACE){
55  if (h > r400) {
56  screen->ViewPort.DyOffset += (r400 - h) / 2;
57  }
58  *dy = screen->ViewPort.DyOffset / 2;
59  }else{
60  if (h > r200) {
61  screen->ViewPort.DyOffset += (r200 - h) / 2;
62  }
63  *dy = screen->ViewPort.DyOffset;
64  }
65 
66  RemakeDisplay();
67 }
struct GfxBase * GfxBase
Definition: getami.c:61
static struct NewScreen screen
Definition: getami.c:67
#define MAX_X
Definition: AdjustScreen.c:7
#define MAX_Y_PAL
Definition: AdjustScreen.c:9
int max_y
Definition: unslice.c:42
#define MAX_Y_NTSC
Definition: AdjustScreen.c:8