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 #if defined (SCALERLINEAR)
conc3d(SCALERNAME,SBPP,L)20 static void conc3d(SCALERNAME,SBPP,L)(void) {
21 #else
22 static void conc3d(SCALERNAME,SBPP,R)(void) {
23 #endif
24 //Skip the first one for multiline input scalers
25 if (!render.scale.outLine) {
26 render.scale.outLine++;
27 return;
28 }
29 lastagain:
30 if (!CC[render.scale.outLine][0]) {
31 #if defined(SCALERLINEAR)
32 Bitu scaleLines = SCALERHEIGHT;
33 #else
34 Bitu scaleLines = Scaler_Aspect[ render.scale.outLine ];
35 #endif
36 ScalerAddLines( 0, scaleLines );
37 if (++render.scale.outLine == render.scale.inHeight)
38 goto lastagain;
39 return;
40 }
41 /* Clear the complete line marker */
42 CC[render.scale.outLine][0] = 0;
43 const PTYPE * fc = &FC[render.scale.outLine][1];
44 PTYPE * line0=(PTYPE *)(render.scale.outWrite);
45 Bit8u * changed = &CC[render.scale.outLine][1];
46 Bitu b;
47 for (b=0;b<render.scale.blocks;b++) {
48 #if (SCALERHEIGHT > 1)
49 PTYPE * line1;
50 #endif
51 #if (SCALERHEIGHT > 2)
52 PTYPE * line2;
53 #endif
54 /* Clear this block being dirty marker */
55 const Bitu changeType = changed[b];
56 changed[b] = 0;
57 switch (changeType) {
58 case 0:
59 line0 += SCALERWIDTH * SCALER_BLOCKSIZE;
60 fc += SCALER_BLOCKSIZE;
61 continue;
62 case SCALE_LEFT:
63 #if (SCALERHEIGHT > 1)
64 line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch);
65 #endif
66 #if (SCALERHEIGHT > 2)
67 line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2);
68 #endif
69 SCALERFUNC;
70 line0 += SCALERWIDTH * SCALER_BLOCKSIZE;
71 fc += SCALER_BLOCKSIZE;
72 break;
73 case SCALE_LEFT | SCALE_RIGHT:
74 #if (SCALERHEIGHT > 1)
75 line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch);
76 #endif
77 #if (SCALERHEIGHT > 2)
78 line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2);
79 #endif
80 SCALERFUNC;
81 case SCALE_RIGHT:
82 #if (SCALERHEIGHT > 1)
83 line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch);
84 #endif
85 #if (SCALERHEIGHT > 2)
86 line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2);
87 #endif
88 line0 += SCALERWIDTH * (SCALER_BLOCKSIZE -1);
89 #if (SCALERHEIGHT > 1)
90 line1 += SCALERWIDTH * (SCALER_BLOCKSIZE -1);
91 #endif
92 #if (SCALERHEIGHT > 2)
93 line2 += SCALERWIDTH * (SCALER_BLOCKSIZE -1);
94 #endif
95 fc += SCALER_BLOCKSIZE -1;
96 SCALERFUNC;
97 line0 += SCALERWIDTH;
98 fc++;
99 break;
100 default:
101 #if defined(SCALERLINEAR)
102 #if (SCALERHEIGHT > 1)
103 line1 = WC[0];
104 #endif
105 #if (SCALERHEIGHT > 2)
106 line2 = WC[1];
107 #endif
108 #else
109 #if (SCALERHEIGHT > 1)
110 line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch);
111 #endif
112 #if (SCALERHEIGHT > 2)
113 line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2);
114 #endif
115 #endif //defined(SCALERLINEAR)
116 for (Bitu i = 0; i<SCALER_BLOCKSIZE;i++) {
117 SCALERFUNC;
118 line0 += SCALERWIDTH;
119 #if (SCALERHEIGHT > 1)
120 line1 += SCALERWIDTH;
121 #endif
122 #if (SCALERHEIGHT > 2)
123 line2 += SCALERWIDTH;
124 #endif
125 fc++;
126 }
127 #if defined(SCALERLINEAR)
128 #if (SCALERHEIGHT > 1)
129 BituMove((Bit8u*)(&line0[-SCALER_BLOCKSIZE*SCALERWIDTH])+render.scale.outPitch ,WC[0], SCALER_BLOCKSIZE *SCALERWIDTH*PSIZE);
130 #endif
131 #if (SCALERHEIGHT > 2)
132 BituMove((Bit8u*)(&line0[-SCALER_BLOCKSIZE*SCALERWIDTH])+render.scale.outPitch*2,WC[1], SCALER_BLOCKSIZE *SCALERWIDTH*PSIZE);
133 #endif
134 #endif //defined(SCALERLINEAR)
135 break;
136 }
137 }
138 #if defined(SCALERLINEAR)
139 Bitu scaleLines = SCALERHEIGHT;
140 #else
141 Bitu scaleLines = Scaler_Aspect[ render.scale.outLine ];
142 if ( ((Bits)(scaleLines - SCALERHEIGHT)) > 0 ) {
143 BituMove( render.scale.outWrite + render.scale.outPitch * SCALERHEIGHT,
144 render.scale.outWrite + render.scale.outPitch * (SCALERHEIGHT-1),
145 render.src.width * SCALERWIDTH * PSIZE);
146 }
147 #endif
148 ScalerAddLines( 1, scaleLines );
149 if (++render.scale.outLine == render.scale.inHeight)
150 goto lastagain;
151 }
152
153 #if !defined(SCALERLINEAR)
154 #define SCALERLINEAR 1
155 #include "render_loops.h"
156 #undef SCALERLINEAR
157 #endif
158