1 /*
2  *  Copyright (C) 2002-2013  The DOSBox Team
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18 
19 #ifndef DOSBOX_RENDER_H
20 #define DOSBOX_RENDER_H
21 
22 // 0: complex scalers off, scaler cache off, some simple scalers off, memory requirements reduced
23 // 1: complex scalers off, scaler cache off, all simple scalers on
24 // 2: complex scalers off, scaler cache on
25 // 3: complex scalers on
26 
27 // Don't need scalers with libretro
28 #define RENDER_USE_ADVANCED_SCALERS 0
29 
30 #include "render_scalers.h"
31 
32 #define RENDER_SKIP_CACHE	16
33 //Enable this for scalers to support 0 input for empty lines
34 //#define RENDER_NULL_INPUT
35 
36 typedef struct {
37 	struct {
38 		Bit8u red;
39 		Bit8u green;
40 		Bit8u blue;
41 		Bit8u unused;
42 	} rgb[256];
43 	union {
44 		Bit16u b16[256];
45 		Bit32u b32[256];
46 	} lut;
47 	bool changed;
48 	Bit8u modified[256];
49 	Bitu first;
50 	Bitu last;
51 } RenderPal_t;
52 
53 typedef struct {
54 	struct {
55 		Bitu width, start;
56 		Bitu height;
57 		Bitu bpp;
58 		bool dblw,dblh;
59 		double ratio;
60 		float fps;
61 	} src;
62 	struct {
63 		Bitu count;
64 		Bitu max;
65 		Bitu index;
66 		Bit8u hadSkip[RENDER_SKIP_CACHE];
67 	} frameskip;
68 	struct {
69 		Bitu size;
70 		scalerMode_t inMode;
71 		scalerMode_t outMode;
72 		scalerOperation_t op;
73 		bool clearCache;
74 		bool forced;
75 		ScalerLineHandler_t lineHandler;
76 		ScalerLineHandler_t linePalHandler;
77 		ScalerComplexHandler_t complexHandler;
78 		Bitu blocks, lastBlock;
79 		Bitu outPitch;
80 		Bit8u *outWrite;
81 		Bitu cachePitch;
82 		Bit8u *cacheRead;
83 		Bitu inHeight, inLine, outLine;
84 	} scale;
85 	RenderPal_t pal;
86 	bool updating;
87 	bool active;
88 	bool aspect;
89 	bool fullFrame;
90 } Render_t;
91 
92 extern Render_t render;
93 extern ScalerLineHandler_t RENDER_DrawLine;
94 void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool dblw,bool dblh);
95 bool RENDER_StartUpdate(void);
96 void RENDER_EndUpdate(bool abort);
97 void RENDER_SetPal(Bit8u entry,Bit8u red,Bit8u green,Bit8u blue);
98 
99 
100 #endif
101