[Scummvm-cvs-logs] CVS: scummex scaler.h,NONE,1.1 scaler.cpp,NONE,1.1 Makefile,1.6,1.7 Makefile.mingw,1.1,1.2

Adrien Mercier yoshizf at users.sourceforge.net
Sat Sep 27 03:13:47 CEST 2003


Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv1007

Modified Files:
	Makefile Makefile.mingw 
Added Files:
	scaler.h scaler.cpp 
Log Message:
Added advmame2x and advmame3x scalers

--- NEW FILE: scaler.h ---
/* ScummEX - Viewer for Scumm data files
 * Copyright (C) 2003 Adrien Mercier
 * Copyright (C) 2003 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /cvsroot/scummvm/scummex/scaler.h,v 1.1 2003/09/27 09:53:42 yoshizf Exp $
 *
 */

#ifndef SCALER_H
#define SCALER_H

#include "scummsys.h"

void scale(int scale, const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
void AdvMame2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
void AdvMame3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);

#endif


--- NEW FILE: scaler.cpp ---
/* ScummEX - Viewer for Scumm data files
 * Copyright (C) 2003 Adrien Mercier
 * Copyright (C) 2003 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header: /cvsroot/scummvm/scummex/scaler.cpp,v 1.1 2003/09/27 09:53:42 yoshizf Exp $
 *
 */

#include "scaler.h"

void AdvMame2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
							 int width, int height) {
	const uint32 nextlineSrc = srcPitch / sizeof(uint8);
	const uint8 *p = srcPtr;

	const uint32 nextlineDst = dstPitch / sizeof(uint8);
	uint8 *q = dstPtr;
	
	uint8 A, B, C;
	uint8 D, E, F;
	uint8 G, H, I;

	while (height--) {
		B = *(p - 1 - nextlineSrc);
		E = *(p - 1);
		H = *(p - 1 + nextlineSrc);
		C = *(p - nextlineSrc);
		F = *(p);
		I = *(p + nextlineSrc);
		for (int i = 0; i < width; ++i) {
			p++;
			A = B; B = C; C = *(p - nextlineSrc);
			D = E; E = F; F = *(p);
			G = H; H = I; I = *(p + nextlineSrc);

			*(q) = D == B && B != F && D != H ? D : E;
			*(q + 1) = B == F && B != D && F != H ? F : E;
			*(q + nextlineDst) = D == H && D != B && H != F ? D : E;
			*(q + nextlineDst + 1) = H == F && D != H && B != F ? F : E;
			q += 2;
		}
		p += nextlineSrc - width;
		q += (nextlineDst - width) << 1;
	}
}

void AdvMame3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
							 int width, int height) {
	const uint32 nextlineSrc = srcPitch / sizeof(uint8);
	const uint8 *p = srcPtr;

	const uint32 nextlineDst = dstPitch / sizeof(uint8);
	uint8 *q = dstPtr;
	
	uint8 A, B, C;
	uint8 D, E, F;
	uint8 G, H, I;

	while (height--) {
		B = *(p - 1 - nextlineSrc);
		E = *(p - 1);
		H = *(p - 1 + nextlineSrc);
		C = *(p - nextlineSrc);
		F = *(p);
		I = *(p + nextlineSrc);
		for (int i = 0; i < width; ++i) {
			p++;
			A = B; B = C; C = *(p - nextlineSrc);
			D = E; E = F; F = *(p);
			G = H; H = I; I = *(p + nextlineSrc);

			*(q) = D == B && B != F && D != H ? D : E;
			*(q + 1) = E;
			*(q + 2) = B == F && B != D && F != H ? F : E;
			*(q + nextlineDst) = E;
			*(q + nextlineDst + 1) = E;
			*(q + nextlineDst + 2) = E;
			*(q + 2 * nextlineDst) = D == H && D != B && H != F ? D : E;
			*(q + 2 * nextlineDst + 1) = E;
			*(q + 2 * nextlineDst + 2) = H == F && D != H && B != F ? F : E;
			q += 3;
		}
		p += nextlineSrc - width;
		q += (nextlineDst - width) * 3;
	}
}

void scale(int scale, const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
	switch (scale) {
		case 2 : 
			AdvMame2x(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
			break;
		case 3 :
			AdvMame3x(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
			break;
	}
}

Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummex/Makefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile	21 Sep 2003 23:50:28 -0000	1.6
+++ Makefile	27 Sep 2003 09:53:42 -0000	1.7
@@ -11,7 +11,7 @@
 
 RESSW    := --define __WIN32__ --define __WIN95__ --define __GNUWIN32__
 REZ_CMD  := `wx-config --rezflags`
-OBJS     := file.o scummex.o resource.o mixer.o image.o sound.o wxwindows.o descumm.o descumm6.o codec37.o codec47.o bomp.o
+OBJS     := file.o scummex.o resource.o mixer.o image.o sound.o wxwindows.o descumm.o descumm6.o codec37.o codec47.o bomp.o scaler.o
 CXXFLAGS := -DOSUNIX -g -O -Wall -Wuninitialized -Wshadow -Wstrict-prototypes -Wno-unused-variable -Wno-long-long -Wno-multichar -Wno-unknown-pragmas
 CXXFLAGS += `wx-config --cxxflags` `sdl-config --cflags`
 LIBS     := `wx-config --libs` `sdl-config --libs` -lSDL_mixer

Index: Makefile.mingw
===================================================================
RCS file: /cvsroot/scummvm/scummex/Makefile.mingw,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.mingw	26 Sep 2003 00:39:50 -0000	1.1
+++ Makefile.mingw	27 Sep 2003 09:53:42 -0000	1.2
@@ -11,7 +11,7 @@
 
 CC=g++
 OBJECTS= bomp.o codec37.o codec47.o descumm.o descumm6.o file.o image.o mixer.o resource.o resources.o \
-	 scummex.o sound.o wxwindows.o
+	 scaler.o scummex.o sound.o wxwindows.o
 CFLAGS= $(SDL_CFLAGS) $(WX_CFLAGS) -O -Wall -Wstrict-prototypes -Wuninitialized -Wno-long-long -Wno-multichar -Wno-unknown-pragmas
 LIBS= $(SDL_LIBS) $(WX_LIBS) -lmingw32
 





More information about the Scummvm-git-logs mailing list