1 /* ScummVM - Graphic Adventure Engine
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #ifndef GRAPHICS_SCALER_H
26 #define GRAPHICS_SCALER_H
28 #include "common/scummsys.h"
29 #include "graphics/surface.h"
31 extern void InitScalers(uint32 BitFormat
);
32 extern void DestroyScalers();
34 typedef void ScalerProc(const uint8
*srcPtr
, uint32 srcPitch
,
35 uint8
*dstPtr
, uint32 dstPitch
, int width
, int height
);
37 #define DECLARE_SCALER(x) \
38 extern void x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, \
39 uint32 dstPitch, int width, int height)
41 DECLARE_SCALER(_2xSaI
);
42 DECLARE_SCALER(Super2xSaI
);
43 DECLARE_SCALER(SuperEagle
);
44 DECLARE_SCALER(AdvMame2x
);
45 DECLARE_SCALER(AdvMame3x
);
46 DECLARE_SCALER(Normal1x
);
47 DECLARE_SCALER(Normal2x
);
48 #ifdef USE_ARM_SCALER_ASM
49 DECLARE_SCALER(Normal2xAspect
);
51 DECLARE_SCALER(Normal3x
);
52 DECLARE_SCALER(Normal1o5x
);
54 DECLARE_SCALER(DotMatrix
);
56 #ifndef DISABLE_HQ_SCALERS
61 FORCEINLINE
int real2Aspect(int y
) {
62 return y
+ (y
+ 1) / 5;
65 FORCEINLINE
int aspect2Real(int y
) {
66 return (y
* 5 + 4) / 6;
69 extern void makeRectStretchable(int &x
, int &y
, int &w
, int &h
);
71 extern int stretch200To240(uint8
*buf
, uint32 pitch
, int width
, int height
, int srcX
, int srcY
, int origSrcY
);
73 // creates a 160x100 thumbnail for 320x200 games
74 // and 160x120 thumbnail for 320x240 and 640x480 games
77 kThumbnailWidth
= 160,
78 kThumbnailHeight1
= 100,
79 kThumbnailHeight2
= 120
83 * Creates a thumbnail from the current screen (without overlay).
85 * @param surf a surface (will always have 16 bpp after this for now)
86 * @return false if a error occured
88 extern bool createThumbnailFromScreen(Graphics::Surface
*surf
);
91 * Creates a thumbnail from a buffer.
93 * @param surf destination surface (will always have 16 bpp after this for now)
94 * @param pixels raw pixel data
97 * @param palette palette in RGB format
99 extern bool createThumbnail(Graphics::Surface
*surf
, const uint8
*pixels
, int w
, int h
, const uint8
*palette
);