DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
include/render.h
00001 /*
00002  *  Copyright (C) 2002-2020  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License along
00015  *  with this program; if not, write to the Free Software Foundation, Inc.,
00016  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef DOSBOX_RENDER_H
00020 #define DOSBOX_RENDER_H
00021 
00022 // 0: complex scalers off, scaler cache off, some simple scalers off, memory requirements reduced
00023 // 1: complex scalers off, scaler cache off, all simple scalers on
00024 // 2: complex scalers off, scaler cache on
00025 // 3: complex scalers on
00026 #define RENDER_USE_ADVANCED_SCALERS 3
00027 
00028 #include "../src/gui/render_scalers.h"
00029 
00030 #define RENDER_SKIP_CACHE       16
00031 //Enable this for scalers to support 0 input for empty lines
00032 //#define RENDER_NULL_INPUT
00033 
00034 enum ASPECT_MODES {
00035     ASPECT_FALSE = 0
00036     ,ASPECT_TRUE
00037 #if C_SURFACE_POSTRENDER_ASPECT
00038     ,ASPECT_NEAREST
00039     ,ASPECT_BILINEAR
00040 #endif
00041 };
00042 
00043 typedef struct {
00044         struct { 
00045                 Bit8u red;
00046                 Bit8u green;
00047                 Bit8u blue;
00048                 Bit8u unused;
00049         } rgb[256];
00050         union {
00051                 Bit16u b16[256];
00052                 Bit32u b32[256];
00053         } lut;
00054         bool changed;
00055         Bit8u modified[256];
00056         Bitu first;
00057         Bitu last;
00058 } RenderPal_t;
00059 
00060 typedef struct {
00061         struct {
00062                 Bitu width, start;
00063                 Bitu height;
00064                 Bitu bpp;
00065                 bool dblw,dblh;
00066                 double ratio;
00067                 float fps;
00068                 double scrn_ratio;
00069         } src;
00070         struct {
00071                 Bitu count;
00072                 Bitu max;
00073                 Bitu index;
00074                 Bit8u hadSkip[RENDER_SKIP_CACHE];
00075         } frameskip;
00076         struct {
00077                 Bitu size;
00078                 scalerMode_t inMode;
00079                 scalerMode_t outMode;
00080                 scalerOperation_t op;
00081                 bool clearCache;
00082                 bool forced;
00083                 bool hardware;
00084                 ScalerLineHandler_t lineHandler;
00085                 ScalerLineHandler_t linePalHandler;
00086                 ScalerComplexHandler_t complexHandler;
00087                 Bitu blocks, lastBlock;
00088                 Bitu outPitch;
00089                 Bit8u *outWrite;
00090                 Bitu cachePitch;
00091                 Bit8u *cacheRead;
00092                 Bitu inHeight, inLine, outLine;
00093         } scale;
00094     RenderPal_t pal;
00095         bool updating;
00096         bool active;
00097         int aspect;
00098     bool aspectOffload;
00099         bool fullFrame;
00100         bool forceUpdate;
00101         bool autofit;
00102 } Render_t;
00103 
00104 extern Render_t render;
00105 extern Bitu last_gfx_flags;
00106 extern ScalerLineHandler_t RENDER_DrawLine;
00107 void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double scrn_ratio);
00108 bool RENDER_StartUpdate(void);
00109 void RENDER_EndUpdate(bool abort);
00110 void RENDER_SetPal(Bit8u entry,Bit8u red,Bit8u green,Bit8u blue);
00111 
00112 
00113 #endif