MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / scale2x

Function scale2x

src/Engine/Scalers/scalebit.cpp:138–167  ·  view source on GitHub ↗

* Apply the Scale2x effect on a bitmap. * The destination bitmap is filled with the scaled version of the source bitmap. * The source bitmap isn't modified. * The destination bitmap must be manually allocated before calling the function, * note that the resulting size is exactly 2x2 times the size of the source bitmap. * \param void_dst Pointer at the first pixel of the destination bitmap. *

Source from the content-addressed store, hash-verified

136 * \param height Vertical size in pixels of the source bitmap.
137 */
138static void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height)
139{
140 unsigned char* dst = (unsigned char*)void_dst;
141 const unsigned char* src = (const unsigned char*)void_src;
142 unsigned count;
143
144 assert(height >= 2);
145
146 count = height;
147
148 stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width);
149
150 dst = SCDST(2);
151
152 count -= 2;
153 while (count) {
154 stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width);
155
156 dst = SCDST(2);
157 src = SCSRC(1);
158
159 --count;
160 }
161
162 stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width);
163
164#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
165 scale2x_mmx_emms();
166#endif
167}
168
169/**
170 * Apply the Scale2x3 effect on a bitmap.

Callers 1

scaleFunction · 0.85

Calls 2

stage_scale2xFunction · 0.85
scale2x_mmx_emmsFunction · 0.85

Tested by

no test coverage detected