Major indent cleanup in tuxpaint.c. hq4x code getting close.
This commit is contained in:
parent
7f9fb79d9f
commit
ce0f602b6e
5 changed files with 11002 additions and 10962 deletions
13
Makefile
13
Makefile
|
|
@ -541,11 +541,11 @@ install-man:
|
||||||
|
|
||||||
# Build the program!
|
# Build the program!
|
||||||
|
|
||||||
tuxpaint: obj/tuxpaint.o obj/hqxx.o obj/hq3x.o obj/hq4x.o $(ARCH_LIBS)
|
tuxpaint: obj/tuxpaint.o obj/hqxx.o obj/hq4x.o $(ARCH_LIBS)
|
||||||
@echo
|
@echo
|
||||||
@echo "...Linking Tux Paint..."
|
@echo "...Linking Tux Paint..."
|
||||||
@$(CC) $(CFLAGS) $(SDL_CFLAGS) $(DEFS) \
|
@$(CC) $(CFLAGS) $(SDL_CFLAGS) $(DEFS) \
|
||||||
-o tuxpaint obj/tuxpaint.o obj/hqxx.o obj/hq3x.o obj/hq4x.o \
|
-o tuxpaint obj/tuxpaint.o obj/hqxx.o obj/hq4x.o \
|
||||||
$(ARCH_LIBS) $(SDL_LIBS) \
|
$(ARCH_LIBS) $(SDL_LIBS) \
|
||||||
-lm $(ARCH_LINKS)
|
-lm $(ARCH_LINKS)
|
||||||
@$(RSRC_CMD)
|
@$(RSRC_CMD)
|
||||||
|
|
@ -557,7 +557,7 @@ tuxpaint: obj/tuxpaint.o obj/hqxx.o obj/hq3x.o obj/hq4x.o $(ARCH_LIBS)
|
||||||
obj/tuxpaint.o: src/tuxpaint.c \
|
obj/tuxpaint.o: src/tuxpaint.c \
|
||||||
src/tools.h src/titles.h src/colors.h src/shapes.h \
|
src/tools.h src/titles.h src/colors.h src/shapes.h \
|
||||||
src/magic.h src/sounds.h src/tip_tux.h src/great.h \
|
src/magic.h src/sounds.h src/tip_tux.h src/great.h \
|
||||||
src/hqxx.h src/hq3x.h src/hq4x.h \
|
src/hqxx.h src/hq4x.h \
|
||||||
src/mouse/arrow.xbm src/mouse/arrow-mask.xbm \
|
src/mouse/arrow.xbm src/mouse/arrow-mask.xbm \
|
||||||
src/mouse/hand.xbm src/mouse/hand-mask.xbm \
|
src/mouse/hand.xbm src/mouse/hand-mask.xbm \
|
||||||
src/mouse/insertion.xbm src/mouse/insertion-mask.xbm \
|
src/mouse/insertion.xbm src/mouse/insertion-mask.xbm \
|
||||||
|
|
@ -583,13 +583,6 @@ obj/BeOS_Print.o: src/BeOS_Print.cpp obj src/BeOS_print.h
|
||||||
-c src/BeOS_print.cpp -o obj/BeOS_print.o
|
-c src/BeOS_print.cpp -o obj/BeOS_print.o
|
||||||
|
|
||||||
|
|
||||||
obj/hq3x.o: src/hq3x.c src/hq3x.h src/hqxx.h
|
|
||||||
@echo
|
|
||||||
@echo "...Compiling high quality 3x scale filter..."
|
|
||||||
@$(CC) $(CFLAGS) $(SDL_CFLAGS) \
|
|
||||||
-c src/hq3x.c -o obj/hq3x.o
|
|
||||||
|
|
||||||
|
|
||||||
obj/hq4x.o: src/hq4x.c src/hq4x.h src/hqxx.h
|
obj/hq4x.o: src/hq4x.c src/hq4x.h src/hqxx.h
|
||||||
@echo
|
@echo
|
||||||
@echo "...Compiling high quality 4x scale filter..."
|
@echo "...Compiling high quality 4x scale filter..."
|
||||||
|
|
|
||||||
488
src/hq4x.c
488
src/hq4x.c
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
hq4x filter
|
hq4x filter
|
||||||
|
|
||||||
Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )
|
Copyright (C) 2003 MaxSt <maxst@hiend3d.com>
|
||||||
Library-ified by Bill Kendrick <bill@newbreedsoftware.com>
|
Library-ified by Bill Kendrick <bill@newbreedsoftware.com>
|
||||||
Based on "hq4x_src_c.zip" dated September 29, 2003
|
Based on "hq4x_src_c.zip" dated September 29, 2003
|
||||||
from: http://www.hiend3d.com/hq4x.html
|
from: http://www.hiend3d.com/hq4x.html
|
||||||
|
|
@ -28,270 +28,149 @@
|
||||||
#include "hqxx.h"
|
#include "hqxx.h"
|
||||||
|
|
||||||
|
|
||||||
#define PIXEL00_0 *((int*)(pOut)) = c[5]
|
#define PIXEL00_0 Interp0(dest, x * 4 + 0, y * 4 + 0, c[5])
|
||||||
#define PIXEL00_11 Interp1(pOut, c[5], c[4])
|
#define PIXEL00_11 Interp1(dest, x * 4 + 0, y * 4 + 0, c[5], c[4])
|
||||||
#define PIXEL00_12 Interp1(pOut, c[5], c[2])
|
#define PIXEL00_12 Interp1(dest, x * 4 + 0, y * 4 + 0, c[5], c[2])
|
||||||
#define PIXEL00_20 Interp2(pOut, c[5], c[2], c[4])
|
#define PIXEL00_20 Interp2(dest, x * 4 + 0, y * 4 + 0, c[5], c[2], c[4])
|
||||||
#define PIXEL00_50 Interp5(pOut, c[2], c[4])
|
#define PIXEL00_50 Interp5(dest, x * 4 + 0, y * 4 + 0, c[2], c[4])
|
||||||
#define PIXEL00_80 Interp8(pOut, c[5], c[1])
|
#define PIXEL00_80 Interp8(dest, x * 4 + 0, y * 4 + 0, c[5], c[1])
|
||||||
#define PIXEL00_81 Interp8(pOut, c[5], c[4])
|
#define PIXEL00_81 Interp8(dest, x * 4 + 0, y * 4 + 0, c[5], c[4])
|
||||||
#define PIXEL00_82 Interp8(pOut, c[5], c[2])
|
#define PIXEL00_82 Interp8(dest, x * 4 + 0, y * 4 + 0, c[5], c[2])
|
||||||
#define PIXEL01_0 *((int*)(pOut+4)) = c[5]
|
#define PIXEL01_0 Interp0(dest, x * 4 + 0, y * 4 + 0, c[5])
|
||||||
#define PIXEL01_10 Interp1(pOut+4, c[5], c[1])
|
#define PIXEL01_10 Interp1(dest, x * 4 + 1, y * 4 + 0, c[5], c[1])
|
||||||
#define PIXEL01_12 Interp1(pOut+4, c[5], c[2])
|
#define PIXEL01_12 Interp1(dest, x * 4 + 1, y * 4 + 0, c[5], c[2])
|
||||||
#define PIXEL01_14 Interp1(pOut+4, c[2], c[5])
|
#define PIXEL01_14 Interp1(dest, x * 4 + 1, y * 4 + 0, c[2], c[5])
|
||||||
#define PIXEL01_21 Interp2(pOut+4, c[2], c[5], c[4])
|
#define PIXEL01_21 Interp2(dest, x * 4 + 1, y * 4 + 0, c[2], c[5], c[4])
|
||||||
#define PIXEL01_31 Interp3(pOut+4, c[5], c[4])
|
#define PIXEL01_31 Interp3(dest, x * 4 + 1, y * 4 + 0, c[5], c[4])
|
||||||
#define PIXEL01_50 Interp5(pOut+4, c[2], c[5])
|
#define PIXEL01_50 Interp5(dest, x * 4 + 1, y * 4 + 0, c[2], c[5])
|
||||||
#define PIXEL01_60 Interp6(pOut+4, c[5], c[2], c[4])
|
#define PIXEL01_60 Interp6(dest, x * 4 + 1, y * 4 + 0, c[5], c[2], c[4])
|
||||||
#define PIXEL01_61 Interp6(pOut+4, c[5], c[2], c[1])
|
#define PIXEL01_61 Interp6(dest, x * 4 + 1, y * 4 + 0, c[5], c[2], c[1])
|
||||||
#define PIXEL01_82 Interp8(pOut+4, c[5], c[2])
|
#define PIXEL01_82 Interp8(dest, x * 4 + 1, y * 4 + 0, c[5], c[2])
|
||||||
#define PIXEL01_83 Interp8(pOut+4, c[2], c[4])
|
#define PIXEL01_83 Interp8(dest, x * 4 + 1, y * 4 + 0, c[2], c[4])
|
||||||
#define PIXEL02_0 *((int*)(pOut+8)) = c[5]
|
#define PIXEL02_0 Interp0(dest, x * 4 + 2, y * 4 + 0, c[5])
|
||||||
#define PIXEL02_10 Interp1(pOut+8, c[5], c[3])
|
#define PIXEL02_10 Interp1(dest, x * 4 + 2, y * 4 + 0, c[5], c[3])
|
||||||
#define PIXEL02_11 Interp1(pOut+8, c[5], c[2])
|
#define PIXEL02_11 Interp1(dest, x * 4 + 2, y * 4 + 0, c[5], c[2])
|
||||||
#define PIXEL02_13 Interp1(pOut+8, c[2], c[5])
|
#define PIXEL02_13 Interp1(dest, x * 4 + 2, y * 4 + 0, c[2], c[5])
|
||||||
#define PIXEL02_21 Interp2(pOut+8, c[2], c[5], c[6])
|
#define PIXEL02_21 Interp2(dest, x * 4 + 2, y * 4 + 0, c[2], c[5], c[6])
|
||||||
#define PIXEL02_32 Interp3(pOut+8, c[5], c[6])
|
#define PIXEL02_32 Interp3(dest, x * 4 + 2, y * 4 + 0, c[5], c[6])
|
||||||
#define PIXEL02_50 Interp5(pOut+8, c[2], c[5])
|
#define PIXEL02_50 Interp5(dest, x * 4 + 2, y * 4 + 0, c[2], c[5])
|
||||||
#define PIXEL02_60 Interp6(pOut+8, c[5], c[2], c[6])
|
#define PIXEL02_60 Interp6(dest, x * 4 + 2, y * 4 + 0, c[5], c[2], c[6])
|
||||||
#define PIXEL02_61 Interp6(pOut+8, c[5], c[2], c[3])
|
#define PIXEL02_61 Interp6(dest, x * 4 + 2, y * 4 + 0, c[5], c[2], c[3])
|
||||||
#define PIXEL02_81 Interp8(pOut+8, c[5], c[2])
|
#define PIXEL02_81 Interp8(dest, x * 4 + 2, y * 4 + 0, c[5], c[2])
|
||||||
#define PIXEL02_83 Interp8(pOut+8, c[2], c[6])
|
#define PIXEL02_83 Interp8(dest, x * 4 + 2, y * 4 + 0, c[2], c[6])
|
||||||
#define PIXEL03_0 *((int*)(pOut+12)) = c[5]
|
#define PIXEL03_0 Interp0(dest, x * 4 + 3, y * 4 + 0, c[5])
|
||||||
#define PIXEL03_11 Interp1(pOut+12, c[5], c[2])
|
#define PIXEL03_11 Interp1(dest, x * 4 + 3, y * 4 + 0, c[5], c[2])
|
||||||
#define PIXEL03_12 Interp1(pOut+12, c[5], c[6])
|
#define PIXEL03_12 Interp1(dest, x * 4 + 3, y * 4 + 0, c[5], c[6])
|
||||||
#define PIXEL03_20 Interp2(pOut+12, c[5], c[2], c[6])
|
#define PIXEL03_20 Interp2(dest, x * 4 + 3, y * 4 + 0, c[5], c[2], c[6])
|
||||||
#define PIXEL03_50 Interp5(pOut+12, c[2], c[6])
|
#define PIXEL03_50 Interp5(dest, x * 4 + 3, y * 4 + 0, c[2], c[6])
|
||||||
#define PIXEL03_80 Interp8(pOut+12, c[5], c[3])
|
#define PIXEL03_80 Interp8(dest, x * 4 + 3, y * 4 + 0, c[5], c[3])
|
||||||
#define PIXEL03_81 Interp8(pOut+12, c[5], c[2])
|
#define PIXEL03_81 Interp8(dest, x * 4 + 3, y * 4 + 0, c[5], c[2])
|
||||||
#define PIXEL03_82 Interp8(pOut+12, c[5], c[6])
|
#define PIXEL03_82 Interp8(dest, x * 4 + 3, y * 4 + 0, c[5], c[6])
|
||||||
#define PIXEL10_0 *((int*)(pOut+BpL)) = c[5]
|
#define PIXEL10_0 Interp0(dest, x * 4 + 0, y * 4 + 1, c[5])
|
||||||
#define PIXEL10_10 Interp1(pOut+BpL, c[5], c[1])
|
#define PIXEL10_10 Interp1(dest, x * 4 + 0, y * 4 + 1, c[5], c[1])
|
||||||
#define PIXEL10_11 Interp1(pOut+BpL, c[5], c[4])
|
#define PIXEL10_11 Interp1(dest, x * 4 + 0, y * 4 + 1, c[5], c[4])
|
||||||
#define PIXEL10_13 Interp1(pOut+BpL, c[4], c[5])
|
#define PIXEL10_13 Interp1(dest, x * 4 + 0, y * 4 + 1, c[4], c[5])
|
||||||
#define PIXEL10_21 Interp2(pOut+BpL, c[4], c[5], c[2])
|
#define PIXEL10_21 Interp2(dest, x * 4 + 0, y * 4 + 1, c[4], c[5], c[2])
|
||||||
#define PIXEL10_32 Interp3(pOut+BpL, c[5], c[2])
|
#define PIXEL10_32 Interp3(dest, x * 4 + 0, y * 4 + 1, c[5], c[2])
|
||||||
#define PIXEL10_50 Interp5(pOut+BpL, c[4], c[5])
|
#define PIXEL10_50 Interp5(dest, x * 4 + 0, y * 4 + 1, c[4], c[5])
|
||||||
#define PIXEL10_60 Interp6(pOut+BpL, c[5], c[4], c[2])
|
#define PIXEL10_60 Interp6(dest, x * 4 + 0, y * 4 + 1, c[5], c[4], c[2])
|
||||||
#define PIXEL10_61 Interp6(pOut+BpL, c[5], c[4], c[1])
|
#define PIXEL10_61 Interp6(dest, x * 4 + 0, y * 4 + 1, c[5], c[4], c[1])
|
||||||
#define PIXEL10_81 Interp8(pOut+BpL, c[5], c[4])
|
#define PIXEL10_81 Interp8(dest, x * 4 + 0, y * 4 + 1, c[5], c[4])
|
||||||
#define PIXEL10_83 Interp8(pOut+BpL, c[4], c[2])
|
#define PIXEL10_83 Interp8(dest, x * 4 + 0, y * 4 + 1, c[4], c[2])
|
||||||
#define PIXEL11_0 *((int*)(pOut+BpL+4)) = c[5]
|
#define PIXEL11_0 Interp0(dest, x * 4 + 1, y * 4 + 1, c[5])
|
||||||
#define PIXEL11_30 Interp3(pOut+BpL+4, c[5], c[1])
|
#define PIXEL11_30 Interp3(dest, x * 4 + 1, y * 4 + 1, c[5], c[1])
|
||||||
#define PIXEL11_31 Interp3(pOut+BpL+4, c[5], c[4])
|
#define PIXEL11_31 Interp3(dest, x * 4 + 1, y * 4 + 1, c[5], c[4])
|
||||||
#define PIXEL11_32 Interp3(pOut+BpL+4, c[5], c[2])
|
#define PIXEL11_32 Interp3(dest, x * 4 + 1, y * 4 + 1, c[5], c[2])
|
||||||
#define PIXEL11_70 Interp7(pOut+BpL+4, c[5], c[4], c[2])
|
#define PIXEL11_70 Interp7(dest, x * 4 + 1, y * 4 + 1, c[5], c[4], c[2])
|
||||||
#define PIXEL12_0 *((int*)(pOut+BpL+8)) = c[5]
|
#define PIXEL12_0 Interp0(dest, x * 4 + 2, y * 4 + 1, c[5])
|
||||||
#define PIXEL12_30 Interp3(pOut+BpL+8, c[5], c[3])
|
#define PIXEL12_30 Interp3(dest, x * 4 + 2, y * 4 + 1, c[5], c[3])
|
||||||
#define PIXEL12_31 Interp3(pOut+BpL+8, c[5], c[2])
|
#define PIXEL12_31 Interp3(dest, x * 4 + 2, y * 4 + 1, c[5], c[2])
|
||||||
#define PIXEL12_32 Interp3(pOut+BpL+8, c[5], c[6])
|
#define PIXEL12_32 Interp3(dest, x * 4 + 2, y * 4 + 1, c[5], c[6])
|
||||||
#define PIXEL12_70 Interp7(pOut+BpL+8, c[5], c[6], c[2])
|
#define PIXEL12_70 Interp7(dest, x * 4 + 2, y * 4 + 1, c[5], c[6], c[2])
|
||||||
#define PIXEL13_0 *((int*)(pOut+BpL+12)) = c[5]
|
#define PIXEL13_0 Interp0(dest, x * 4 + 3, y * 4 + 1, c[5])
|
||||||
#define PIXEL13_10 Interp1(pOut+BpL+12, c[5], c[3])
|
#define PIXEL13_10 Interp1(dest, x * 4 + 3, y * 4 + 1, c[5], c[3])
|
||||||
#define PIXEL13_12 Interp1(pOut+BpL+12, c[5], c[6])
|
#define PIXEL13_12 Interp1(dest, x * 4 + 3, y * 4 + 1, c[5], c[6])
|
||||||
#define PIXEL13_14 Interp1(pOut+BpL+12, c[6], c[5])
|
#define PIXEL13_14 Interp1(dest, x * 4 + 3, y * 4 + 1, c[6], c[5])
|
||||||
#define PIXEL13_21 Interp2(pOut+BpL+12, c[6], c[5], c[2])
|
#define PIXEL13_21 Interp2(dest, x * 4 + 3, y * 4 + 1, c[6], c[5], c[2])
|
||||||
#define PIXEL13_31 Interp3(pOut+BpL+12, c[5], c[2])
|
#define PIXEL13_31 Interp3(dest, x * 4 + 3, y * 4 + 1, c[5], c[2])
|
||||||
#define PIXEL13_50 Interp5(pOut+BpL+12, c[6], c[5])
|
#define PIXEL13_50 Interp5(dest, x * 4 + 3, y * 4 + 1, c[6], c[5])
|
||||||
#define PIXEL13_60 Interp6(pOut+BpL+12, c[5], c[6], c[2])
|
#define PIXEL13_60 Interp6(dest, x * 4 + 3, y * 4 + 1, c[5], c[6], c[2])
|
||||||
#define PIXEL13_61 Interp6(pOut+BpL+12, c[5], c[6], c[3])
|
#define PIXEL13_61 Interp6(dest, x * 4 + 3, y * 4 + 1, c[5], c[6], c[3])
|
||||||
#define PIXEL13_82 Interp8(pOut+BpL+12, c[5], c[6])
|
#define PIXEL13_82 Interp8(dest, x * 4 + 3, y * 4 + 1, c[5], c[6])
|
||||||
#define PIXEL13_83 Interp8(pOut+BpL+12, c[6], c[2])
|
#define PIXEL13_83 Interp8(dest, x * 4 + 3, y * 4 + 1, c[6], c[2])
|
||||||
#define PIXEL20_0 *((int*)(pOut+BpL+BpL)) = c[5]
|
#define PIXEL20_0 Interp0(dest, x * 4 + 0, y * 4 + 2, c[5])
|
||||||
#define PIXEL20_10 Interp1(pOut+BpL+BpL, c[5], c[7])
|
#define PIXEL20_10 Interp1(dest, x * 4 + 0, y * 4 + 2, c[5], c[7])
|
||||||
#define PIXEL20_12 Interp1(pOut+BpL+BpL, c[5], c[4])
|
#define PIXEL20_12 Interp1(dest, x * 4 + 0, y * 4 + 2, c[5], c[4])
|
||||||
#define PIXEL20_14 Interp1(pOut+BpL+BpL, c[4], c[5])
|
#define PIXEL20_14 Interp1(dest, x * 4 + 0, y * 4 + 2, c[4], c[5])
|
||||||
#define PIXEL20_21 Interp2(pOut+BpL+BpL, c[4], c[5], c[8])
|
#define PIXEL20_21 Interp2(dest, x * 4 + 0, y * 4 + 2, c[4], c[5], c[8])
|
||||||
#define PIXEL20_31 Interp3(pOut+BpL+BpL, c[5], c[8])
|
#define PIXEL20_31 Interp3(dest, x * 4 + 0, y * 4 + 2, c[5], c[8])
|
||||||
#define PIXEL20_50 Interp5(pOut+BpL+BpL, c[4], c[5])
|
#define PIXEL20_50 Interp5(dest, x * 4 + 0, y * 4 + 2, c[4], c[5])
|
||||||
#define PIXEL20_60 Interp6(pOut+BpL+BpL, c[5], c[4], c[8])
|
#define PIXEL20_60 Interp6(dest, x * 4 + 0, y * 4 + 2, c[5], c[4], c[8])
|
||||||
#define PIXEL20_61 Interp6(pOut+BpL+BpL, c[5], c[4], c[7])
|
#define PIXEL20_61 Interp6(dest, x * 4 + 0, y * 4 + 2, c[5], c[4], c[7])
|
||||||
#define PIXEL20_82 Interp8(pOut+BpL+BpL, c[5], c[4])
|
#define PIXEL20_82 Interp8(dest, x * 4 + 0, y * 4 + 2, c[5], c[4])
|
||||||
#define PIXEL20_83 Interp8(pOut+BpL+BpL, c[4], c[8])
|
#define PIXEL20_83 Interp8(dest, x * 4 + 0, y * 4 + 2, c[4], c[8])
|
||||||
#define PIXEL21_0 *((int*)(pOut+BpL+BpL+4)) = c[5]
|
#define PIXEL21_0 Interp0(dest, x * 4 + 1, y * 4 + 2, c[5])
|
||||||
#define PIXEL21_30 Interp3(pOut+BpL+BpL+4, c[5], c[7])
|
#define PIXEL21_30 Interp3(dest, x * 4 + 1, y * 4 + 2, c[5], c[7])
|
||||||
#define PIXEL21_31 Interp3(pOut+BpL+BpL+4, c[5], c[8])
|
#define PIXEL21_31 Interp3(dest, x * 4 + 1, y * 4 + 2, c[5], c[8])
|
||||||
#define PIXEL21_32 Interp3(pOut+BpL+BpL+4, c[5], c[4])
|
#define PIXEL21_32 Interp3(dest, x * 4 + 1, y * 4 + 2, c[5], c[4])
|
||||||
#define PIXEL21_70 Interp7(pOut+BpL+BpL+4, c[5], c[4], c[8])
|
#define PIXEL21_70 Interp7(dest, x * 4 + 1, y * 4 + 2, c[5], c[4], c[8])
|
||||||
#define PIXEL22_0 *((int*)(pOut+BpL+BpL+8)) = c[5]
|
#define PIXEL22_0 Interp0(dest, x * 4 + 2, y * 4 + 2, c[5])
|
||||||
#define PIXEL22_30 Interp3(pOut+BpL+BpL+8, c[5], c[9])
|
#define PIXEL22_30 Interp3(dest, x * 4 + 2, y * 4 + 2, c[5], c[9])
|
||||||
#define PIXEL22_31 Interp3(pOut+BpL+BpL+8, c[5], c[6])
|
#define PIXEL22_31 Interp3(dest, x * 4 + 2, y * 4 + 2, c[5], c[6])
|
||||||
#define PIXEL22_32 Interp3(pOut+BpL+BpL+8, c[5], c[8])
|
#define PIXEL22_32 Interp3(dest, x * 4 + 2, y * 4 + 2, c[5], c[8])
|
||||||
#define PIXEL22_70 Interp7(pOut+BpL+BpL+8, c[5], c[6], c[8])
|
#define PIXEL22_70 Interp7(dest, x * 4 + 2, y * 4 + 2, c[5], c[6], c[8])
|
||||||
#define PIXEL23_0 *((int*)(pOut+BpL+BpL+12)) = c[5]
|
#define PIXEL23_0 Interp0(dest, x * 4 + 3, y * 4 + 2, c[5])
|
||||||
#define PIXEL23_10 Interp1(pOut+BpL+BpL+12, c[5], c[9])
|
#define PIXEL23_10 Interp1(dest, x * 4 + 3, y * 4 + 2, c[5], c[9])
|
||||||
#define PIXEL23_11 Interp1(pOut+BpL+BpL+12, c[5], c[6])
|
#define PIXEL23_11 Interp1(dest, x * 4 + 3, y * 4 + 2, c[5], c[6])
|
||||||
#define PIXEL23_13 Interp1(pOut+BpL+BpL+12, c[6], c[5])
|
#define PIXEL23_13 Interp1(dest, x * 4 + 3, y * 4 + 2, c[6], c[5])
|
||||||
#define PIXEL23_21 Interp2(pOut+BpL+BpL+12, c[6], c[5], c[8])
|
#define PIXEL23_21 Interp2(dest, x * 4 + 3, y * 4 + 2, c[6], c[5], c[8])
|
||||||
#define PIXEL23_32 Interp3(pOut+BpL+BpL+12, c[5], c[8])
|
#define PIXEL23_32 Interp3(dest, x * 4 + 3, y * 4 + 2, c[5], c[8])
|
||||||
#define PIXEL23_50 Interp5(pOut+BpL+BpL+12, c[6], c[5])
|
#define PIXEL23_50 Interp5(dest, x * 4 + 3, y * 4 + 2, c[6], c[5])
|
||||||
#define PIXEL23_60 Interp6(pOut+BpL+BpL+12, c[5], c[6], c[8])
|
#define PIXEL23_60 Interp6(dest, x * 4 + 3, y * 4 + 2, c[5], c[6], c[8])
|
||||||
#define PIXEL23_61 Interp6(pOut+BpL+BpL+12, c[5], c[6], c[9])
|
#define PIXEL23_61 Interp6(dest, x * 4 + 3, y * 4 + 2, c[5], c[6], c[9])
|
||||||
#define PIXEL23_81 Interp8(pOut+BpL+BpL+12, c[5], c[6])
|
#define PIXEL23_81 Interp8(dest, x * 4 + 3, y * 4 + 2, c[5], c[6])
|
||||||
#define PIXEL23_83 Interp8(pOut+BpL+BpL+12, c[6], c[8])
|
#define PIXEL23_83 Interp8(dest, x * 4 + 3, y * 4 + 2, c[6], c[8])
|
||||||
#define PIXEL30_0 *((int*)(pOut+BpL+BpL+BpL)) = c[5]
|
#define PIXEL30_0 Interp0(dest, x * 4 + 0, y * 4 + 3, c[5])
|
||||||
#define PIXEL30_11 Interp1(pOut+BpL+BpL+BpL, c[5], c[8])
|
#define PIXEL30_11 Interp1(dest, x * 4 + 0, y * 4 + 3, c[5], c[8])
|
||||||
#define PIXEL30_12 Interp1(pOut+BpL+BpL+BpL, c[5], c[4])
|
#define PIXEL30_12 Interp1(dest, x * 4 + 0, y * 4 + 3, c[5], c[4])
|
||||||
#define PIXEL30_20 Interp2(pOut+BpL+BpL+BpL, c[5], c[8], c[4])
|
#define PIXEL30_20 Interp2(dest, x * 4 + 0, y * 4 + 3, c[5], c[8], c[4])
|
||||||
#define PIXEL30_50 Interp5(pOut+BpL+BpL+BpL, c[8], c[4])
|
#define PIXEL30_50 Interp5(dest, x * 4 + 0, y * 4 + 3, c[8], c[4])
|
||||||
#define PIXEL30_80 Interp8(pOut+BpL+BpL+BpL, c[5], c[7])
|
#define PIXEL30_80 Interp8(dest, x * 4 + 0, y * 4 + 3, c[5], c[7])
|
||||||
#define PIXEL30_81 Interp8(pOut+BpL+BpL+BpL, c[5], c[8])
|
#define PIXEL30_81 Interp8(dest, x * 4 + 0, y * 4 + 3, c[5], c[8])
|
||||||
#define PIXEL30_82 Interp8(pOut+BpL+BpL+BpL, c[5], c[4])
|
#define PIXEL30_82 Interp8(dest, x * 4 + 0, y * 4 + 3, c[5], c[4])
|
||||||
#define PIXEL31_0 *((int*)(pOut+BpL+BpL+BpL+4)) = c[5]
|
#define PIXEL31_0 Interp0(dest, x * 4 + 1, y * 4 + 3, c[5])
|
||||||
#define PIXEL31_10 Interp1(pOut+BpL+BpL+BpL+4, c[5], c[7])
|
#define PIXEL31_10 Interp1(dest, x * 4 + 1, y * 4 + 3, c[5], c[7])
|
||||||
#define PIXEL31_11 Interp1(pOut+BpL+BpL+BpL+4, c[5], c[8])
|
#define PIXEL31_11 Interp1(dest, x * 4 + 1, y * 4 + 3, c[5], c[8])
|
||||||
#define PIXEL31_13 Interp1(pOut+BpL+BpL+BpL+4, c[8], c[5])
|
#define PIXEL31_13 Interp1(dest, x * 4 + 1, y * 4 + 3, c[8], c[5])
|
||||||
#define PIXEL31_21 Interp2(pOut+BpL+BpL+BpL+4, c[8], c[5], c[4])
|
#define PIXEL31_21 Interp2(dest, x * 4 + 1, y * 4 + 3, c[8], c[5], c[4])
|
||||||
#define PIXEL31_32 Interp3(pOut+BpL+BpL+BpL+4, c[5], c[4])
|
#define PIXEL31_32 Interp3(dest, x * 4 + 1, y * 4 + 3, c[5], c[4])
|
||||||
#define PIXEL31_50 Interp5(pOut+BpL+BpL+BpL+4, c[8], c[5])
|
#define PIXEL31_50 Interp5(dest, x * 4 + 1, y * 4 + 3, c[8], c[5])
|
||||||
#define PIXEL31_60 Interp6(pOut+BpL+BpL+BpL+4, c[5], c[8], c[4])
|
#define PIXEL31_60 Interp6(dest, x * 4 + 1, y * 4 + 3, c[5], c[8], c[4])
|
||||||
#define PIXEL31_61 Interp6(pOut+BpL+BpL+BpL+4, c[5], c[8], c[7])
|
#define PIXEL31_61 Interp6(dest, x * 4 + 1, y * 4 + 3, c[5], c[8], c[7])
|
||||||
#define PIXEL31_81 Interp8(pOut+BpL+BpL+BpL+4, c[5], c[8])
|
#define PIXEL31_81 Interp8(dest, x * 4 + 1, y * 4 + 3, c[5], c[8])
|
||||||
#define PIXEL31_83 Interp8(pOut+BpL+BpL+BpL+4, c[8], c[4])
|
#define PIXEL31_83 Interp8(dest, x * 4 + 1, y * 4 + 3, c[8], c[4])
|
||||||
#define PIXEL32_0 *((int*)(pOut+BpL+BpL+BpL+8)) = c[5]
|
#define PIXEL32_0 Interp0(dest, x * 4 + 2, y * 4 + 3, c[5])
|
||||||
#define PIXEL32_10 Interp1(pOut+BpL+BpL+BpL+8, c[5], c[9])
|
#define PIXEL32_10 Interp1(dest, x * 4 + 2, y * 4 + 3, c[5], c[9])
|
||||||
#define PIXEL32_12 Interp1(pOut+BpL+BpL+BpL+8, c[5], c[8])
|
#define PIXEL32_12 Interp1(dest, x * 4 + 2, y * 4 + 3, c[5], c[8])
|
||||||
#define PIXEL32_14 Interp1(pOut+BpL+BpL+BpL+8, c[8], c[5])
|
#define PIXEL32_14 Interp1(dest, x * 4 + 2, y * 4 + 3, c[8], c[5])
|
||||||
#define PIXEL32_21 Interp2(pOut+BpL+BpL+BpL+8, c[8], c[5], c[6])
|
#define PIXEL32_21 Interp2(dest, x * 4 + 2, y * 4 + 3, c[8], c[5], c[6])
|
||||||
#define PIXEL32_31 Interp3(pOut+BpL+BpL+BpL+8, c[5], c[6])
|
#define PIXEL32_31 Interp3(dest, x * 4 + 2, y * 4 + 3, c[5], c[6])
|
||||||
#define PIXEL32_50 Interp5(pOut+BpL+BpL+BpL+8, c[8], c[5])
|
#define PIXEL32_50 Interp5(dest, x * 4 + 2, y * 4 + 3, c[8], c[5])
|
||||||
#define PIXEL32_60 Interp6(pOut+BpL+BpL+BpL+8, c[5], c[8], c[6])
|
#define PIXEL32_60 Interp6(dest, x * 4 + 2, y * 4 + 3, c[5], c[8], c[6])
|
||||||
#define PIXEL32_61 Interp6(pOut+BpL+BpL+BpL+8, c[5], c[8], c[9])
|
#define PIXEL32_61 Interp6(dest, x * 4 + 2, y * 4 + 3, c[5], c[8], c[9])
|
||||||
#define PIXEL32_82 Interp8(pOut+BpL+BpL+BpL+8, c[5], c[8])
|
#define PIXEL32_82 Interp8(dest, x * 4 + 2, y * 4 + 3, c[5], c[8])
|
||||||
#define PIXEL32_83 Interp8(pOut+BpL+BpL+BpL+8, c[8], c[6])
|
#define PIXEL32_83 Interp8(dest, x * 4 + 2, y * 4 + 3, c[8], c[6])
|
||||||
#define PIXEL33_0 *((int*)(pOut+BpL+BpL+BpL+12)) = c[5]
|
#define PIXEL33_0 Interp0(dest, x * 4 + 3, y * 4 + 3, c[5])
|
||||||
#define PIXEL33_11 Interp1(pOut+BpL+BpL+BpL+12, c[5], c[6])
|
#define PIXEL33_11 Interp1(dest, x * 4 + 3, y * 4 + 3, c[5], c[6])
|
||||||
#define PIXEL33_12 Interp1(pOut+BpL+BpL+BpL+12, c[5], c[8])
|
#define PIXEL33_12 Interp1(dest, x * 4 + 3, y * 4 + 3, c[5], c[8])
|
||||||
#define PIXEL33_20 Interp2(pOut+BpL+BpL+BpL+12, c[5], c[8], c[6])
|
#define PIXEL33_20 Interp2(dest, x * 4 + 3, y * 4 + 3, c[5], c[8], c[6])
|
||||||
#define PIXEL33_50 Interp5(pOut+BpL+BpL+BpL+12, c[8], c[6])
|
#define PIXEL33_50 Interp5(dest, x * 4 + 3, y * 4 + 3, c[8], c[6])
|
||||||
#define PIXEL33_80 Interp8(pOut+BpL+BpL+BpL+12, c[5], c[9])
|
#define PIXEL33_80 Interp8(dest, x * 4 + 3, y * 4 + 3, c[5], c[9])
|
||||||
#define PIXEL33_81 Interp8(pOut+BpL+BpL+BpL+12, c[5], c[6])
|
#define PIXEL33_81 Interp8(dest, x * 4 + 3, y * 4 + 3, c[5], c[6])
|
||||||
#define PIXEL33_82 Interp8(pOut+BpL+BpL+BpL+12, c[5], c[8])
|
#define PIXEL33_82 Interp8(dest, x * 4 + 3, y * 4 + 3, c[5], c[8])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y)
|
|
||||||
{
|
|
||||||
int bpp;
|
|
||||||
Uint8 * p;
|
|
||||||
Uint32 pixel;
|
|
||||||
Uint8 r, g, b;
|
|
||||||
Uint16 pixel16;
|
|
||||||
|
|
||||||
pixel = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/* Assuming the X/Y values are within the bounds of this surface... */
|
|
||||||
|
|
||||||
if (x >= 0 && y >= 0 && x < surface -> w && y < surface -> h)
|
|
||||||
{
|
|
||||||
/* SDL_LockSurface(surface); */
|
|
||||||
|
|
||||||
|
|
||||||
/* Determine bytes-per-pixel for the surface in question: */
|
|
||||||
|
|
||||||
bpp = surface->format->BytesPerPixel;
|
|
||||||
|
|
||||||
|
|
||||||
/* Set a pointer to the exact location in memory of the pixel
|
|
||||||
in question: */
|
|
||||||
|
|
||||||
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start at top of RAM */
|
|
||||||
(y * surface->pitch) + /* Go down Y lines */
|
|
||||||
(x * bpp)); /* Go in X pixels */
|
|
||||||
|
|
||||||
|
|
||||||
/* Return the correctly-sized piece of data containing the
|
|
||||||
* pixel's value (an 8-bit palette value, or a 16-, 24- or 32-bit
|
|
||||||
* RGB value) */
|
|
||||||
|
|
||||||
if (bpp == 1) /* 8-bit display */
|
|
||||||
pixel = *p;
|
|
||||||
else if (bpp == 2) /* 16-bit display */
|
|
||||||
pixel = *(Uint16 *)p;
|
|
||||||
else if (bpp == 3) /* 24-bit display */
|
|
||||||
{
|
|
||||||
/* Depending on the byte-order, it could be stored RGB or BGR! */
|
|
||||||
|
|
||||||
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
|
||||||
pixel = p[0] << 16 | p[1] << 8 | p[2];
|
|
||||||
else
|
|
||||||
pixel = p[0] | p[1] << 8 | p[2] << 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (bpp == 4) /* 32-bit display */
|
|
||||||
pixel = *(Uint32 *)p;
|
|
||||||
|
|
||||||
/* SDL_UnlockSurface(surface); */
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_GetRGB(pixel, surface->format, &r, &g, &b);
|
|
||||||
|
|
||||||
pixel16 = ((r & 0xF8) << 11) & ((g & 0xFC) << 5) & ((b & 0xF8));
|
|
||||||
|
|
||||||
return pixel16;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void hqxx_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
|
||||||
{
|
|
||||||
int bpp;
|
|
||||||
Uint8 * p;
|
|
||||||
|
|
||||||
|
|
||||||
/* Assuming the X/Y values are within the bounds of this surface... */
|
|
||||||
|
|
||||||
if (x >= 0 && y >= 0 && x < surface->w && y < surface->h)
|
|
||||||
{
|
|
||||||
/* SDL_LockSurface(surface); */
|
|
||||||
|
|
||||||
|
|
||||||
/* Determine bytes-per-pixel for the surface in question: */
|
|
||||||
|
|
||||||
bpp = surface->format->BytesPerPixel;
|
|
||||||
|
|
||||||
|
|
||||||
/* Set a pointer to the exact location in memory of the pixel
|
|
||||||
* in question: */
|
|
||||||
|
|
||||||
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start: beginning of RAM */
|
|
||||||
(y * surface->pitch) + /* Go down Y lines */
|
|
||||||
(x * bpp)); /* Go in X pixels */
|
|
||||||
|
|
||||||
|
|
||||||
/* Set the (correctly-sized) piece of data in the surface's RAM
|
|
||||||
* to the pixel value sent in: */
|
|
||||||
|
|
||||||
if (bpp == 1)
|
|
||||||
*p = pixel;
|
|
||||||
else if (bpp == 2)
|
|
||||||
*(Uint16 *)p = pixel;
|
|
||||||
else if (bpp == 3)
|
|
||||||
{
|
|
||||||
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
|
||||||
{
|
|
||||||
p[0] = (pixel >> 16) & 0xff;
|
|
||||||
p[1] = (pixel >> 8) & 0xff;
|
|
||||||
p[2] = pixel & 0xff;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p[0] = pixel & 0xff;
|
|
||||||
p[1] = (pixel >> 8) & 0xff;
|
|
||||||
p[2] = (pixel >> 16) & 0xff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (bpp == 4)
|
|
||||||
{
|
|
||||||
*(Uint32 *)p = pixel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SDL_UnlockSurface(surface); */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
int LUT16to32[65536], int RGBtoYUV[65536])
|
int LUT16to32[65536], int RGBtoYUV[65536])
|
||||||
{
|
{
|
||||||
|
|
@ -299,13 +178,8 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
int prevline, nextline;
|
int prevline, nextline;
|
||||||
Uint32 w[10];
|
Uint32 w[10];
|
||||||
Uint32 c[10];
|
Uint32 c[10];
|
||||||
Uint16 * In, * Out;
|
int pattern;
|
||||||
Uint8 * pIn, * pOut;
|
int flag;
|
||||||
Uint8 r, g, b, a;
|
|
||||||
Uint32 pix;
|
|
||||||
int pattern = 0;
|
|
||||||
int flag = 1;
|
|
||||||
int BpL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
+----+----+----+
|
+----+----+----+
|
||||||
|
|
@ -321,38 +195,19 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* Convert SDL pixel data into an array of 16bit values (RGB_565) */
|
|
||||||
|
|
||||||
In = (Uint16 *) malloc(sizeof(int) * src->w * src->h);
|
|
||||||
pIn = (Uint8 *) In;
|
|
||||||
|
|
||||||
for (y = 0; y < src->h; y++)
|
|
||||||
{
|
|
||||||
for (x = 0 ; x < src->w; x++)
|
|
||||||
{
|
|
||||||
pIn[y * src->w + x] = hqxx_getpixel(src, x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BpL = src->w * 2;
|
|
||||||
|
|
||||||
|
|
||||||
/* Create the new 4x4 version: */
|
/* Create the new 4x4 version: */
|
||||||
|
|
||||||
Out = (Uint16 *) malloc(sizeof(int) * (src->w * 4) * (src->h * 4));
|
|
||||||
pOut = (Uint8 *) Out;
|
|
||||||
|
|
||||||
for (y = 0; y < src->h; y++)
|
for (y = 0; y < src->h; y++)
|
||||||
{
|
{
|
||||||
/* Determine pointers to next and previous scanlines: */
|
/* Determine pointers to next and previous scanlines: */
|
||||||
|
|
||||||
if (y > 0)
|
if (y > 0)
|
||||||
prevline = -(src->w);
|
prevline = -1;
|
||||||
else
|
else
|
||||||
prevline = +0;
|
prevline = +0;
|
||||||
|
|
||||||
if (y < (src->h) - 1)
|
if (y < (src->h) - 1)
|
||||||
nextline = +(src->w);
|
nextline = +1;
|
||||||
else
|
else
|
||||||
nextline = +0;
|
nextline = +0;
|
||||||
|
|
||||||
|
|
@ -363,15 +218,15 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
{
|
{
|
||||||
/* Gather input pixels: */
|
/* Gather input pixels: */
|
||||||
|
|
||||||
w[2] = *((Uint16 *)(pIn + prevline));
|
w[2] = hqxx_getpixel(src, x, y + prevline);
|
||||||
w[5] = *((Uint16 *)pIn);
|
w[5] = hqxx_getpixel(src, x, y);
|
||||||
w[8] = *((Uint16 *)(pIn + nextline));
|
w[8] = hqxx_getpixel(src, x, y + nextline);
|
||||||
|
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
{
|
{
|
||||||
w[1] = *((Uint16 *)(pIn + prevline - 2));
|
w[1] = hqxx_getpixel(src, x - 1, y + prevline);
|
||||||
w[4] = *((Uint16 *)(pIn - 2));
|
w[4] = hqxx_getpixel(src, x - 1, y);
|
||||||
w[7] = *((Uint16 *)(pIn + nextline - 2));
|
w[7] = hqxx_getpixel(src, x - 1, y + nextline);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -382,9 +237,9 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
|
|
||||||
if (x < (src->w) - 1)
|
if (x < (src->w) - 1)
|
||||||
{
|
{
|
||||||
w[3] = *((Uint16 *)(pIn + prevline + 2));
|
w[3] = hqxx_getpixel(src, x + 1, y + prevline);
|
||||||
w[6] = *((Uint16 *)(pIn + 2));
|
w[6] = hqxx_getpixel(src, x + 1, y);
|
||||||
w[9] = *((Uint16 *)(pIn + nextline + 2));
|
w[9] = hqxx_getpixel(src, x + 1, y + nextline);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -401,6 +256,9 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
|
|
||||||
/* Determine the pattern of the pixel cluster: */
|
/* Determine the pattern of the pixel cluster: */
|
||||||
|
|
||||||
|
pattern = 0;
|
||||||
|
flag = 1;
|
||||||
|
|
||||||
for (k = 1; k <= 9; k++)
|
for (k = 1; k <= 9; k++)
|
||||||
{
|
{
|
||||||
/* Don't count ourselves! (Center pixel (w5)) */
|
/* Don't count ourselves! (Center pixel (w5)) */
|
||||||
|
|
@ -409,7 +267,7 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
{
|
{
|
||||||
/* Contruct a pattern based on the YUV thresholds: */
|
/* Contruct a pattern based on the YUV thresholds: */
|
||||||
|
|
||||||
if ( w[k] != w[5] )
|
if (w[k] != w[5])
|
||||||
{
|
{
|
||||||
/* Convert this pixel (w[k]) from RGB to YUV: */
|
/* Convert this pixel (w[k]) from RGB to YUV: */
|
||||||
|
|
||||||
|
|
@ -433,8 +291,8 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
|
|
||||||
/* Convert the cluster from 16bit to 32bit: */
|
/* Convert the cluster from 16bit to 32bit: */
|
||||||
|
|
||||||
for (k=1; k<=9; k++)
|
for (k = 1; k <= 9; k++)
|
||||||
c[k] = LUT16to32[w[k]];
|
c[k] = w[k]; //LUT16to32[w[k]];
|
||||||
|
|
||||||
|
|
||||||
/* Depending on the pattern, set various destination pixels: */
|
/* Depending on the pattern, set various destination pixels: */
|
||||||
|
|
@ -5413,32 +5271,6 @@ void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pIn+=2;
|
|
||||||
pOut+=16;
|
|
||||||
}
|
|
||||||
pOut+=BpL;
|
|
||||||
pOut+=BpL;
|
|
||||||
pOut+=BpL;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(In);
|
|
||||||
|
|
||||||
for (y = 0; y < dest->h; y++)
|
|
||||||
{
|
|
||||||
for (x = 0; x < dest->w; x++)
|
|
||||||
{
|
|
||||||
pix = Out[y * BpL + x];
|
|
||||||
|
|
||||||
r = (pix >> 11) & 0xFF;
|
|
||||||
g = (pix >> 5) & 0xFF;
|
|
||||||
b = (pix >> 0) & 0xFF;
|
|
||||||
pix = hqxx_getpixel(src, x / 4, y / 4);
|
|
||||||
|
|
||||||
SDL_GetRGBA(pix, src->format, &r, &g, &b, &a);
|
|
||||||
|
|
||||||
hqxx_putpixel(dest, x, y, SDL_MapRGBA(dest->format, r, g, b, a));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(Out);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
296
src/hqxx.c
296
src/hqxx.c
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
hqNx filter look-up table init and helper functions
|
hqNx filter look-up table init and helper functions
|
||||||
|
|
||||||
Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )
|
Copyright (C) 2003 MaxSt <maxst@hiend3d.com>
|
||||||
Library-ified by Bill Kendrick <bill@newbreedsoftware.com>
|
Library-ified by Bill Kendrick <bill@newbreedsoftware.com>
|
||||||
Based on "hq3x_src_c.zip" dated August 5, 2003
|
Based on "hq3x_src_c.zip" dated August 5, 2003
|
||||||
from: http://www.hiend3d.com/hq3x.html
|
from: http://www.hiend3d.com/hq3x.html
|
||||||
|
|
@ -28,88 +28,300 @@
|
||||||
#include "hqxx.h"
|
#include "hqxx.h"
|
||||||
|
|
||||||
|
|
||||||
const int Ymask = 0x00FF0000;
|
Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y)
|
||||||
const int Umask = 0x0000FF00;
|
{
|
||||||
const int Vmask = 0x000000FF;
|
int bpp;
|
||||||
const int trY = 0x00300000;
|
Uint8 * p;
|
||||||
const int trU = 0x00000700;
|
Uint32 pixel;
|
||||||
const int trV = 0x00000006;
|
Uint8 r, g, b;
|
||||||
|
Uint16 pixel16;
|
||||||
|
|
||||||
|
pixel = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* Assuming the X/Y values are within the bounds of this surface... */
|
||||||
|
|
||||||
|
if (x >= 0 && y >= 0 && x < surface -> w && y < surface -> h)
|
||||||
|
{
|
||||||
|
/* SDL_LockSurface(surface); */
|
||||||
|
|
||||||
|
|
||||||
|
/* Determine bytes-per-pixel for the surface in question: */
|
||||||
|
|
||||||
|
bpp = surface->format->BytesPerPixel;
|
||||||
|
|
||||||
|
|
||||||
|
/* Set a pointer to the exact location in memory of the pixel
|
||||||
|
in question: */
|
||||||
|
|
||||||
|
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start at top of RAM */
|
||||||
|
(y * surface->pitch) + /* Go down Y lines */
|
||||||
|
(x * bpp)); /* Go in X pixels */
|
||||||
|
|
||||||
|
|
||||||
|
/* Return the correctly-sized piece of data containing the
|
||||||
|
* pixel's value (an 8-bit palette value, or a 16-, 24- or 32-bit
|
||||||
|
* RGB value) */
|
||||||
|
|
||||||
|
if (bpp == 1) /* 8-bit display */
|
||||||
|
pixel = *p;
|
||||||
|
else if (bpp == 2) /* 16-bit display */
|
||||||
|
pixel = *(Uint16 *)p;
|
||||||
|
else if (bpp == 3) /* 24-bit display */
|
||||||
|
{
|
||||||
|
/* Depending on the byte-order, it could be stored RGB or BGR! */
|
||||||
|
|
||||||
|
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||||
|
pixel = p[0] << 16 | p[1] << 8 | p[2];
|
||||||
|
else
|
||||||
|
pixel = p[0] | p[1] << 8 | p[2] << 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (bpp == 4) /* 32-bit display */
|
||||||
|
pixel = *(Uint32 *)p;
|
||||||
|
|
||||||
|
/* SDL_UnlockSurface(surface); */
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_GetRGB(pixel, surface->format, &r, &g, &b);
|
||||||
|
|
||||||
|
pixel16 = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3);
|
||||||
|
|
||||||
|
return pixel16;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void hqxx_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
|
||||||
|
{
|
||||||
|
int bpp;
|
||||||
|
Uint8 * p;
|
||||||
|
|
||||||
|
|
||||||
|
/* Assuming the X/Y values are within the bounds of this surface... */
|
||||||
|
|
||||||
|
if (x >= 0 && y >= 0 && x < surface->w && y < surface->h)
|
||||||
|
{
|
||||||
|
/* SDL_LockSurface(surface); */
|
||||||
|
|
||||||
|
|
||||||
|
/* Determine bytes-per-pixel for the surface in question: */
|
||||||
|
|
||||||
|
bpp = surface->format->BytesPerPixel;
|
||||||
|
|
||||||
|
|
||||||
|
/* Set a pointer to the exact location in memory of the pixel
|
||||||
|
* in question: */
|
||||||
|
|
||||||
|
p = (Uint8 *) (((Uint8 *)surface->pixels) + /* Start: beginning of RAM */
|
||||||
|
(y * surface->pitch) + /* Go down Y lines */
|
||||||
|
(x * bpp)); /* Go in X pixels */
|
||||||
|
|
||||||
|
|
||||||
|
/* Set the (correctly-sized) piece of data in the surface's RAM
|
||||||
|
* to the pixel value sent in: */
|
||||||
|
|
||||||
|
if (bpp == 1)
|
||||||
|
*p = pixel;
|
||||||
|
else if (bpp == 2)
|
||||||
|
*(Uint16 *)p = pixel;
|
||||||
|
else if (bpp == 3)
|
||||||
|
{
|
||||||
|
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||||
|
{
|
||||||
|
p[0] = (pixel >> 16) & 0xff;
|
||||||
|
p[1] = (pixel >> 8) & 0xff;
|
||||||
|
p[2] = pixel & 0xff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p[0] = pixel & 0xff;
|
||||||
|
p[1] = (pixel >> 8) & 0xff;
|
||||||
|
p[2] = (pixel >> 16) & 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bpp == 4)
|
||||||
|
{
|
||||||
|
*(Uint32 *)p = pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SDL_UnlockSurface(surface); */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InitLUTs(int * LUT16to32, int * RGBtoYUV)
|
void InitLUTs(int * LUT16to32, int * RGBtoYUV)
|
||||||
{
|
{
|
||||||
int i, j, k, r, g, b, Y, u, v;
|
int i, j, k, r, g, b, Y, u, v;
|
||||||
|
|
||||||
for (i=0; i<65536; i++)
|
for (i = 0; i < 65536; i++)
|
||||||
LUT16to32[i] = ((i & 0xF800) << 8) + ((i & 0x07E0) << 5) + ((i & 0x001F) << 3);
|
{
|
||||||
|
LUT16to32[i] = (((i & 0xF800) << 8) +
|
||||||
|
((i & 0x07E0) << 5) +
|
||||||
|
((i & 0x001F) << 3));
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0; i<32; i++)
|
for (i=0; i<32; i++)
|
||||||
for (j=0; j<64; j++)
|
{
|
||||||
for (k=0; k<32; k++)
|
for (j = 0; j < 64; j++)
|
||||||
|
{
|
||||||
|
for (k = 0; k < 32; k++)
|
||||||
{
|
{
|
||||||
r = i << 3;
|
r = i << 3;
|
||||||
g = j << 2;
|
g = j << 2;
|
||||||
b = k << 3;
|
b = k << 3;
|
||||||
Y = (r + g + b) >> 2;
|
Y = (r + g + b) >> 2;
|
||||||
u = 128 + ((r - b) >> 2);
|
u = 128 + ((r - b) >> 2);
|
||||||
v = 128 + ((-r + 2*g -b)>>3);
|
v = 128 + ((-r + 2 * g - b) >> 3);
|
||||||
RGBtoYUV[ (i << 11) + (j << 5) + k ] = (Y<<16) + (u<<8) + v;
|
RGBtoYUV[(i << 11) + (j << 5) + k] = (Y<<16) + (u<<8) + v;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Interp1(Uint8 * pc, int c1, int c2)
|
inline void Interp0(SDL_Surface * dest, int x, int y, int c)
|
||||||
{
|
{
|
||||||
*((int*)pc) = (c1*3+c2) >> 2;
|
Uint8 r, g, b;
|
||||||
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Interp2(Uint8 * pc, int c1, int c2, int c3)
|
inline void Interp1(SDL_Surface * dest, int x, int y, int c1, int c2)
|
||||||
{
|
{
|
||||||
*((int*)pc) = (c1*2+c2+c3) >> 2;
|
Uint8 r, g, b;
|
||||||
|
Uint16 c;
|
||||||
|
|
||||||
|
c = (c1 * 3 + c2) >> 2;
|
||||||
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Interp3(Uint8 * pc, int c1, int c2)
|
inline void Interp2(SDL_Surface * dest, int x, int y, int c1, int c2, int c3)
|
||||||
{
|
{
|
||||||
//*((int*)pc) = (c1*7+c2)/8;
|
Uint8 r, g, b;
|
||||||
|
Uint16 c;
|
||||||
|
|
||||||
*((int*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) +
|
c = (c1 * 2 + c2 + c3) >> 2;
|
||||||
(((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Interp4(Uint8 * pc, int c1, int c2, int c3)
|
inline void Interp3(SDL_Surface * dest, int x, int y, int c1, int c2)
|
||||||
{
|
{
|
||||||
//*((int*)pc) = (c1*2+(c2+c3)*7)/16;
|
Uint8 r, g, b;
|
||||||
|
Uint16 c;
|
||||||
|
|
||||||
*((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) +
|
//c = (c1*7+c2)/8;
|
||||||
(((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4;
|
|
||||||
|
c = ((((c1 & 0x00FF00) * 7 + (c2 & 0x00FF00)) & 0x0007F800) +
|
||||||
|
(((c1 & 0xFF00FF) * 7 + (c2 & 0xFF00FF)) & 0x07F807F8)) >> 3;
|
||||||
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Interp5(Uint8 * pc, int c1, int c2)
|
inline void Interp4(SDL_Surface * dest, int x, int y, int c1, int c2, int c3)
|
||||||
{
|
{
|
||||||
*((int*)pc) = (c1+c2) >> 1;
|
Uint8 r, g, b;
|
||||||
|
Uint16 c;
|
||||||
|
|
||||||
|
//c = (c1*2+(c2+c3)*7)/16;
|
||||||
|
|
||||||
|
c = ((((c1 & 0x00FF00) * 2 +
|
||||||
|
((c2 & 0x00FF00) +
|
||||||
|
(c3 & 0x00FF00)) * 7) & 0x000FF000) +
|
||||||
|
(((c1 & 0xFF00FF) * 2 +
|
||||||
|
((c2 & 0xFF00FF) +
|
||||||
|
(c3 & 0xFF00FF)) * 7) & 0x0FF00FF0)) >> 4;
|
||||||
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Interp6(Uint8 * pc, int c1, int c2, int c3)
|
inline void Interp5(SDL_Surface * dest, int x, int y, int c1, int c2)
|
||||||
{
|
{
|
||||||
//*((int*)pc) = (c1*5+c2*2+c3)/8;
|
Uint8 r, g, b;
|
||||||
|
Uint16 c;
|
||||||
|
|
||||||
*((int*)pc) = ((((c1 & 0x00FF00)*5 + (c2 & 0x00FF00)*2 + (c3 & 0x00FF00) ) & 0x0007F800) +
|
c = (c1+c2) >> 1;
|
||||||
(((c1 & 0xFF00FF)*5 + (c2 & 0xFF00FF)*2 + (c3 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Interp7(Uint8 * pc, int c1, int c2, int c3)
|
inline void Interp6(SDL_Surface * dest, int x, int y, int c1, int c2, int c3)
|
||||||
{
|
{
|
||||||
//*((int*)pc) = (c1*6+c2+c3)/8;
|
Uint8 r, g, b;
|
||||||
|
Uint16 c;
|
||||||
|
|
||||||
*((int*)pc) = ((((c1 & 0x00FF00)*6 + (c2 & 0x00FF00) + (c3 & 0x00FF00) ) & 0x0007F800) +
|
//c = (c1*5+c2*2+c3)/8;
|
||||||
(((c1 & 0xFF00FF)*6 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
|
|
||||||
|
c = ((((c1 & 0x00FF00) * 5 +
|
||||||
|
(c2 & 0x00FF00) * 2 + (c3 & 0x00FF00)) & 0x0007F800) +
|
||||||
|
(((c1 & 0xFF00FF) * 5 +
|
||||||
|
(c2 & 0xFF00FF) * 2 + (c3 & 0xFF00FF)) & 0x07F807F8)) >> 3;
|
||||||
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Interp8(Uint8 * pc, int c1, int c2)
|
inline void Interp7(SDL_Surface * dest, int x, int y, int c1, int c2, int c3)
|
||||||
{
|
{
|
||||||
//*((int*)pc) = (c1*5+c2*3)/8;
|
Uint8 r, g, b;
|
||||||
|
Uint16 c;
|
||||||
|
|
||||||
*((int*)pc) = ((((c1 & 0x00FF00)*5 + (c2 & 0x00FF00)*3 ) & 0x0007F800) +
|
//c = (c1*6+c2+c3)/8;
|
||||||
(((c1 & 0xFF00FF)*5 + (c2 & 0xFF00FF)*3 ) & 0x07F807F8)) >> 3;
|
|
||||||
|
c = ((((c1 & 0x00FF00)*6 + (c2 & 0x00FF00) + (c3 & 0x00FF00)) & 0x0007F800) +
|
||||||
|
(((c1 & 0xFF00FF)*6 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF)) & 0x07F807F8))
|
||||||
|
>> 3;
|
||||||
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Interp8(SDL_Surface * dest, int x, int y, int c1, int c2)
|
||||||
|
{
|
||||||
|
Uint8 r, g, b;
|
||||||
|
Uint16 c;
|
||||||
|
|
||||||
|
//c = (c1*5+c2*3)/8;
|
||||||
|
|
||||||
|
c = ((((c1 & 0x00FF00) * 5 + (c2 & 0x00FF00) * 3) & 0x0007F800) +
|
||||||
|
(((c1 & 0xFF00FF) * 5 + (c2 & 0xFF00FF) * 3) & 0x07F807F8)) >> 3;
|
||||||
|
|
||||||
|
r = (c >> 11) & 0xFF;
|
||||||
|
g = (c >> 5) & 0xFF;
|
||||||
|
b = (c >> 0) & 0xFF;
|
||||||
|
|
||||||
|
hqxx_putpixel(dest, x, y, SDL_MapRGB(dest->format, r, g, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -117,7 +329,7 @@ inline int Diff(unsigned int w1, unsigned int w2)
|
||||||
{
|
{
|
||||||
YUV1 = w1; /* RGBtoYUV[w1]; */
|
YUV1 = w1; /* RGBtoYUV[w1]; */
|
||||||
YUV2 = w2; /* RGBtoYUV[w2]; */
|
YUV2 = w2; /* RGBtoYUV[w2]; */
|
||||||
return ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
|
return ((abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) ||
|
||||||
( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
|
(abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) ||
|
||||||
( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) );
|
(abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
33
src/hqxx.h
33
src/hqxx.h
|
|
@ -28,22 +28,27 @@
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
static int YUV1, YUV2;
|
static int YUV1, YUV2;
|
||||||
extern const int Ymask;
|
|
||||||
extern const int Umask;
|
|
||||||
extern const int Vmask;
|
|
||||||
extern const int trY;
|
|
||||||
extern const int trU;
|
|
||||||
extern const int trV;
|
|
||||||
|
|
||||||
|
#define Ymask 0x00FF0000
|
||||||
|
#define Umask 0x0000FF00
|
||||||
|
#define Vmask 0x000000FF
|
||||||
|
|
||||||
|
#define trY 0x00300000
|
||||||
|
#define trU 0x00000700
|
||||||
|
#define trV 0x00000006
|
||||||
|
|
||||||
|
|
||||||
|
Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y);
|
||||||
void InitLUTs(int * LUT16to32, int * RGBtoYUV);
|
void InitLUTs(int * LUT16to32, int * RGBtoYUV);
|
||||||
inline void Interp1(Uint8 * pc, int c1, int c2);
|
inline void Interp0(SDL_Surface * dest, int x, int y, int c);
|
||||||
inline void Interp2(Uint8 * pc, int c1, int c2, int c3);
|
inline void Interp1(SDL_Surface * dest, int x, int y, int c1, int c2);
|
||||||
inline void Interp3(Uint8 * pc, int c1, int c2);
|
inline void Interp2(SDL_Surface * dest, int x, int y, int c1, int c2, int c3);
|
||||||
inline void Interp4(Uint8 * pc, int c1, int c2, int c3);
|
inline void Interp3(SDL_Surface * dest, int x, int y, int c1, int c2);
|
||||||
inline void Interp5(Uint8 * pc, int c1, int c2);
|
inline void Interp4(SDL_Surface * dest, int x, int y, int c1, int c2, int c3);
|
||||||
inline void Interp6(Uint8 * pc, int c1, int c2, int c3);
|
inline void Interp5(SDL_Surface * dest, int x, int y, int c1, int c2);
|
||||||
inline void Interp7(Uint8 * pc, int c1, int c2, int c3);
|
inline void Interp6(SDL_Surface * dest, int x, int y, int c1, int c2, int c3);
|
||||||
inline void Interp8(Uint8 * pc, int c1, int c2);
|
inline void Interp7(SDL_Surface * dest, int x, int y, int c1, int c2, int c3);
|
||||||
|
inline void Interp8(SDL_Surface * dest, int x, int y, int c1, int c2);
|
||||||
inline int Diff(unsigned int w1, unsigned int w2);
|
inline int Diff(unsigned int w1, unsigned int w2);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(sun) && defined(__svr4__)
|
#if defined(sun) && defined(__svr4__)
|
||||||
/* Solaris needs locale.h */
|
/* Solaris needs locale.h */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
@ -3004,7 +3004,7 @@ void stamp_draw(int x, int y)
|
||||||
final_surf = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
final_surf = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||||
img_stamps[cur_stamp]->w * 4,
|
img_stamps[cur_stamp]->w * 4,
|
||||||
img_stamps[cur_stamp]->h * 4,
|
img_stamps[cur_stamp]->h * 4,
|
||||||
16,
|
img_stamps[cur_stamp]->format->BitsPerPixel,
|
||||||
img_stamps[cur_stamp]->format->Rmask,
|
img_stamps[cur_stamp]->format->Rmask,
|
||||||
img_stamps[cur_stamp]->format->Gmask,
|
img_stamps[cur_stamp]->format->Gmask,
|
||||||
img_stamps[cur_stamp]->format->Bmask,
|
img_stamps[cur_stamp]->format->Bmask,
|
||||||
|
|
@ -3969,7 +3969,7 @@ void setup(int argc, char * argv[])
|
||||||
|
|
||||||
strcpy(str, "tuxpaint.cfg");
|
strcpy(str, "tuxpaint.cfg");
|
||||||
|
|
||||||
//#elif __APPLE__
|
//#elif __APPLE__
|
||||||
/* Mac: ??? */
|
/* Mac: ??? */
|
||||||
/* FIXME! */
|
/* FIXME! */
|
||||||
|
|
||||||
|
|
@ -6313,7 +6313,7 @@ void loadarbitrary(SDL_Surface * surfs[], SDL_Surface * altsurfs[],
|
||||||
int * count, int starting, int max,
|
int * count, int starting, int max,
|
||||||
char * dir, int fatal, int maxw, int maxh)
|
char * dir, int fatal, int maxw, int maxh)
|
||||||
#else
|
#else
|
||||||
void loadarbitrary(SDL_Surface * surfs[], SDL_Surface * altsurfs[],
|
void loadarbitrary(SDL_Surface * surfs[], SDL_Surface * altsurfs[],
|
||||||
char * descs[], info_type * infs[],
|
char * descs[], info_type * infs[],
|
||||||
int * count, int starting, int max,
|
int * count, int starting, int max,
|
||||||
char * dir, int fatal, int maxw, int maxh)
|
char * dir, int fatal, int maxw, int maxh)
|
||||||
|
|
@ -9577,7 +9577,6 @@ int do_open(int want_new_tool)
|
||||||
while (f != NULL && num_files_in_dir < MAX_FILES);
|
while (f != NULL && num_files_in_dir < MAX_FILES);
|
||||||
|
|
||||||
closedir(d);
|
closedir(d);
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
@ -9608,6 +9607,7 @@ int do_open(int want_new_tool)
|
||||||
|
|
||||||
|
|
||||||
closedir(d);
|
closedir(d);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Sort: */
|
/* Sort: */
|
||||||
|
|
@ -9804,9 +9804,6 @@ int do_open(int want_new_tool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
free(dirname);
|
free(dirname);
|
||||||
|
|
||||||
|
|
@ -10389,6 +10386,7 @@ int do_open(int want_new_tool)
|
||||||
|
|
||||||
free(d_names);
|
free(d_names);
|
||||||
free(d_exts);
|
free(d_exts);
|
||||||
|
}
|
||||||
|
|
||||||
return(want_new_tool);
|
return(want_new_tool);
|
||||||
}
|
}
|
||||||
|
|
@ -10604,7 +10602,7 @@ void resort_active_list(edge * active)
|
||||||
|
|
||||||
void scan_fill(int cnt, point_type * pts)
|
void scan_fill(int cnt, point_type * pts)
|
||||||
{
|
{
|
||||||
/* edge * edges[48 * 7 + 40 + HEIGHTOFFSET + 5], * active; */
|
/* edge * edges[48 * 7 + 40 + HEIGHTOFFSET + 5], * active; */
|
||||||
edge * * edges = alloca((48 * 7 + 40 + HEIGHTOFFSET + 5) * sizeof(edge*)),
|
edge * * edges = alloca((48 * 7 + 40 + HEIGHTOFFSET + 5) * sizeof(edge*)),
|
||||||
* active;
|
* active;
|
||||||
int i, scan;
|
int i, scan;
|
||||||
|
|
@ -12465,12 +12463,12 @@ char * convert2utf8(char c)
|
||||||
outptr = (char *) outbuf;
|
outptr = (char *) outbuf;
|
||||||
|
|
||||||
count = iconv (cd, &inptr, &inbytes_left, &outptr, &outbytes_left);
|
count = iconv (cd, &inptr, &inbytes_left, &outptr, &outbytes_left);
|
||||||
/*
|
/*
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
{
|
{
|
||||||
printf ("Error!\n");
|
printf ("Error!\n");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return strdup(outbuf);
|
return strdup(outbuf);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue