[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [278] branches/fusegl/fuse
Brought to you by:
fredm
From: <fr...@us...> - 2007-01-02 10:11:46
|
Revision: 278 http://svn.sourceforge.net/fuse-for-macosx/?rev=278&view=rev Author: fredm Date: 2007-01-02 02:11:45 -0800 (Tue, 02 Jan 2007) Log Message: ----------- Switch to using 16 bit textures. Re-enable hq[23]x scalers. Modified Paths: -------------- branches/fusegl/fuse/TODO branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m branches/fusegl/fuse/ui/cocoa/cocoadisplay.c branches/fusegl/fuse/ui/scaler/scaler.c Removed Paths: ------------- branches/fusegl/fuse/fusepb/scaler/scalers32.cpp Modified: branches/fusegl/fuse/TODO =================================================================== --- branches/fusegl/fuse/TODO 2007-01-01 12:33:46 UTC (rev 277) +++ branches/fusegl/fuse/TODO 2007-01-02 10:11:45 UTC (rev 278) @@ -11,15 +11,18 @@ X Add native mouse processing (removes SDL mouse input dependency from Fuse) X Make it possible to constrain Speccy image to "correct" aspect ratio X Restore fullscreen support -* Fix scalers +X Fix scalers * Add support for bilinear etc. OpenGL filters -* Add option to snap window size to 1x, 2x, 3x +* Add option to snap window size to 1x, 2x, 3x GL_NEAREST filter +* Grab mouse in fullscreen mode * Use sheets rather than modal dialogs * Run emulation in seperate thread to avoid sound glitches when menus are - selected + selected or window is minimised * Restore activity icons * Add native joystick processing (removes SDL joystick input dependency from Fuse) * Fix screen updating during fastloading +* Put in latest hq[23]x filters (HQ2x_555 from ScummVM should do the trick) +* Make border display optional $Id: TODO,v 1.4 2004/03/02 13:38:08 pak21 Exp $ Modified: branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj =================================================================== --- branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2007-01-01 12:33:46 UTC (rev 277) +++ branches/fusegl/fuse/fusepb/Fuse.xcodeproj/project.pbxproj 2007-01-02 10:11:45 UTC (rev 278) @@ -258,7 +258,11 @@ B650987109366CA2003AF1BF /* szx.icns in Resources */ = {isa = PBXBuildFile; fileRef = B650987009366CA2003AF1BF /* szx.icns */; }; B6825549091817F30014B5EE /* divide.c in Sources */ = {isa = PBXBuildFile; fileRef = B6825547091817F30014B5EE /* divide.c */; }; B682554A091817F30014B5EE /* divide.h in Headers */ = {isa = PBXBuildFile; fileRef = B6825548091817F30014B5EE /* divide.h */; }; - B6A24DF80B490F2100AD5B9D /* scalers32.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6A24DF70B490F2100AD5B9D /* scalers32.cpp */; }; + B6A24E330B49C67D00AD5B9D /* scalers16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6A24E320B49C67D00AD5B9D /* scalers16.cpp */; }; + B6A24E3B0B49C78700AD5B9D /* hq2x.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6A24E370B49C78700AD5B9D /* hq2x.cpp */; }; + B6A24E3C0B49C78700AD5B9D /* hq2x.h in Headers */ = {isa = PBXBuildFile; fileRef = B6A24E380B49C78700AD5B9D /* hq2x.h */; }; + B6A24E3D0B49C78700AD5B9D /* hq3x.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6A24E390B49C78700AD5B9D /* hq3x.cpp */; }; + B6A24E3E0B49C78700AD5B9D /* hq3x.h in Headers */ = {isa = PBXBuildFile; fileRef = B6A24E3A0B49C78700AD5B9D /* hq3x.h */; }; B6A6F0960B3C108C000B88E9 /* coreaudiosound.c in Sources */ = {isa = PBXBuildFile; fileRef = B6A6F0950B3C108C000B88E9 /* coreaudiosound.c */; }; B6A6F0DA0B3D141B000B88E9 /* cocoaui.m in Sources */ = {isa = PBXBuildFile; fileRef = B6A6F0D90B3D141B000B88E9 /* cocoaui.m */; }; B6A6F0EE0B3D5F9E000B88E9 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6A6F0ED0B3D5F9E000B88E9 /* CoreAudio.framework */; }; @@ -450,11 +454,15 @@ B68CB2C503DD920300A804BA /* debugger.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = debugger.h; path = ../debugger/debugger.h; sourceTree = "<group>"; }; B68CB2C603DD920300A804BA /* disassemble.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = disassemble.c; path = ../debugger/disassemble.c; sourceTree = "<group>"; }; B68CB2CC03DD923C00A804BA /* memory.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = memory.c; sourceTree = "<group>"; }; - B6A24DF70B490F2100AD5B9D /* scalers32.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = scalers32.cpp; path = scaler/scalers32.cpp; sourceTree = SOURCE_ROOT; }; + B6A24E320B49C67D00AD5B9D /* scalers16.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = scalers16.cpp; path = scaler/scalers16.cpp; sourceTree = SOURCE_ROOT; }; + B6A24E370B49C78700AD5B9D /* hq2x.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = hq2x.cpp; path = scaler/hq2x.cpp; sourceTree = SOURCE_ROOT; }; + B6A24E380B49C78700AD5B9D /* hq2x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hq2x.h; path = scaler/hq2x.h; sourceTree = SOURCE_ROOT; }; + B6A24E390B49C78700AD5B9D /* hq3x.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = hq3x.cpp; path = scaler/hq3x.cpp; sourceTree = SOURCE_ROOT; }; + B6A24E3A0B49C78700AD5B9D /* hq3x.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hq3x.h; path = scaler/hq3x.h; sourceTree = SOURCE_ROOT; }; B6A6F0950B3C108C000B88E9 /* coreaudiosound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = coreaudiosound.c; path = sound/coreaudiosound.c; sourceTree = "<group>"; }; B6A6F0D90B3D141B000B88E9 /* cocoaui.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = cocoaui.m; sourceTree = "<group>"; }; - B6A6F0ED0B3D5F9E000B88E9 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = ../../../../../../../../System/Library/Frameworks/CoreAudio.framework; sourceTree = "<group>"; }; - B6A6F0F20B3D602F000B88E9 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = ../../../../../../../../System/Library/Frameworks/AudioUnit.framework; sourceTree = "<group>"; }; + B6A6F0ED0B3D5F9E000B88E9 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; }; + B6A6F0F20B3D602F000B88E9 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; }; B6A6F10D0B3D6360000B88E9 /* cocoaerror.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = cocoaerror.m; sourceTree = "<group>"; }; B6A6F11D0B3EA737000B88E9 /* cocoascreenshot.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cocoascreenshot.h; sourceTree = "<group>"; }; B6A6F11E0B3EA737000B88E9 /* cocoascreenshot.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = cocoascreenshot.m; sourceTree = "<group>"; }; @@ -953,11 +961,15 @@ F541FB5C03B0B31601FF8235 /* scaler */ = { isa = PBXGroup; children = ( + B6A24E370B49C78700AD5B9D /* hq2x.cpp */, + B6A24E380B49C78700AD5B9D /* hq2x.h */, + B6A24E390B49C78700AD5B9D /* hq3x.cpp */, + B6A24E3A0B49C78700AD5B9D /* hq3x.h */, B6C86978065611B3003000A6 /* intern.h */, B63ABD8D042F175200A864FD /* scaler.c */, F541FB5E03B0B33401FF8235 /* scaler.h */, B60A6A3A042BEECE00D41533 /* scaler_internals.h */, - B6A24DF70B490F2100AD5B9D /* scalers32.cpp */, + B6A24E320B49C67D00AD5B9D /* scalers16.cpp */, ); path = scaler; sourceTree = "<group>"; @@ -1213,6 +1225,8 @@ B6CE7FCD0B28FBD600EB65B3 /* DisplayOpenGLView.h in Headers */, B6A6F11F0B3EA737000B88E9 /* cocoascreenshot.h in Headers */, B615BFE70B4261E50082D535 /* HIDJoysticks.h in Headers */, + B6A24E3C0B49C78700AD5B9D /* hq2x.h in Headers */, + B6A24E3E0B49C78700AD5B9D /* hq3x.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1447,7 +1461,9 @@ B6A6F10E0B3D6360000B88E9 /* cocoaerror.m in Sources */, B6A6F1200B3EA737000B88E9 /* cocoascreenshot.m in Sources */, B615BFE80B4261E50082D535 /* HIDJoysticks.m in Sources */, - B6A24DF80B490F2100AD5B9D /* scalers32.cpp in Sources */, + B6A24E330B49C67D00AD5B9D /* scalers16.cpp in Sources */, + B6A24E3B0B49C78700AD5B9D /* hq2x.cpp in Sources */, + B6A24E3D0B49C78700AD5B9D /* hq3x.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Deleted: branches/fusegl/fuse/fusepb/scaler/scalers32.cpp =================================================================== --- branches/fusegl/fuse/fusepb/scaler/scalers32.cpp 2007-01-01 12:33:46 UTC (rev 277) +++ branches/fusegl/fuse/fusepb/scaler/scalers32.cpp 2007-01-02 10:11:45 UTC (rev 278) @@ -1,28 +0,0 @@ -/* scalers.cpp: the actual graphics scalers - * Copyright (C) 2003 Fredrick Meunier, Philip Kendall - * - * $Id: scalers16.cpp,v 1.1 2004/05/17 14:42:14 fred Exp $ - * - * Originally taken from ScummVM - Scumm Interpreter - * Copyright (C) 2001 Ludvig Strigeus - * Copyright (C) 2001/2002 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. - * - */ - -#define SCALER_DATA_SIZE 4 - -#include "ui/scaler/scalers.cpp" Modified: branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m =================================================================== --- branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-01-01 12:33:46 UTC (rev 277) +++ branches/fusegl/fuse/fusepb/views/DisplayOpenGLView.m 2007-01-02 10:11:45 UTC (rev 278) @@ -170,7 +170,7 @@ glBindTexture( GL_TEXTURE_RECTANGLE_EXT, 1 ); glTexSubImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, screenTex.full_width, - screenTex.full_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + screenTex.full_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, screenTex.pixels ); glBegin( GL_QUADS ); @@ -280,12 +280,12 @@ screenTex.image_height = newScreen->image_height; screenTex.image_xoffset = newScreen->image_xoffset; screenTex.image_yoffset = newScreen->image_yoffset; - screenTex.pixels = calloc( screenTex.full_width * screenTex.full_height, sizeof(uint32_t) ); + screenTex.pixels = calloc( screenTex.full_width * screenTex.full_height, sizeof(uint16_t) ); if( !screenTex.pixels ) { fprintf( stderr, "%s: couldn't create screenTex.pixels\n", fuse_progname ); return; } - screenTex.pitch = screenTex.full_width * sizeof(uint32_t); + screenTex.pitch = screenTex.full_width * sizeof(uint16_t); [[self openGLContext] makeCurrentContext]; [[self openGLContext] update]; @@ -312,7 +312,7 @@ glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 ); glTexImage2D( GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA, screenTex.full_width, - screenTex.full_height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + screenTex.full_height, 0, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, screenTex.pixels ); } screenTexInitialised = YES; Modified: branches/fusegl/fuse/ui/cocoa/cocoadisplay.c =================================================================== --- branches/fusegl/fuse/ui/cocoa/cocoadisplay.c 2007-01-01 12:33:46 UTC (rev 277) +++ branches/fusegl/fuse/ui/cocoa/cocoadisplay.c 2007-01-02 10:11:45 UTC (rev 278) @@ -59,30 +59,33 @@ /* Screen texture */ Cocoa_Texture* screen = NULL; +/* Screen texture in native size */ Cocoa_Texture unscaled_screen; + +/* Screen texture after scaling (only if a transforming scaler is in place) */ Cocoa_Texture scaled_screen; -static uint32_t colour_values[] = { -/* AARRGGBB */ - 0x00000000, - 0x000000c0, - 0x00c00000, - 0x00c000c0, - 0x0000c000, - 0x0000c0c0, - 0x00c0c000, - 0x00c0c0c0, - 0x00000000, - 0x000000ff, - 0x00ff0000, - 0x00ff00ff, - 0x0000ff00, - 0x0000ffff, - 0x00ffff00, - 0x00ffffff +/* Colours are in 1A 5R 5G 5B format */ +static uint16_t colour_values[] = { + 0x0000, + 0x0017, + 0x5c00, + 0x5c17, + 0x02e0, + 0x02f7, + 0x5ee0, + 0x5ef7, + 0x0000, + 0x001f, + 0x7c00, + 0x7c1f, + 0x03e0, + 0x03ff, + 0x7fe0, + 0x7fff }; -static uint32_t bw_values[16]; +static uint16_t bw_values[16]; static void init_scalers( void ) @@ -100,10 +103,8 @@ scaler_register( SCALER_ADVMAME2X ); scaler_register( SCALER_ADVMAME3X ); scaler_register( SCALER_DOTMATRIX ); -#if 0 scaler_register( SCALER_HQ2X ); scaler_register( SCALER_HQ3X ); -#endif } if( scaler_is_supported( current_scaler ) ) { @@ -111,10 +112,12 @@ } else { scaler_select_scaler( SCALER_NORMAL ); } + + scaler_select_bitformat( 555 ); } static int -cocoadisplay_allocate_screen( Cocoa_Texture* screen, int height, int width, +allocate_screen( Cocoa_Texture* screen, int height, int width, float scaling_factor ) { screen->image_width = image_width * display_current_size; @@ -126,17 +129,26 @@ screen->full_height = screen->image_height+3; screen->image_yoffset = 1; - screen->pixels = calloc( screen->full_width*screen->full_height, sizeof(uint32_t) ); + screen->pixels = calloc( screen->full_width*screen->full_height, sizeof(uint16_t) ); if( !screen->pixels ) { fprintf( stderr, "%s: couldn't create screen.pixels\n", fuse_progname ); return 1; } - screen->pitch = screen->full_width * sizeof(uint32_t); + screen->pitch = screen->full_width * sizeof(uint16_t); return 0; } +static void +free_screen( Cocoa_Texture* screen ) +{ + if( screen->pixels ) { + free( screen->pixels ); + screen->pixels=NULL; + } +} + static int cocoadisplay_load_gfx_mode( void ) { @@ -144,14 +156,14 @@ display_current_size = scaler_get_scaling_factor( current_scaler ); - error = cocoadisplay_allocate_screen( &unscaled_screen, image_height, image_width, 1.0f ); + error = allocate_screen( &unscaled_screen, image_height, image_width, 1.0f ); if( error ) return error; screen = &unscaled_screen; if( current_scaler != SCALER_NORMAL ) { - error = cocoadisplay_allocate_screen( &scaled_screen, image_height, - image_width, display_current_size ); + error = allocate_screen( &scaled_screen, image_height, image_width, + display_current_size ); if( error ) return error; screen = &scaled_screen; @@ -167,21 +179,21 @@ } static int -cocoadisplay_allocate_colours( int numColours, uint32_t *colour_values, - uint32_t *bw_values ) +cocoadisplay_allocate_colours( int numColours, uint16_t *colour_values, + uint16_t *bw_values ) { int i; uint8_t red, green, blue, grey; for( i = 0; i < numColours; i++ ) { - red = (colour_values[i] >> 16) & 0xff; - green = (colour_values[i] >> 8) & 0xff; - blue = colour_values[i] & 0xff; + red = (colour_values[i] >> 10) & 0x1f; + green = (colour_values[i] >> 5) & 0x1f; + blue = colour_values[i] & 0x1f; /* Addition of 0.5 is to avoid rounding errors */ grey = ( 0.299 * red + 0.587 * green + 0.114 * blue ) + 0.5; - bw_values[i] = (grey << 16) | (grey << 8) | grey; + bw_values[i] = (grey << 10) | (grey << 5) | grey; } return 0; @@ -191,11 +203,9 @@ uidisplay_init( int width, int height ) { int error; - error = cocoadisplay_allocate_colours( sizeof(colour_values) / sizeof(uint32_t), + error = cocoadisplay_allocate_colours( sizeof(colour_values) / sizeof(uint16_t), colour_values, bw_values ); - scaler_select_scaler( SCALER_NORMAL ); - image_width = width; image_height = height; @@ -217,11 +227,9 @@ { fuse_emulation_pause(); - /* Free the old surface */ - if( unscaled_screen.pixels ) { - free( unscaled_screen.pixels ); - unscaled_screen.pixels=NULL; - } + /* Free the old surfaces */ + free_screen( &unscaled_screen ); + free_screen( &scaled_screen ); /* Setup the new GFX mode */ cocoadisplay_load_gfx_mode(); @@ -233,25 +241,25 @@ void uidisplay_putpixel( int x, int y, int colour ) { - uint32_t *dest_base, *dest; - uint32_t *palette_values = settings_current.bw_tv ? bw_values : colour_values; + uint16_t *dest_base, *dest; + uint16_t *palette_values = settings_current.bw_tv ? bw_values : colour_values; - uint32_t palette_colour = palette_values[ colour ]; + uint16_t palette_colour = palette_values[ colour ]; if( machine_current->timex ) { x <<= 1; y <<= 1; - dest_base = dest = (uint32_t*)( (uint8_t*)unscaled_screen.pixels + - (x+unscaled_screen.image_xoffset) * sizeof(uint32_t) + + dest_base = dest = (uint16_t*)( (uint8_t*)unscaled_screen.pixels + + (x+unscaled_screen.image_xoffset) * sizeof(uint16_t) + (y+unscaled_screen.image_yoffset) * unscaled_screen.pitch ); *(dest++) = palette_colour; *(dest++) = palette_colour; - dest = (uint32_t*)( (uint8_t*)dest_base + unscaled_screen.pitch ); + dest = (uint16_t*)( (uint8_t*)dest_base + unscaled_screen.pitch ); *(dest++) = palette_colour; *(dest++) = palette_colour; } else { - dest = (uint32_t*)( (uint8_t*)unscaled_screen.pixels + - (x+unscaled_screen.image_xoffset) * sizeof(uint32_t) + + dest = (uint16_t*)( (uint8_t*)unscaled_screen.pixels + + (x+unscaled_screen.image_xoffset) * sizeof(uint16_t) + (y+unscaled_screen.image_yoffset) * unscaled_screen.pitch ); *dest = palette_colour; @@ -264,20 +272,20 @@ uidisplay_plot8( int x, int y, libspectrum_byte data, libspectrum_byte ink, libspectrum_byte paper ) { - uint32_t *dest; - uint32_t *palette_values = settings_current.bw_tv ? bw_values : colour_values; + uint16_t *dest; + uint16_t *palette_values = settings_current.bw_tv ? bw_values : colour_values; - uint32_t palette_ink = palette_values[ ink ]; - uint32_t palette_paper = palette_values[ paper ]; + uint16_t palette_ink = palette_values[ ink ]; + uint16_t palette_paper = palette_values[ paper ]; if( machine_current->timex ) { int i; - uint32_t *dest_base; + uint16_t *dest_base; x <<= 4; y <<= 1; - dest_base = (uint32_t*)( (uint8_t*)unscaled_screen.pixels + - (x+unscaled_screen.image_xoffset) * sizeof(uint32_t) + + dest_base = (uint16_t*)( (uint8_t*)unscaled_screen.pixels + + (x+unscaled_screen.image_xoffset) * sizeof(uint16_t) + (y+unscaled_screen.image_yoffset) * unscaled_screen.pitch ); for( i=0; i<2; i++ ) { @@ -300,12 +308,12 @@ *(dest++) = ( data & 0x01 ) ? palette_ink : palette_paper; *dest = ( data & 0x01 ) ? palette_ink : palette_paper; - dest_base = (uint32_t*)( (uint8_t*)dest_base + unscaled_screen.pitch ); + dest_base = (uint16_t*)( (uint8_t*)dest_base + unscaled_screen.pitch ); } } else { x <<= 3; - dest = (uint32_t*)( (uint8_t*)unscaled_screen.pixels + - (x+unscaled_screen.image_xoffset) * sizeof(uint32_t) + + dest = (uint16_t*)( (uint8_t*)unscaled_screen.pixels + + (x+unscaled_screen.image_xoffset) * sizeof(uint16_t) + (y+unscaled_screen.image_yoffset) * unscaled_screen.pitch ); *(dest++) = ( data & 0x80 ) ? palette_ink : palette_paper; @@ -325,15 +333,15 @@ uidisplay_plot16( int x, int y, libspectrum_word data, libspectrum_byte ink, libspectrum_byte paper ) { - uint32_t *dest_base, *dest; + uint16_t *dest_base, *dest; int i; - uint32_t *palette_values = settings_current.bw_tv ? bw_values : colour_values; - uint32_t palette_ink = palette_values[ ink ]; - uint32_t palette_paper = palette_values[ paper ]; + uint16_t *palette_values = settings_current.bw_tv ? bw_values : colour_values; + uint16_t palette_ink = palette_values[ ink ]; + uint16_t palette_paper = palette_values[ paper ]; x <<= 4; y <<= 1; - dest_base = (uint32_t*)( (uint8_t*)unscaled_screen.pixels + (x+unscaled_screen.image_xoffset) * - sizeof(uint32_t) + (y+unscaled_screen.image_yoffset) * + dest_base = (uint16_t*)( (uint8_t*)unscaled_screen.pixels + (x+unscaled_screen.image_xoffset) * + sizeof(uint16_t) + (y+unscaled_screen.image_yoffset) * unscaled_screen.pitch ); for( i=0; i<2; i++ ) { @@ -356,7 +364,7 @@ *(dest++) = ( data & 0x0002 ) ? palette_ink : palette_paper; *dest = ( data & 0x0001 ) ? palette_ink : palette_paper; - dest_base = (uint32_t*)( (uint8_t*)dest_base + unscaled_screen.pitch ); + dest_base = (uint16_t*)( (uint8_t*)dest_base + unscaled_screen.pitch ); } } @@ -382,9 +390,9 @@ scaled_y = display_current_size * y; /* Create scaled image */ - scaler_proc32( unscaled_screen.pixels + ( y + 1 ) * unscaled_screen.pitch + sizeof(uint32_t) * ( x + 1 ), + scaler_proc16( unscaled_screen.pixels + ( y + 1 ) * unscaled_screen.pitch + sizeof(uint16_t) * ( x + 1 ), unscaled_screen.pitch, - scaled_screen.pixels + scaled_y * scaled_screen.pitch + sizeof(uint32_t) * scaled_x, + scaled_screen.pixels + scaled_y * scaled_screen.pitch + sizeof(uint16_t) * scaled_x, scaled_screen.pitch, width, height ); } @@ -395,15 +403,8 @@ DestroyTexture(); } - if( unscaled_screen.pixels ) { - free( unscaled_screen.pixels ); - unscaled_screen.pixels=NULL; - } + free_screen( &unscaled_screen ); + free_screen( &scaled_screen ); - if( scaled_screen.pixels ) { - free( scaled_screen.pixels ); - scaled_screen.pixels=NULL; - } - return 0; } Modified: branches/fusegl/fuse/ui/scaler/scaler.c =================================================================== --- branches/fusegl/fuse/ui/scaler/scaler.c 2007-01-01 12:33:46 UTC (rev 277) +++ branches/fusegl/fuse/ui/scaler/scaler.c 2007-01-02 10:11:45 UTC (rev 278) @@ -69,39 +69,37 @@ static struct scaler_info available_scalers[] = { { "Timex Half (smoothed)", "half", SCALER_FLAGS_NONE, SCALE_FACTOR_HALF, - NULL, scaler_Half_32, NULL }, + scaler_Half_16, NULL, NULL }, { "Timex Half (skipping)", "halfskip", SCALER_FLAGS_NONE, SCALE_FACTOR_HALF, - NULL, scaler_HalfSkip_32, NULL }, + scaler_HalfSkip_16, NULL, NULL }, { "Normal", "normal", SCALER_FLAGS_NONE, SCALE_FACTOR_ONE, - NULL, scaler_Normal1x_32, NULL }, + scaler_Normal1x_16, NULL, NULL }, { "Double size", "2x", SCALER_FLAGS_NONE, SCALE_FACTOR_TWO, - NULL, scaler_Normal2x_32, NULL }, + scaler_Normal2x_16, NULL, NULL }, { "Triple size", "3x", SCALER_FLAGS_NONE, SCALE_FACTOR_THREE, - NULL, scaler_Normal3x_32, NULL }, + scaler_Normal3x_16, NULL, NULL }, { "2xSaI", "2xsai", SCALER_FLAGS_EXPAND, SCALE_FACTOR_TWO, - NULL, scaler_2xSaI_32, expand_sai }, + scaler_2xSaI_16, NULL, expand_sai }, { "Super 2xSaI", "super2xsai", SCALER_FLAGS_EXPAND, SCALE_FACTOR_TWO, - NULL, scaler_Super2xSaI_32, expand_sai }, + scaler_Super2xSaI_16, NULL, expand_sai }, { "SuperEagle", "supereagle", SCALER_FLAGS_EXPAND, SCALE_FACTOR_TWO, - NULL, scaler_SuperEagle_32, expand_sai }, + scaler_SuperEagle_16, NULL, expand_sai }, { "AdvMAME 2x", "advmame2x", SCALER_FLAGS_EXPAND, SCALE_FACTOR_TWO, - NULL, scaler_AdvMame2x_32, expand_1 }, + scaler_AdvMame2x_16, NULL, expand_1 }, { "AdvMAME 3x", "advmame3x", SCALER_FLAGS_EXPAND, SCALE_FACTOR_THREE, - NULL, scaler_AdvMame3x_32, expand_1 }, + scaler_AdvMame3x_16, NULL, expand_1 }, { "TV 2x", "tv2x", SCALER_FLAGS_NONE, SCALE_FACTOR_TWO, - NULL, scaler_TV2x_32, NULL }, + scaler_TV2x_16, NULL, NULL }, { "Timex TV", "timextv", SCALER_FLAGS_NONE, SCALE_FACTOR_ONE, - NULL, scaler_TimexTV_32, NULL }, + scaler_TimexTV_16, NULL, NULL }, { "Dot Matrix", "dotmatrix", SCALER_FLAGS_EXPAND, SCALE_FACTOR_TWO, - NULL, scaler_DotMatrix_32, expand_dotmatrix }, + scaler_DotMatrix_16, NULL, expand_dotmatrix }, { "Timex 1.5x", "timex15x", SCALER_FLAGS_NONE, SCALE_FACTOR_ONE_HALF, - NULL, scaler_Timex1_5x_32, NULL }, -#if 0 + scaler_Timex1_5x_16, NULL, NULL }, { "HQ 2x", "hq2x", SCALER_FLAGS_EXPAND, SCALE_FACTOR_TWO, scaler_HQ2x_16, NULL, expand_1 }, { "HQ 3x", "hq3x", SCALER_FLAGS_EXPAND, SCALE_FACTOR_THREE, scaler_HQ3x_16, NULL, expand_1 }, -#endif }; scaler_type current_scaler = SCALER_NUM; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |