1 | Index: backends/sdl/events.cpp
|
---|
2 | ===================================================================
|
---|
3 | RCS file: /cvsroot/scummvm/scummvm/backends/sdl/events.cpp,v
|
---|
4 | retrieving revision 1.9
|
---|
5 | diff -u -r1.9 events.cpp
|
---|
6 | --- backends/sdl/events.cpp 15 Oct 2004 22:28:12 -0000 1.9
|
---|
7 | +++ backends/sdl/events.cpp 25 Oct 2004 17:36:59 -0000
|
---|
8 | @@ -68,8 +68,10 @@
|
---|
9 | km.y = y;
|
---|
10 |
|
---|
11 | // Adjust for the screen scaling
|
---|
12 | - event.mouse.x /= _scaleFactor;
|
---|
13 | - event.mouse.y /= _scaleFactor;
|
---|
14 | + event.mouse.x *= _scaleFactor_hdiv;
|
---|
15 | + event.mouse.x /= _scaleFactor_hmul;
|
---|
16 | + event.mouse.y *= _scaleFactor_vdiv;
|
---|
17 | + event.mouse.y /= _scaleFactor_vmul;
|
---|
18 |
|
---|
19 | // Optionally perform aspect ratio adjusting
|
---|
20 | if (_adjustAspectRatio)
|
---|
21 | @@ -265,7 +267,7 @@
|
---|
22 |
|
---|
23 |
|
---|
24 | int newMode = -1;
|
---|
25 | - int factor = _scaleFactor - 1;
|
---|
26 | + int factor = _scaleFactor_hmul / _scaleFactor_hdiv - 1;
|
---|
27 |
|
---|
28 | // Increase/decrease the scale factor
|
---|
29 | if (ev.key.keysym.sym == SDLK_EQUALS || ev.key.keysym.sym == SDLK_PLUS || ev.key.keysym.sym == SDLK_MINUS ||
|
---|
30 | Index: backends/sdl/graphics.cpp
|
---|
31 | ===================================================================
|
---|
32 | RCS file: /cvsroot/scummvm/scummvm/backends/sdl/graphics.cpp,v
|
---|
33 | retrieving revision 1.15
|
---|
34 | diff -u -r1.15 graphics.cpp
|
---|
35 | --- backends/sdl/graphics.cpp 15 Oct 2004 22:28:12 -0000 1.15
|
---|
36 | +++ backends/sdl/graphics.cpp 25 Oct 2004 17:37:02 -0000
|
---|
37 | @@ -38,6 +38,7 @@
|
---|
38 | {"hq3x", "HQ3x", GFX_HQ3X},
|
---|
39 | {"tv2x", "TV2x", GFX_TV2X},
|
---|
40 | {"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
|
---|
41 | + {"ratio800", "Ratio800", GFX_RATIO800},
|
---|
42 | {0, 0, 0}
|
---|
43 | };
|
---|
44 |
|
---|
45 | @@ -52,58 +53,75 @@
|
---|
46 | bool OSystem_SDL::setGraphicsMode(int mode) {
|
---|
47 | Common::StackLock lock(_graphicsMutex);
|
---|
48 |
|
---|
49 | - int newScaleFactor = 1;
|
---|
50 | - ScalerProc *newScalerProc;
|
---|
51 | -
|
---|
52 | switch(mode) {
|
---|
53 | case GFX_NORMAL:
|
---|
54 | - newScaleFactor = 1;
|
---|
55 | - newScalerProc = Normal1x;
|
---|
56 | + _scaleFactor_hmul = _scaleFactor_vmul = 1;
|
---|
57 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
58 | + _scalerProc = Normal1x;
|
---|
59 | break;
|
---|
60 | case GFX_DOUBLESIZE:
|
---|
61 | - newScaleFactor = 2;
|
---|
62 | - newScalerProc = Normal2x;
|
---|
63 | + _scaleFactor_hmul = _scaleFactor_vmul = 2;
|
---|
64 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
65 | + _scalerProc = Normal2x;
|
---|
66 | break;
|
---|
67 | case GFX_TRIPLESIZE:
|
---|
68 | - newScaleFactor = 3;
|
---|
69 | - newScalerProc = Normal3x;
|
---|
70 | + _scaleFactor_hmul = _scaleFactor_vmul = 3;
|
---|
71 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
72 | + _scalerProc = Normal3x;
|
---|
73 | break;
|
---|
74 |
|
---|
75 | case GFX_2XSAI:
|
---|
76 | - newScaleFactor = 2;
|
---|
77 | - newScalerProc = _2xSaI;
|
---|
78 | + _scaleFactor_hmul = _scaleFactor_vmul = 2;
|
---|
79 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
80 | + _scalerProc = _2xSaI;
|
---|
81 | break;
|
---|
82 | case GFX_SUPER2XSAI:
|
---|
83 | - newScaleFactor = 2;
|
---|
84 | - newScalerProc = Super2xSaI;
|
---|
85 | + _scaleFactor_hmul = _scaleFactor_vmul = 2;
|
---|
86 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
87 | + _scalerProc = Super2xSaI;
|
---|
88 | break;
|
---|
89 | case GFX_SUPEREAGLE:
|
---|
90 | - newScaleFactor = 2;
|
---|
91 | - newScalerProc = SuperEagle;
|
---|
92 | + _scaleFactor_hmul = _scaleFactor_vmul = 2;
|
---|
93 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
94 | + _scalerProc = SuperEagle;
|
---|
95 | break;
|
---|
96 | case GFX_ADVMAME2X:
|
---|
97 | - newScaleFactor = 2;
|
---|
98 | - newScalerProc = AdvMame2x;
|
---|
99 | + _scaleFactor_hmul = _scaleFactor_vmul = 2;
|
---|
100 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
101 | + _scalerProc = AdvMame2x;
|
---|
102 | break;
|
---|
103 | case GFX_ADVMAME3X:
|
---|
104 | - newScaleFactor = 3;
|
---|
105 | - newScalerProc = AdvMame3x;
|
---|
106 | + _scaleFactor_hmul = _scaleFactor_vmul = 3;
|
---|
107 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
108 | + _scalerProc = AdvMame3x;
|
---|
109 | break;
|
---|
110 | case GFX_HQ2X:
|
---|
111 | - newScaleFactor = 2;
|
---|
112 | - newScalerProc = HQ2x;
|
---|
113 | + _scaleFactor_hmul = _scaleFactor_vmul = 2;
|
---|
114 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
115 | + _scalerProc = HQ2x;
|
---|
116 | break;
|
---|
117 | case GFX_HQ3X:
|
---|
118 | - newScaleFactor = 3;
|
---|
119 | - newScalerProc = HQ3x;
|
---|
120 | + _scaleFactor_hmul = _scaleFactor_vmul = 3;
|
---|
121 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
122 | + _scalerProc = HQ3x;
|
---|
123 | break;
|
---|
124 | case GFX_TV2X:
|
---|
125 | - newScaleFactor = 2;
|
---|
126 | - newScalerProc = TV2x;
|
---|
127 | + _scaleFactor_hmul = _scaleFactor_vmul = 2;
|
---|
128 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
129 | + _scalerProc = TV2x;
|
---|
130 | break;
|
---|
131 | case GFX_DOTMATRIX:
|
---|
132 | - newScaleFactor = 2;
|
---|
133 | - newScalerProc = DotMatrix;
|
---|
134 | + _scaleFactor_hmul = _scaleFactor_vmul = 2;
|
---|
135 | + _scaleFactor_hdiv = _scaleFactor_vdiv = 1;
|
---|
136 | + _scalerProc = DotMatrix;
|
---|
137 | + break;
|
---|
138 | +
|
---|
139 | + case GFX_RATIO800:
|
---|
140 | + _scaleFactor_hmul = 5;
|
---|
141 | + _scaleFactor_hdiv = 2;
|
---|
142 | + _scaleFactor_vmul = 3;
|
---|
143 | + _scaleFactor_vdiv = 1;
|
---|
144 | + _scalerProc = Ratio800;
|
---|
145 | break;
|
---|
146 |
|
---|
147 | default:
|
---|
148 | @@ -112,11 +130,7 @@
|
---|
149 | }
|
---|
150 |
|
---|
151 | _mode = mode;
|
---|
152 | - _scalerProc = newScalerProc;
|
---|
153 | - if (newScaleFactor != _scaleFactor) {
|
---|
154 | - _scaleFactor = newScaleFactor;
|
---|
155 | - hotswap_gfx_mode();
|
---|
156 | - }
|
---|
157 | + hotswap_gfx_mode();
|
---|
158 |
|
---|
159 | // Determine the "scaler type", i.e. essentially an index into the
|
---|
160 | // s_gfxModeSwitchTable array defined in events.cpp.
|
---|
161 | @@ -185,7 +199,7 @@
|
---|
162 | // Create the surface that contains the scaled graphics in 16 bit mode
|
---|
163 | //
|
---|
164 |
|
---|
165 | - _hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, effectiveScreenHeight(), 16,
|
---|
166 | + _hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv, effectiveScreenHeight(), 16,
|
---|
167 | _full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
|
---|
168 | );
|
---|
169 | if (_hwscreen == NULL) {
|
---|
170 | @@ -247,7 +261,7 @@
|
---|
171 | #endif
|
---|
172 |
|
---|
173 | // keyboard cursor control, some other better place for it?
|
---|
174 | - km.x_max = _screenWidth * _scaleFactor - 1;
|
---|
175 | + km.x_max = _screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv - 1;
|
---|
176 | km.y_max = effectiveScreenHeight() - 1;
|
---|
177 | km.delay_time = 25;
|
---|
178 | km.last_time = 0;
|
---|
179 | @@ -326,7 +340,9 @@
|
---|
180 |
|
---|
181 | // If the shake position changed, fill the dirty area with blackness
|
---|
182 | if (_currentShakePos != _newShakePos) {
|
---|
183 | - SDL_Rect blackrect = {0, 0, _screenWidth * _scaleFactor, _newShakePos * _scaleFactor};
|
---|
184 | + SDL_Rect blackrect = {0, 0,
|
---|
185 | + _screenWidth * _scaleFactor_hmul / _scaleFactor_hdiv,
|
---|
186 | + _newShakePos * _scaleFactor_vmul / _scaleFactor_vdiv};
|
---|
187 |
|
---|
188 | if (_adjustAspectRatio)
|
---|
189 | blackrect.h = real2Aspect(blackrect.h - 1) + 1;
|
---|
190 | @@ -432,7 +448,8 @@
|
---|
191 | if (dst_h > _screenHeight - dst_y)
|
---|
192 | dst_h = _screenHeight - dst_y;
|
---|
193 |
|
---|
194 | - dst_y *= _scaleFactor;
|
---|
195 | + dst_y *= _scaleFactor_vmul;
|
---|
196 | + dst_y /= _scaleFactor_vdiv;
|
---|
197 |
|
---|
198 | if (_adjustAspectRatio) {
|
---|
199 | orig_dst_y = dst_y;
|
---|
200 | @@ -440,15 +457,18 @@
|
---|
201 | }
|
---|
202 |
|
---|
203 | _scalerProc((byte *)_tmpscreen->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
|
---|
204 | - (byte *)_hwscreen->pixels + r->x * 2 * _scaleFactor + dst_y * dstPitch, dstPitch, r->w, dst_h);
|
---|
205 | + (byte *)_hwscreen->pixels + 2 * (r->x * _scaleFactor_hmul / _scaleFactor_hdiv) +
|
---|
206 | + dst_y * dstPitch, dstPitch, r->x, r->y, r->w, dst_h);
|
---|
207 | }
|
---|
208 |
|
---|
209 | - r->x *= _scaleFactor;
|
---|
210 | + r->x *= _scaleFactor_hmul;
|
---|
211 | + r->x /= _scaleFactor_hdiv;
|
---|
212 | r->y = dst_y;
|
---|
213 | - r->w *= _scaleFactor;
|
---|
214 | - r->h = dst_h * _scaleFactor;
|
---|
215 | + r->w *= _scaleFactor_hmul;
|
---|
216 | + r->w /= _scaleFactor_hdiv;
|
---|
217 | + r->h = dst_h * _scaleFactor_vmul / _scaleFactor_vdiv;
|
---|
218 |
|
---|
219 | - if (_adjustAspectRatio && orig_dst_y / _scaleFactor < _screenHeight)
|
---|
220 | + if (_adjustAspectRatio && orig_dst_y * _scaleFactor_vdiv / _scaleFactor_vmul < _screenHeight)
|
---|
221 | r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y);
|
---|
222 | }
|
---|
223 | SDL_UnlockSurface(_tmpscreen);
|
---|
224 | @@ -890,7 +910,7 @@
|
---|
225 |
|
---|
226 | void OSystem_SDL::warpMouse(int x, int y) {
|
---|
227 | if (_mouseCurState.x != x || _mouseCurState.y != y) {
|
---|
228 | - SDL_WarpMouse(x * _scaleFactor, y * _scaleFactor);
|
---|
229 | + SDL_WarpMouse(x * _scaleFactor_hmul / _scaleFactor_hdiv, y * _scaleFactor_vmul / _scaleFactor_vdiv);
|
---|
230 |
|
---|
231 | // SDL_WarpMouse() generates a mouse movement event, so
|
---|
232 | // set_mouse_pos() would be called eventually. However, the
|
---|
233 | Index: backends/sdl/sdl-common.cpp
|
---|
234 | ===================================================================
|
---|
235 | RCS file: /cvsroot/scummvm/scummvm/backends/sdl/Attic/sdl-common.cpp,v
|
---|
236 | retrieving revision 1.102
|
---|
237 | diff -u -r1.102 sdl-common.cpp
|
---|
238 | --- backends/sdl/sdl-common.cpp 16 Dec 2003 12:04:47 -0000 1.102
|
---|
239 | +++ backends/sdl/sdl-common.cpp 25 Oct 2004 17:37:07 -0000
|
---|
240 | @@ -15,7 +15,7 @@
|
---|
241 | * along with this program; if not, write to the Free Software
|
---|
242 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
243 | *
|
---|
244 | - * $Header: /cvsroot/scummvm/scummvm/backends/sdl/Attic/sdl-common.cpp,v 1.102 2003/12/16 12:04:47 kirben Exp $
|
---|
245 | + * $Header: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v 1.102 2003/12/16 12:04:47 kirben Exp $
|
---|
246 | *
|
---|
247 | */
|
---|
248 |
|
---|
249 | @@ -504,7 +504,8 @@
|
---|
250 |
|
---|
251 | void OSystem_SDL_Common::warp_mouse(int x, int y) {
|
---|
252 | if (_mouseCurState.x != x || _mouseCurState.y != y) {
|
---|
253 | - SDL_WarpMouse(x * _scaleFactor, y * _scaleFactor);
|
---|
254 | + SDL_WarpMouse(x * _scaleFactor_hmul / _scaleFactor_hdiv,
|
---|
255 | + y * _scaleFactor_vmul / _scaleFactor_vdiv);
|
---|
256 |
|
---|
257 | // SDL_WarpMouse() generates a mouse movement event, so
|
---|
258 | // set_mouse_pos() would be called eventually. However, the
|
---|
259 | @@ -570,8 +571,10 @@
|
---|
260 | km.y = event.mouse.y;
|
---|
261 |
|
---|
262 | // Adjust for the screen scaling
|
---|
263 | - event.mouse.x /= _scaleFactor;
|
---|
264 | - event.mouse.y /= _scaleFactor;
|
---|
265 | + event.mouse.x *= _scaleFactor_hdiv;
|
---|
266 | + event.mouse.x /= _scaleFactor_hmul;
|
---|
267 | + event.mouse.y *= _scaleFactor_vdiv;
|
---|
268 | + event.mouse.y /= _scaleFactor_vmul;
|
---|
269 |
|
---|
270 | // Optionally perform aspect ratio adjusting
|
---|
271 | if (_adjustAspectRatio)
|
---|
272 | @@ -680,7 +683,7 @@
|
---|
273 |
|
---|
274 |
|
---|
275 | Property prop;
|
---|
276 | - int factor = _scaleFactor - 1;
|
---|
277 | + int factor = _scaleFactor_hmul / _scaleFactor_hdiv - 1;
|
---|
278 |
|
---|
279 | // Ctrl-Alt-a toggles aspect ratio correction
|
---|
280 | if (ev.key.keysym.sym == 'a') {
|
---|
281 | @@ -948,8 +951,10 @@
|
---|
282 | }
|
---|
283 | event->mouse.x = km.x;
|
---|
284 | event->mouse.y = km.y;
|
---|
285 | - event->mouse.x /= _scaleFactor;
|
---|
286 | - event->mouse.y /= _scaleFactor;
|
---|
287 | + event->mouse.x *= _scaleFactor_hdiv;
|
---|
288 | + event->mouse.x /= _scaleFactor_hmul;
|
---|
289 | + event->mouse.y *= _scaleFactor_vdiv;
|
---|
290 | + event->mouse.y /= _scaleFactor_vmul;
|
---|
291 |
|
---|
292 | if (_adjustAspectRatio)
|
---|
293 | event->mouse.y = aspect2Real(event->mouse.y);
|
---|
294 | Index: backends/sdl/sdl-common.h
|
---|
295 | ===================================================================
|
---|
296 | RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
|
---|
297 | retrieving revision 1.65
|
---|
298 | diff -u -r1.65 sdl-common.h
|
---|
299 | --- backends/sdl/sdl-common.h 15 Oct 2004 22:28:12 -0000 1.65
|
---|
300 | +++ backends/sdl/sdl-common.h 25 Oct 2004 17:37:09 -0000
|
---|
301 | @@ -192,10 +192,13 @@
|
---|
302 | bool _forceFull; // Force full redraw on next updateScreen
|
---|
303 | ScalerProc *_scalerProc;
|
---|
304 | int _scalerType;
|
---|
305 | - int _scaleFactor;
|
---|
306 | + int _scaleFactor_hmul;
|
---|
307 | + int _scaleFactor_hdiv;
|
---|
308 | + int _scaleFactor_vmul;
|
---|
309 | + int _scaleFactor_vdiv;
|
---|
310 | int _mode;
|
---|
311 | bool _full_screen;
|
---|
312 | uint32 _mode_flags;
|
---|
313 | @@ -281,7 +284,7 @@
|
---|
314 |
|
---|
315 | bool save_screenshot(const char *filename);
|
---|
316 |
|
---|
317 | - int effectiveScreenHeight() { return (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactor; }
|
---|
318 | + int effectiveScreenHeight() { return (_adjustAspectRatio ? 240 : _screenHeight) * _scaleFactor_vmul / _scaleFactor_vdiv; }
|
---|
319 |
|
---|
320 | void setup_icon();
|
---|
321 | void kbd_mouse();
|
---|
322 | Index: backends/sdl/sdl.cpp
|
---|
323 | ===================================================================
|
---|
324 | RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v
|
---|
325 | retrieving revision 1.74
|
---|
326 | diff -u -r1.74 sdl.cpp
|
---|
327 | --- backends/sdl/sdl.cpp 15 Oct 2004 22:28:12 -0000 1.74
|
---|
328 | +++ backends/sdl/sdl.cpp 25 Oct 2004 17:37:09 -0000
|
---|
329 | @@ -64,13 +64,15 @@
|
---|
330 | cksum_valid = false;
|
---|
331 | #ifndef _WIN32_WCE
|
---|
332 | _mode = GFX_DOUBLESIZE;
|
---|
333 | - _scaleFactor = 2;
|
---|
334 | + _scaleFactor_hmul = 2;
|
---|
335 | + _scaleFactor_hdiv = 1;
|
---|
336 | _scalerProc = Normal2x;
|
---|
337 | _full_screen = ConfMan.getBool("fullscreen");
|
---|
338 | _adjustAspectRatio = ConfMan.getBool("aspect_ratio");
|
---|
339 | #else
|
---|
340 | _mode = GFX_NORMAL;
|
---|
341 | - _scaleFactor = 1;
|
---|
342 | + _scaleFactor_hmul = 1;
|
---|
343 | + _scaleFactor_hdiv = 1;
|
---|
344 | _scalerProc = Normal1x;
|
---|
345 | _full_screen = true;
|
---|
346 | _adjustAspectRatio = false;
|
---|
347 | Index: common/gameDetector.cpp
|
---|
348 | ===================================================================
|
---|
349 | RCS file: /cvsroot/scummvm/scummvm/common/Attic/gameDetector.cpp,v
|
---|
350 | retrieving revision 1.115
|
---|
351 | diff -u -r1.115 gameDetector.cpp
|
---|
352 | --- common/gameDetector.cpp 22 Jun 2003 14:18:33 -0000 1.115
|
---|
353 | +++ common/gameDetector.cpp 25 Oct 2004 17:37:15 -0000
|
---|
354 | @@ -16,7 +16,7 @@
|
---|
355 | * along with this program; if not, write to the Free Software
|
---|
356 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
357 | *
|
---|
358 | - * $Header: /cvsroot/scummvm/scummvm/common/Attic/gameDetector.cpp,v 1.115 2003/06/22 14:18:33 kirben Exp $
|
---|
359 | + * $Header: /cvsroot/scummvm/scummvm/common/gameDetector.cpp,v 1.115 2003/06/22 14:18:33 kirben Exp $
|
---|
360 | *
|
---|
361 | */
|
---|
362 |
|
---|
363 | @@ -53,7 +53,7 @@
|
---|
364 | "\t-p<path> - look for game in <path>\n"
|
---|
365 | "\t-x[<num>] - load this savegame (default: 0 - autosave)\n"
|
---|
366 | "\t-f - fullscreen mode\n"
|
---|
367 | - "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,advmame3x,tv2x,dotmatrix)\n"
|
---|
368 | + "\t-g<mode> - graphics mode (normal,2x,3x,2xsai,super2xsai,supereagle,advmame2x,advmame3x,tv2x,dotmatrix,ratio800)\n"
|
---|
369 | "\t-e<mode> - set music engine (see README for details)\n"
|
---|
370 | "\t-a - specify game is amiga version\n"
|
---|
371 | "\t-q<lang> - specify language (en,de,fr,it,pt,es,jp,zh,kr,hb)\n"
|
---|
372 | @@ -102,6 +102,7 @@
|
---|
373 | {"tv2x", "TV2x", GFX_TV2X},
|
---|
374 | {"dotmatrix", "DotMatrix", GFX_DOTMATRIX},
|
---|
375 | {"opengl", "OpenGL", GFX_BILINEAR},
|
---|
376 | + {"ratio800", "Ratio800", GFX_RATIO800},
|
---|
377 | #else
|
---|
378 | {"flipping", "Page Flipping", GFX_FLIPPING},
|
---|
379 | {"dbuffer", "Double Buffer", GFX_DOUBLEBUFFER},
|
---|
380 | Index: common/scaler.cpp
|
---|
381 | ===================================================================
|
---|
382 | RCS file: /cvsroot/scummvm/scummvm/common/scaler.cpp,v
|
---|
383 | retrieving revision 1.63
|
---|
384 | diff -u -r1.63 scaler.cpp
|
---|
385 | --- common/scaler.cpp 10 Aug 2004 17:46:04 -0000 1.63
|
---|
386 | +++ common/scaler.cpp 25 Oct 2004 17:37:17 -0000
|
---|
387 | @@ -108,7 +108,7 @@
|
---|
388 | * source to the destionation.
|
---|
389 | */
|
---|
390 | void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
---|
391 | - int width, int height) {
|
---|
392 | + int x, int y, int width, int height) {
|
---|
393 | while (height--) {
|
---|
394 | memcpy(dstPtr, srcPtr, 2 * width);
|
---|
395 | srcPtr += srcPitch;
|
---|
396 | @@ -120,7 +120,7 @@
|
---|
397 | * Trivial nearest-neighbour 2x scaler.
|
---|
398 | */
|
---|
399 | void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
---|
400 | - int width, int height) {
|
---|
401 | + int x, int y, int width, int height) {
|
---|
402 | uint8 *r;
|
---|
403 |
|
---|
404 | assert(((int)dstPtr & 3) == 0);
|
---|
405 | @@ -143,7 +143,7 @@
|
---|
406 | * Trivial nearest-neighbour 3x scaler.
|
---|
407 | */
|
---|
408 | void Normal3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
---|
409 | - int width, int height) {
|
---|
410 | + int x, int y, int width, int height) {
|
---|
411 | uint8 *r;
|
---|
412 | const uint32 dstPitch2 = dstPitch * 2;
|
---|
413 | const uint32 dstPitch3 = dstPitch * 3;
|
---|
414 | @@ -174,7 +174,7 @@
|
---|
415 | * See also http://scale2x.sourceforge.net
|
---|
416 | */
|
---|
417 | void AdvMame2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
---|
418 | - int width, int height) {
|
---|
419 | + int x, int y, int width, int height) {
|
---|
420 | scale(2, dstPtr, dstPitch, srcPtr - srcPitch, srcPitch, 2, width, height);
|
---|
421 | }
|
---|
422 |
|
---|
423 | @@ -183,7 +183,7 @@
|
---|
424 | * See also http://scale2x.sourceforge.net
|
---|
425 | */
|
---|
426 | void AdvMame3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
---|
427 | - int width, int height) {
|
---|
428 | + int x, int y, int width, int height) {
|
---|
429 | scale(3, dstPtr, dstPitch, srcPtr - srcPitch, srcPitch, 2, width, height);
|
---|
430 | }
|
---|
431 |
|
---|
432 | @@ -226,7 +226,8 @@
|
---|
433 | // exercise for the reader.)
|
---|
434 |
|
---|
435 | void DotMatrix(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
---|
436 | - int width, int height) {
|
---|
437 | + int x, int y, int width, int height)
|
---|
438 | +{
|
---|
439 | const uint32 nextlineSrc = srcPitch / sizeof(uint16);
|
---|
440 | const uint16 *p = (const uint16 *)srcPtr;
|
---|
441 |
|
---|
442 | @@ -245,3 +246,76 @@
|
---|
443 | q += nextlineDst << 1;
|
---|
444 | }
|
---|
445 | }
|
---|
446 | +
|
---|
447 | +#define INTERPOLATE INTERPOLATE<565>
|
---|
448 | +#define Q_INTERPOLATE Q_INTERPOLATE<565>
|
---|
449 | +
|
---|
450 | +
|
---|
451 | +void Ratio800(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
---|
452 | + int x, int y, int width, int height)
|
---|
453 | +{
|
---|
454 | + unsigned int nextlineSrc = srcPitch / sizeof(uint16);
|
---|
455 | + const uint16 *p = (const uint16 *)srcPtr;
|
---|
456 | +
|
---|
457 | + unsigned int nextlineDst = dstPitch / sizeof(uint16);
|
---|
458 | + uint16 *q0 = (uint16 *)dstPtr;
|
---|
459 | + uint16 *q1, *q2, *q3;
|
---|
460 | +
|
---|
461 | + int i, j;
|
---|
462 | + uint16 va, vb, vc, vd, ve, vf, vg, vh;
|
---|
463 | + uint16 vbc;
|
---|
464 | +
|
---|
465 | + if(x & 1) {
|
---|
466 | + width++;
|
---|
467 | + x--;
|
---|
468 | + p--;
|
---|
469 | + q0 -= 2;
|
---|
470 | + }
|
---|
471 | + if(width & 1)
|
---|
472 | + width++;
|
---|
473 | + for(i = 0; i < height; i++) {
|
---|
474 | + q1 = q0;
|
---|
475 | + q2 = q1 + nextlineDst;
|
---|
476 | + q3 = q2 + nextlineDst;
|
---|
477 | + vc = p[-1];
|
---|
478 | + vd = p[0];
|
---|
479 | +
|
---|
480 | + for(j = 0; j < width; j += 2) {
|
---|
481 | + ve = p[-nextlineSrc];
|
---|
482 | + vg = p[nextlineSrc];
|
---|
483 | + va = vc;
|
---|
484 | + vb = vd;
|
---|
485 | + p++;
|
---|
486 | + vf = p[-nextlineSrc];
|
---|
487 | + vh = p[nextlineSrc];
|
---|
488 | + vc = *p;
|
---|
489 | + p++;
|
---|
490 | + vd = *p;
|
---|
491 | + /*
|
---|
492 | + E F
|
---|
493 | + A B C D
|
---|
494 | + G H
|
---|
495 | + */
|
---|
496 | +
|
---|
497 | + vbc = INTERPOLATE(vb, vc);
|
---|
498 | +
|
---|
499 | + *(q1++) = Q_INTERPOLATE(va, ve, vb, vb);
|
---|
500 | + *(q1++) = Q_INTERPOLATE(ve, vb, vb, vb);
|
---|
501 | + *(q1++) = Q_INTERPOLATE(INTERPOLATE(ve, vf), vbc, vbc, vbc);
|
---|
502 | + *(q1++) = Q_INTERPOLATE(vf, vc, vc, vc);
|
---|
503 | + *(q1++) = Q_INTERPOLATE(vd, vf, vc, vc);
|
---|
504 | + *(q2++) = Q_INTERPOLATE(va, vb, vb, vb);
|
---|
505 | + *(q2++) = vb;
|
---|
506 | + *(q2++) = vbc;
|
---|
507 | + *(q2++) = vc;
|
---|
508 | + *(q2++) = Q_INTERPOLATE(vd, vc, vc, vc);
|
---|
509 | + *(q3++) = Q_INTERPOLATE(va, vg, vb, vb);
|
---|
510 | + *(q3++) = Q_INTERPOLATE(vg, vb, vb, vb);
|
---|
511 | + *(q3++) = Q_INTERPOLATE(INTERPOLATE(vg, vh), vbc, vbc, vbc);
|
---|
512 | + *(q3++) = Q_INTERPOLATE(vh, vc, vc, vc);
|
---|
513 | + *(q3++) = Q_INTERPOLATE(vd, vh, vc, vc);
|
---|
514 | + }
|
---|
515 | + p += nextlineSrc - width;
|
---|
516 | + q0 += nextlineDst * 3;
|
---|
517 | + }
|
---|
518 | +}
|
---|
519 | Index: common/scaler.h
|
---|
520 | ===================================================================
|
---|
521 | RCS file: /cvsroot/scummvm/scummvm/common/scaler.h,v
|
---|
522 | retrieving revision 1.26
|
---|
523 | diff -u -r1.26 scaler.h
|
---|
524 | --- common/scaler.h 21 May 2004 20:43:07 -0000 1.26
|
---|
525 | +++ common/scaler.h 25 Oct 2004 17:37:17 -0000
|
---|
526 | @@ -27,11 +27,11 @@
|
---|
527 | extern void InitScalers(uint32 BitFormat);
|
---|
528 |
|
---|
529 | typedef void ScalerProc(const uint8 *srcPtr, uint32 srcPitch,
|
---|
530 | - uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
---|
531 | + uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height);
|
---|
532 |
|
---|
533 | #define DECLARE_SCALER(x) \
|
---|
534 | extern void x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, \
|
---|
535 | - uint32 dstPitch, int width, int height)
|
---|
536 | + uint32 dstPitch, int x, int y, int width, int height)
|
---|
537 |
|
---|
538 | DECLARE_SCALER(_2xSaI);
|
---|
539 | DECLARE_SCALER(Super2xSaI);
|
---|
540 | @@ -45,6 +45,7 @@
|
---|
541 | DECLARE_SCALER(DotMatrix);
|
---|
542 | DECLARE_SCALER(HQ2x);
|
---|
543 | DECLARE_SCALER(HQ3x);
|
---|
544 | +DECLARE_SCALER(Ratio800);
|
---|
545 |
|
---|
546 | FORCEINLINE int real2Aspect(int y) {
|
---|
547 | return y + (y + 1) / 5;
|
---|
548 | @@ -70,7 +71,8 @@
|
---|
549 | GFX_HQ2X = 8,
|
---|
550 | GFX_HQ3X = 9,
|
---|
551 | GFX_TV2X = 10,
|
---|
552 | - GFX_DOTMATRIX = 11
|
---|
553 | + GFX_DOTMATRIX = 11,
|
---|
554 | + GFX_RATIO800 = 12
|
---|
555 | };
|
---|
556 |
|
---|
557 |
|
---|
558 | Index: common/scaler/hq2x.cpp
|
---|
559 | ===================================================================
|
---|
560 | RCS file: /cvsroot/scummvm/scummvm/common/scaler/hq2x.cpp,v
|
---|
561 | retrieving revision 1.12
|
---|
562 | diff -u -r1.12 hq2x.cpp
|
---|
563 | --- common/scaler/hq2x.cpp 21 May 2004 17:30:51 -0000 1.12
|
---|
564 | +++ common/scaler/hq2x.cpp 25 Oct 2004 17:37:18 -0000
|
---|
565 | @@ -35,7 +35,7 @@
|
---|
566 |
|
---|
567 | }
|
---|
568 |
|
---|
569 | -void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
---|
570 | +void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height) {
|
---|
571 | hq2x_16(srcPtr, dstPtr, width, height, srcPitch, dstPitch);
|
---|
572 | }
|
---|
573 |
|
---|
574 | @@ -139,7 +139,7 @@
|
---|
575 | #undef bitFormat
|
---|
576 | #endif
|
---|
577 |
|
---|
578 | -void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
---|
579 | +void HQ2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height) {
|
---|
580 | #ifdef HAS_ALTIVEC
|
---|
581 | if (isAltiVecAvailable()) {
|
---|
582 | if (gBitFormat == 565)
|
---|
583 | Index: common/scaler/hq3x.cpp
|
---|
584 | ===================================================================
|
---|
585 | RCS file: /cvsroot/scummvm/scummvm/common/scaler/hq3x.cpp,v
|
---|
586 | retrieving revision 1.10
|
---|
587 | diff -u -r1.10 hq3x.cpp
|
---|
588 | --- common/scaler/hq3x.cpp 21 May 2004 17:30:51 -0000 1.10
|
---|
589 | +++ common/scaler/hq3x.cpp 25 Oct 2004 17:37:19 -0000
|
---|
590 | @@ -35,7 +35,7 @@
|
---|
591 |
|
---|
592 | }
|
---|
593 |
|
---|
594 | -void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
---|
595 | +void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height) {
|
---|
596 | hq3x_16(srcPtr, dstPtr, width, height, srcPitch, dstPitch);
|
---|
597 | }
|
---|
598 |
|
---|
599 | @@ -141,7 +141,7 @@
|
---|
600 | #undef bitFormat
|
---|
601 | #endif
|
---|
602 |
|
---|
603 | -void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
---|
604 | +void HQ3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height) {
|
---|
605 | #ifdef HAS_ALTIVEC
|
---|
606 | if (isAltiVecAvailable()) {
|
---|
607 | if (gBitFormat == 565)
|
---|
608 | Index: common/scaler/intern.h
|
---|
609 | ===================================================================
|
---|
610 | RCS file: /cvsroot/scummvm/scummvm/common/scaler/intern.h,v
|
---|
611 | retrieving revision 1.12
|
---|
612 | diff -u -r1.12 intern.h
|
---|
613 | --- common/scaler/intern.h 21 May 2004 02:08:47 -0000 1.12
|
---|
614 | +++ common/scaler/intern.h 25 Oct 2004 17:37:20 -0000
|
---|
615 | @@ -157,7 +157,7 @@
|
---|
616 |
|
---|
617 | /** Auxiliary macro to simplify creating those template function wrappers. */
|
---|
618 | #define MAKE_WRAPPER(FUNC) \
|
---|
619 | - void FUNC(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) { \
|
---|
620 | + void FUNC(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int x, int y, int width, int height) { \
|
---|
621 | if (gBitFormat == 565) \
|
---|
622 | FUNC ## Template<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height); \
|
---|
623 | else \
|
---|