Modify WinCE, LinuxMoto and GP2xWiz backends to use graphics/scaler/downscaler* code (untested as of now)
svn-id: r45975
This commit is contained in:
parent
974b49ebfe
commit
8aa4083bc9
17 changed files with 66 additions and 489 deletions
|
@ -24,13 +24,13 @@
|
|||
*/
|
||||
|
||||
#include "backends/platform/gp2xwiz/gp2xwiz-sdl.h"
|
||||
#include "backends/platform/gp2xwiz/gp2xwiz-scaler.h" // TODO: Make GFX_HALF/HalfScale generic.
|
||||
|
||||
#include "common/mutex.h"
|
||||
#include "graphics/font.h"
|
||||
#include "graphics/fontman.h"
|
||||
#include "graphics/scaler.h"
|
||||
#include "graphics/scaler/intern.h"
|
||||
#include "graphics/scaler/downscaler.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
|
||||
|
@ -91,7 +91,7 @@ void OSystem_GP2XWIZ::setGraphicsModeIntern() {
|
|||
newScalerProc = Normal1x;
|
||||
break;
|
||||
case GFX_HALF:
|
||||
newScalerProc = HalfScale;
|
||||
newScalerProc = DownscaleAllByHalf;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -368,7 +368,7 @@ void OSystem_GP2XWIZ::internUpdateScreen() {
|
|||
|
||||
assert(scalerProc != NULL);
|
||||
|
||||
if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale){
|
||||
if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf){
|
||||
if (dst_x%2==1){
|
||||
dst_x--;
|
||||
dst_w++;
|
||||
|
@ -386,7 +386,7 @@ void OSystem_GP2XWIZ::internUpdateScreen() {
|
|||
(byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
|
||||
}
|
||||
|
||||
if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale){
|
||||
if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf){
|
||||
r->w = r->w / 2;
|
||||
r->h = dst_h / 2;
|
||||
} else {
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
#include "graphics/scaler/intern.h"
|
||||
#include "backends/platform/gp2xwiz/gp2xwiz-sdl.h"
|
||||
|
||||
extern "C" {
|
||||
void PocketPCHalfARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask, int round);
|
||||
// Rounding constants and masks used for different pixel formats
|
||||
int roundingconstants[] = { 0x00200802, 0x00201002 };
|
||||
int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F };
|
||||
}
|
||||
|
||||
void HalfScale(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
int maskUsed = (gBitFormat == 565);
|
||||
PocketPCHalfARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed],roundingconstants[maskUsed]);
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GP2XWIZ_SCALER_H
|
||||
#define GP2XWIZ_SCALER_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/system.h"
|
||||
#include "graphics/scaler.h"
|
||||
#include "graphics/scaler/intern.h"
|
||||
|
||||
// FIXME: For now keep hacks in this header to save polluting the SDL backend.
|
||||
enum {
|
||||
GFX_HALF = 12
|
||||
};
|
||||
|
||||
// TODO/FIXME: Move this platform specific scaler into /graphics/scaler and properly merge with the WinCE PocketPCHalf that it is based on.
|
||||
DECLARE_SCALER(HalfScale);
|
||||
|
||||
#endif
|
|
@ -27,9 +27,11 @@
|
|||
#define GP2XWIZ_SDL_H
|
||||
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
#include "backends/platform/gp2xwiz/gp2xwiz-scaler.h"
|
||||
|
||||
#include <SDL.h>
|
||||
// FIXME: For now keep hacks in this header to save polluting the SDL backend.
|
||||
enum {
|
||||
GFX_HALF = 12
|
||||
};
|
||||
|
||||
#define __GP2XWIZ__
|
||||
#define MIXER_DOUBLE_BUFFERING 1
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
MODULE := backends/platform/gp2xwiz
|
||||
|
||||
MODULE_OBJS := \
|
||||
gp2xwiz-scaler.o \
|
||||
../wince/ARMscaler.o \
|
||||
gp2xwiz-graphics.o \
|
||||
gp2xwiz-events.o \
|
||||
gp2xwiz-graphics.o \
|
||||
gp2xwiz-hw.o \
|
||||
gp2xwiz-main.o \
|
||||
gp2xwiz-main.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
backends/platform/gp2xwiz/
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
*/
|
||||
|
||||
#include "backends/platform/linuxmoto/linuxmoto-sdl.h"
|
||||
#include "backends/platform/linuxmoto/linuxmoto-scaler.h" // TODO: Make GFX_HALF/HalfScale generic.
|
||||
|
||||
#include "common/mutex.h"
|
||||
#include "graphics/font.h"
|
||||
#include "graphics/fontman.h"
|
||||
#include "graphics/scaler.h"
|
||||
#include "graphics/scaler/intern.h"
|
||||
#include "graphics/scaler/downscaler.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
|
||||
|
@ -91,7 +91,7 @@ void OSystem_LINUXMOTO::setGraphicsModeIntern() {
|
|||
newScalerProc = Normal1x;
|
||||
break;
|
||||
case GFX_HALF:
|
||||
newScalerProc = HalfScale;
|
||||
newScalerProc = DownscaleAllByHalf;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -386,7 +386,7 @@ void OSystem_LINUXMOTO::internUpdateScreen() {
|
|||
|
||||
assert(scalerProc != NULL);
|
||||
|
||||
if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale) {
|
||||
if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf) {
|
||||
|
||||
if (dst_x%2==1) {
|
||||
dst_x--;
|
||||
|
@ -411,7 +411,7 @@ void OSystem_LINUXMOTO::internUpdateScreen() {
|
|||
(byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
|
||||
}
|
||||
|
||||
if (_videoMode.mode == GFX_HALF && scalerProc == HalfScale) {
|
||||
if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf) {
|
||||
r->w = r->w / 2;
|
||||
r->h = dst_h / 2;
|
||||
} else {
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "graphics/scaler/intern.h"
|
||||
#include "backends/platform/linuxmoto/linuxmoto-sdl.h"
|
||||
|
||||
extern "C" {
|
||||
void PocketPCHalfARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask, int round);
|
||||
// Rounding constants and masks used for different pixel formats
|
||||
int roundingconstants[] = { 0x00200802, 0x00201002 };
|
||||
int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F };
|
||||
}
|
||||
|
||||
void HalfScale(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
int maskUsed = (gBitFormat == 565);
|
||||
PocketPCHalfARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed],roundingconstants[maskUsed]);
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LINUXMOTO_SCALER_H
|
||||
#define LINUXMOTO_SCALER_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/system.h"
|
||||
#include "graphics/scaler.h"
|
||||
#include "graphics/scaler/intern.h"
|
||||
|
||||
// FIXME: For now keep hacks in this header to save polluting the SDL backend.
|
||||
enum {
|
||||
GFX_HALF = 12
|
||||
};
|
||||
|
||||
// TODO/FIXME: Move this platform specific scaler into /graphics/scaler and properly merge with the WinCE PocketPCHalf that it is based on.
|
||||
DECLARE_SCALER(HalfScale);
|
||||
|
||||
#endif
|
|
@ -27,9 +27,11 @@
|
|||
#define LINUXMOTO_SDL
|
||||
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
#include "backends/platform/linuxmoto/linuxmoto-scaler.h"
|
||||
|
||||
#include <SDL.h>
|
||||
// FIXME: For now keep hacks in this header to save polluting the SDL backend.
|
||||
enum {
|
||||
GFX_HALF = 12
|
||||
};
|
||||
|
||||
class OSystem_LINUXMOTO : public OSystem_SDL {
|
||||
private:
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
MODULE := backends/platform/linuxmoto
|
||||
|
||||
MODULE_OBJS := \
|
||||
linuxmoto-main.o \
|
||||
linuxmoto-events.o \
|
||||
linuxmoto-sdl.o \
|
||||
linuxmoto-scaler.o \
|
||||
linuxmoto-graphics.o \
|
||||
hardwarekeys.o \
|
||||
../wince/ARMscaler.o
|
||||
linuxmoto-main.o \
|
||||
linuxmoto-sdl.o \
|
||||
hardwarekeys.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
backends/platform/linuxmoto/
|
||||
|
|
|
@ -1,184 +0,0 @@
|
|||
@ ScummVM Scumm Interpreter
|
||||
@ Copyright (C) 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
@
|
||||
@ $URL$
|
||||
@ $Id$
|
||||
@
|
||||
@ @author Robin Watts (robin@wss.co.uk)
|
||||
|
||||
.text
|
||||
|
||||
.global PocketPCHalfARM
|
||||
|
||||
@ ARM implementation of PocketPCHalf scaler.
|
||||
@ Scales a width x height block of 16bpp pixels from srcPtr to
|
||||
@ dstPtr. srcPitch and dstPitch identify how to reach subsequent
|
||||
@ lines. redblueMask and round allow for one routine to do both
|
||||
@ 565 and 555 formats.
|
||||
PocketPCHalfARM:
|
||||
@ r0 = srcPtr
|
||||
@ r1 = srcPitch
|
||||
@ r2 = dstPtr
|
||||
@ r3 = dstPitch
|
||||
MOV r12,r13
|
||||
STMFD r13!,{r4-r11,r14}
|
||||
LDMIA r12,{r4-r7}
|
||||
@ r4 = width
|
||||
@ r5 = height
|
||||
@ r6 = redblueMask
|
||||
@ r7 = round
|
||||
|
||||
SUB r3,r3,r4 @ dstPitch -= width
|
||||
SUBS r5,r5,#2 @ while ((height-=2) >= 0)
|
||||
BLT end
|
||||
height_loop:
|
||||
|
||||
SUBS r11, r4, #8 @ r11= width_minus_8
|
||||
BLT thin
|
||||
|
||||
width_loop:
|
||||
@ unroll loop 4 times here
|
||||
LDRH r8,[r0],r1 @ r8 = A = srcPtr[0]
|
||||
LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch]
|
||||
LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2]
|
||||
LDRH r14,[r0],#2 @ r14= B = srcPtr[2]
|
||||
|
||||
ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r
|
||||
ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r
|
||||
ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r
|
||||
ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r
|
||||
AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r
|
||||
AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r
|
||||
AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r
|
||||
ADD r8, r8, r9
|
||||
ADD r8, r8, r12
|
||||
ADD r8, r8, r14
|
||||
ADD r8, r8, r7 @ r8 = summed pixels + rounding
|
||||
AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
ORR r10,r8, r8, LSR #16 @ r10= 0 | g | 0 | b | g | r
|
||||
|
||||
LDRH r8,[r0],r1 @ r8 = A = srcPtr[0]
|
||||
LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch]
|
||||
LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2]
|
||||
LDRH r14,[r0],#2 @ r14= B = srcPtr[2]
|
||||
|
||||
STRH r10,[r2],#2 @ *dstPtr++
|
||||
|
||||
ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r
|
||||
ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r
|
||||
ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r
|
||||
ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r
|
||||
AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r
|
||||
AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r
|
||||
AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r
|
||||
ADD r8, r8, r9
|
||||
ADD r8, r8, r12
|
||||
ADD r8, r8, r14
|
||||
ADD r8, r8, r7 @ r8 = summed pixels + rounding
|
||||
AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
ORR r10,r8, r8, LSR #16 @ r10= 0 | g | 0 | b | g | r
|
||||
|
||||
LDRH r8,[r0],r1 @ r8 = A = srcPtr[0]
|
||||
LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch]
|
||||
LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2]
|
||||
LDRH r14,[r0],#2 @ r14= B = srcPtr[2]
|
||||
|
||||
STRH r10,[r2],#2 @ *dstPtr++
|
||||
|
||||
ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r
|
||||
ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r
|
||||
ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r
|
||||
ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r
|
||||
AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r
|
||||
AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r
|
||||
AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r
|
||||
ADD r8, r8, r9
|
||||
ADD r8, r8, r12
|
||||
ADD r8, r8, r14
|
||||
ADD r8, r8, r7 @ r8 = summed pixels + rounding
|
||||
AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
ORR r10,r8, r8, LSR #16 @ r10= 0 | g | 0 | b | g | r
|
||||
|
||||
LDRH r8,[r0],r1 @ r8 = A = srcPtr[0]
|
||||
LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch]
|
||||
LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2]
|
||||
LDRH r14,[r0],#2 @ r14= B = srcPtr[2]
|
||||
|
||||
STRH r10,[r2],#2 @ *dstPtr++
|
||||
|
||||
ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r
|
||||
ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r
|
||||
ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r
|
||||
ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r
|
||||
AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r
|
||||
AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r
|
||||
AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r
|
||||
ADD r8, r8, r9
|
||||
ADD r8, r8, r12
|
||||
ADD r8, r8, r14
|
||||
ADD r8, r8, r7 @ r8 = summed pixels + rounding
|
||||
AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
ORR r10, r8, r8, LSR #16 @ r8 = 0 | g | 0 | b | g | r
|
||||
|
||||
STRH r10,[r2],#2 @ *dstPtr++
|
||||
|
||||
SUBS r11,r11,#8 @ width_minus_8 -= 8
|
||||
BGE width_loop @ (width_minus_8 >= 0) => do 8+ more
|
||||
|
||||
thin:
|
||||
ADDS r11,r11,#8 @ r11= width
|
||||
BEQ width_end @ if no more left to do, then bail
|
||||
thin_lp:
|
||||
@ single output pixels done in this bit
|
||||
LDRH r8,[r0],r1 @ r8 = A = srcPtr[0]
|
||||
LDRH r9,[r0],#2 @ r9 = C = srcPtr[dstPitch]
|
||||
LDRH r12,[r0],-r1 @ r12= D = srcPtr[dstPitch+2]
|
||||
LDRH r14,[r0],#2 @ r14= B = srcPtr[2]
|
||||
|
||||
ORR r8, r8, r8, LSL #16 @ r8 = b | g | r | b | g | r
|
||||
ORR r9, r9, r9, LSL #16 @ r9 = b | g | r | b | g | r
|
||||
ORR r12,r12,r12,LSL #16 @ r12= b | g | r | b | g | r
|
||||
ORR r14,r14,r14,LSL #16 @ r14= b | g | r | b | g | r
|
||||
AND r8, r8, r6 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
AND r9, r9, r6 @ r9 = 0 | g | 0 | b | 0 | r
|
||||
AND r12,r12,r6 @ r12= 0 | g | 0 | b | 0 | r
|
||||
AND r14,r14,r6 @ r14= 0 | g | 0 | b | 0 | r
|
||||
ADD r8, r8, r9
|
||||
ADD r8, r8, r12
|
||||
ADD r8, r8, r14
|
||||
ADD r8, r8, r7 @ r8 = summed pixels + rounding
|
||||
AND r8, r6, r8, LSR #2 @ r8 = 0 | g | 0 | b | 0 | r
|
||||
ORR r8, r8, r8, LSR #16 @ r8 = 0 | g | 0 | b | g | r
|
||||
|
||||
STRH r8,[r2],#2 @ *dstPtr++
|
||||
|
||||
SUBS r11,r11,#2
|
||||
BGT thin_lp
|
||||
width_end:
|
||||
ADD r2,r2,r3 @ dstPtr += dstPitch
|
||||
ADD r0,r0,r1,LSL #1 @ srcPtr += 2*srcPitch
|
||||
SUB r0,r0,r4,LSL #1 @ srcPtr -= 2*width
|
||||
|
||||
SUBS r5,r5,#2
|
||||
BGE height_loop
|
||||
|
||||
end:
|
||||
LDMFD r13!,{r4-r11,PC}
|
|
@ -25,10 +25,6 @@
|
|||
#include "graphics/scaler/intern.h"
|
||||
#include "CEScaler.h"
|
||||
|
||||
/**
|
||||
* This filter (down)scales the source image horizontally by a factor of 3/4.
|
||||
* For example, a 320x200 image is scaled to 240x200.
|
||||
*/
|
||||
template<int bitFormat>
|
||||
void PocketPCPortraitTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
uint16 *work;
|
||||
|
@ -57,14 +53,6 @@ void PocketPCPortraitTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPt
|
|||
}
|
||||
MAKE_WRAPPER(PocketPCPortrait)
|
||||
|
||||
/**
|
||||
* This filter (up)scales the source image vertically by a factor of 6/5.
|
||||
* For example, a 320x200 image is scaled to 320x240.
|
||||
*
|
||||
* The main difference to the code in graphics/scaler/aspect.cpp is the
|
||||
* out-of-place operation, omitting a straight blit step the sdl backend
|
||||
* does. Also, tests show unaligned access errors with the stock aspect scaler.
|
||||
*/
|
||||
void PocketPCLandscapeAspect(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
|
||||
const int redblueMasks[] = { 0x7C1F, 0xF81F };
|
||||
|
@ -128,79 +116,17 @@ void PocketPCLandscapeAspect(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr
|
|||
|
||||
#ifdef ARM
|
||||
extern "C" {
|
||||
void PocketPCHalfARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask, int round);
|
||||
void SmartphoneLandscapeARM(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height, int mask);
|
||||
}
|
||||
|
||||
void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
// Rounding constants and masks used for different pixel formats
|
||||
int roundingconstants[] = { 0x00200802, 0x00201002 };
|
||||
int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F };
|
||||
}
|
||||
#endif
|
||||
|
||||
template<int bitFormat>
|
||||
void PocketPCHalfTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
uint8 *work;
|
||||
uint16 srcPitch16 = (uint16)(srcPitch / sizeof(uint16));
|
||||
|
||||
while ((height -= 2) >= 0) {
|
||||
work = dstPtr;
|
||||
|
||||
for (int i=0; i<width; i+=2) {
|
||||
// Another lame filter attempt :)
|
||||
uint16 color1 = *(((const uint16 *)srcPtr) + i);
|
||||
uint16 color2 = *(((const uint16 *)srcPtr) + (i + 1));
|
||||
uint16 color3 = *(((const uint16 *)srcPtr) + (i + srcPitch16));
|
||||
uint16 color4 = *(((const uint16 *)srcPtr) + (i + srcPitch16 + 1));
|
||||
*(((uint16 *)work) + 0) = interpolate16_1_1_1_1<bitFormat>(color1, color2, color3, color4);
|
||||
|
||||
work += sizeof(uint16);
|
||||
}
|
||||
srcPtr += 2 * srcPitch;
|
||||
dstPtr += dstPitch;
|
||||
}
|
||||
static const int redbluegreenMasks[] = { 0x03E07C1F, 0x07E0F81F };
|
||||
const int maskUsed = (gBitFormat == 565);
|
||||
SmartphoneLandscapeARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This filter (down)scales the source image by a factor of 1/2.
|
||||
* For example, a 320x200 image is scaled to 160x100.
|
||||
*/
|
||||
void PocketPCHalf(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
#ifdef ARM
|
||||
int maskUsed = (gBitFormat == 565);
|
||||
PocketPCHalfARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed], roundingconstants[maskUsed]);
|
||||
#else
|
||||
if (gBitFormat == 565)
|
||||
PocketPCHalfTemplate<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
else
|
||||
PocketPCHalfTemplate<555>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* This filter (down)scales the source image horizontally by a factor of 1/2.
|
||||
* For example, a 320x200 image is scaled to 160x200.
|
||||
*/
|
||||
template<int bitFormat>
|
||||
void PocketPCHalfZoomTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
uint16 *work;
|
||||
|
||||
if (!height)
|
||||
return;
|
||||
|
||||
// Various casts below go via (void *) to avoid warning. This is
|
||||
// safe as these are all even addresses.
|
||||
while (height--) {
|
||||
work = (uint16 *)(void *)dstPtr;
|
||||
|
||||
for (int i = 0; i < width; i += 2) {
|
||||
uint16 color1 = *(((const uint16 *)(const void *)srcPtr) + i);
|
||||
uint16 color2 = *(((const uint16 *)(const void *)srcPtr) + (i + 1));
|
||||
*work++ = interpolate32_1_1<bitFormat>(color1, color2);
|
||||
}
|
||||
srcPtr += srcPitch;
|
||||
dstPtr += dstPitch;
|
||||
}
|
||||
}
|
||||
MAKE_WRAPPER(PocketPCHalfZoom)
|
||||
|
||||
template<int bitFormat>
|
||||
void SmartphoneLandscapeTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
|
@ -231,22 +157,7 @@ void SmartphoneLandscapeTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *ds
|
|||
}
|
||||
}
|
||||
}
|
||||
MAKE_WRAPPER(SmartphoneLandscape)
|
||||
|
||||
/**
|
||||
* This filter (down)scales the source image horizontally by a factor of 2/3
|
||||
* and vertically by 7/8. For example, a 320x200 image is scaled to 213x175.
|
||||
*
|
||||
* @note The ARM asm version seems to work differently ?!? It apparently scales
|
||||
* horizontally by 11/16. Thus a 320x200 image is scaled to 220x175.
|
||||
*/
|
||||
void SmartphoneLandscape(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
#ifdef ARM
|
||||
int maskUsed = (gBitFormat == 565);
|
||||
SmartphoneLandscapeARM(srcPtr, srcPitch, dstPtr, dstPitch, width, height, redbluegreenMasks[maskUsed]);
|
||||
#else
|
||||
if (gBitFormat == 565)
|
||||
SmartphoneLandscapeTemplate<565>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
else
|
||||
SmartphoneLandscapeTemplate<555>(srcPtr, srcPitch, dstPtr, dstPitch, width, height);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -31,12 +31,29 @@
|
|||
#include "graphics/scaler.h"
|
||||
#include "graphics/scaler/intern.h"
|
||||
|
||||
/**
|
||||
* This filter (down)scales the source image horizontally by a factor of 3/4.
|
||||
* For example, a 320x200 image is scaled to 240x200.
|
||||
*/
|
||||
DECLARE_SCALER(PocketPCPortrait);
|
||||
|
||||
/**
|
||||
* This filter (up)scales the source image vertically by a factor of 6/5.
|
||||
* For example, a 320x200 image is scaled to 320x240.
|
||||
*
|
||||
* The main difference to the code in graphics/scaler/aspect.cpp is the
|
||||
* out-of-place operation, omitting a straight blit step the sdl backend
|
||||
* does. Also, tests show unaligned access errors with the stock aspect scaler.
|
||||
*/
|
||||
DECLARE_SCALER(PocketPCLandscapeAspect);
|
||||
DECLARE_SCALER(PocketPCHalf);
|
||||
DECLARE_SCALER(PocketPCHalfZoom);
|
||||
//#ifdef WIN32_PLATFORM_WFSP
|
||||
|
||||
/**
|
||||
* This filter (down)scales the source image horizontally by a factor of 2/3
|
||||
* and vertically by 7/8. For example, a 320x200 image is scaled to 213x175.
|
||||
*
|
||||
* @note The ARM asm version seems to work differently ?!? It apparently scales
|
||||
* horizontally by 11/16. Thus a 320x200 image is scaled to 220x175.
|
||||
*/
|
||||
DECLARE_SCALER(SmartphoneLandscape);
|
||||
//#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -189,7 +189,6 @@ OBJS += CEkeys/EventsBuffer.o
|
|||
OBJS += $(srcdir)/gui/Actions.o $(srcdir)/gui/Key.o $(srcdir)/gui/KeysDialog.o
|
||||
OBJS += ../sdl/sdl.o ../sdl/graphics.o ../sdl/events.o ../sdl/hardwarekeys.o
|
||||
OBJS += missing/missing.o
|
||||
OBJS += ARMscaler.o
|
||||
OBJS += smartLandScale.o
|
||||
ifndef DYNAMIC_MODULES
|
||||
OBJS += PocketSCUMM.o
|
||||
|
@ -225,7 +224,7 @@ deploy: deploy-exe
|
|||
|
||||
endif
|
||||
|
||||
dist: ARMscaler.o PocketSCUMM.o $(EXECUTABLE)
|
||||
dist: PocketSCUMM.o $(EXECUTABLE)
|
||||
|
||||
dist-plugins: $(EXECUTABLE) plugins PocketSCUMM.o plugins-stub
|
||||
|
||||
|
@ -235,11 +234,8 @@ plugins-stub: stub.o
|
|||
PocketSCUMM.o: PocketSCUMM.rc
|
||||
$(WINDRES) $*.rc $@
|
||||
|
||||
ARMscaler.o: ARMscaler.s
|
||||
$(AS) $*.s -o $@
|
||||
|
||||
all-clean: clean
|
||||
$(RM) ARMscaler.o PocketSCUMM.o stub.o
|
||||
$(RM) PocketSCUMM.o stub.o
|
||||
|
||||
deploy-plugins: dist-plugins
|
||||
@echo Deploying DLLs
|
||||
|
|
|
@ -26,7 +26,6 @@ MODULE_OBJS := \
|
|||
../sdl/hardwarekeys.o \
|
||||
missing/missing.o \
|
||||
PocketSCUMM.o \
|
||||
ARMscaler.o \
|
||||
smartLandScale.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
|
|
|
@ -50,8 +50,10 @@
|
|||
#include "backends/platform/wince/CEActionsSmartphone.h"
|
||||
#include "backends/platform/wince/CEgui/ItemAction.h"
|
||||
|
||||
#include "graphics/scaler/downscaler.h"
|
||||
|
||||
#include "backends/platform/wince/CEException.h"
|
||||
#include "backends/platform/wince/CEScaler.h"
|
||||
|
||||
#ifdef USE_VORBIS
|
||||
#ifndef USE_TREMOR
|
||||
|
@ -590,19 +592,19 @@ void OSystem_WINCE3::swap_zoom_up() {
|
|||
_toolbarHandler.setVisible(_saveToolbarZoom);
|
||||
// restore scaler
|
||||
_scaleFactorYd = 2;
|
||||
_scalerProc = PocketPCHalf;
|
||||
_scalerProc = DownscaleAllByHalf;
|
||||
_zoomUp = false;
|
||||
_zoomDown = false;
|
||||
} else {
|
||||
// only active if running on a PocketPC
|
||||
if (_scalerProc != PocketPCHalf && _scalerProc != PocketPCHalfZoom)
|
||||
if (_scalerProc != DownscaleAllByHalf && _scalerProc != DownscaleHorizByHalf)
|
||||
return;
|
||||
if (_scalerProc == PocketPCHalf) {
|
||||
if (_scalerProc == DownscaleAllByHalf) {
|
||||
_saveToolbarZoom = _toolbarHandler.visible();
|
||||
_toolbarHandler.setVisible(false);
|
||||
// set zoom scaler
|
||||
_scaleFactorYd = 1;
|
||||
_scalerProc = PocketPCHalfZoom;
|
||||
_scalerProc = DownscaleHorizByHalf;
|
||||
}
|
||||
|
||||
_zoomDown = false;
|
||||
|
@ -619,19 +621,19 @@ void OSystem_WINCE3::swap_zoom_down() {
|
|||
_toolbarHandler.setVisible(_saveToolbarZoom);
|
||||
// restore scaler
|
||||
_scaleFactorYd = 2;
|
||||
_scalerProc = PocketPCHalf;
|
||||
_scalerProc = DownscaleAllByHalf;
|
||||
_zoomDown = false;
|
||||
_zoomUp = false;
|
||||
} else {
|
||||
// only active if running on a PocketPC
|
||||
if (_scalerProc != PocketPCHalf && _scalerProc != PocketPCHalfZoom)
|
||||
if (_scalerProc != DownscaleAllByHalf && _scalerProc != DownscaleHorizByHalf)
|
||||
return;
|
||||
if (_scalerProc == PocketPCHalf) {
|
||||
if (_scalerProc == DownscaleAllByHalf) {
|
||||
_saveToolbarZoom = _toolbarHandler.visible();
|
||||
_toolbarHandler.setVisible(false);
|
||||
// set zoom scaler
|
||||
_scaleFactorYd = 1;
|
||||
_scalerProc = PocketPCHalfZoom;
|
||||
_scalerProc = DownscaleHorizByHalf;
|
||||
}
|
||||
|
||||
_zoomUp = false;
|
||||
|
@ -1180,7 +1182,7 @@ bool OSystem_WINCE3::update_scalers() {
|
|||
_scaleFactorXd = 2;
|
||||
_scaleFactorYm = 1;
|
||||
_scaleFactorYd = 2;
|
||||
_scalerProc = PocketPCHalf;
|
||||
_scalerProc = DownscaleAllByHalf;
|
||||
_modeFlags = 0;
|
||||
} else if (_videoMode.screenWidth == 640 && (isOzone() && (getScreenWidth() >= 640 || getScreenHeight() >= 640))) {
|
||||
_scaleFactorXm = 1;
|
||||
|
|
|
@ -31,12 +31,9 @@
|
|||
#include "graphics/scaler.h"
|
||||
#include "backends/platform/sdl/sdl.h"
|
||||
|
||||
#include "CEGUI.h"
|
||||
#include "CEKeys.h"
|
||||
#include "CEDevice.h"
|
||||
#include "CEScaler.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include "backends/platform/wince/CEGUI.h"
|
||||
#include "backends/platform/wince/CEKeys.h"
|
||||
#include "backends/platform/wince/CEDevice.h"
|
||||
|
||||
#define TOTAL_ZONES 3
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue