Some clean-up and comments. Removed HQ4X code (unused).
This commit is contained in:
parent
5d64db32f0
commit
42955c8599
9 changed files with 22 additions and 9563 deletions
20
Makefile
20
Makefile
|
|
@ -6,7 +6,7 @@
|
|||
# bill@newbreedsoftware.com
|
||||
# http://www.newbreedsoftware.com/tuxpaint/
|
||||
|
||||
# June 14, 2002 - January 6, 2005
|
||||
# June 14, 2002 - January 14, 2005
|
||||
|
||||
|
||||
# Where to install things:
|
||||
|
|
@ -79,11 +79,6 @@ CURSOR_SHAPES=LARGE
|
|||
# CURSOR_SHAPES=SMALL
|
||||
|
||||
|
||||
# Don't build with hqxx code yet...
|
||||
# HQXX_O = obj/hqxx.o obj/hq4x.o
|
||||
# HQXX_H = src/hqxx.h src/hq4x.h
|
||||
|
||||
|
||||
# Libraries, paths, and flags:
|
||||
|
||||
SDL_LIBS=$(shell sdl-config --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
|
||||
|
|
@ -779,19 +774,6 @@ obj/BeOS_Print.o: src/BeOS_Print.cpp obj src/BeOS_print.h
|
|||
-c src/BeOS_print.cpp -o obj/BeOS_print.o
|
||||
|
||||
|
||||
obj/hq4x.o: src/hq4x.c src/hq4x.h src/hqxx.h
|
||||
@echo
|
||||
@echo "...Compiling high quality 4x scale filter..."
|
||||
@$(CC) $(CFLAGS) $(SDL_CFLAGS) \
|
||||
-c src/hq4x.c -o obj/hq4x.o
|
||||
|
||||
obj/hqxx.o: src/hqxx.c src/hqxx.h
|
||||
@echo
|
||||
@echo "...Compiling high quality scale filter helpers..."
|
||||
@$(CC) $(CFLAGS) $(SDL_CFLAGS) \
|
||||
-c src/hqxx.c -o obj/hqxx.o
|
||||
|
||||
|
||||
# Build the translation files for gettext
|
||||
|
||||
translations: trans \
|
||||
|
|
|
|||
|
|
@ -180,6 +180,8 @@ http://www.newbreedsoftware.com/tuxpaint/
|
|||
Albert Cahalan <albert@users.sf.net>
|
||||
Bill Kendrick <bill@newbreedsoftware.com>
|
||||
|
||||
* Gave up on 'HQ4X' scaler, for the time being. (Removed unused code.)
|
||||
|
||||
* Documentation updates:
|
||||
----------------------
|
||||
* Removed TODO.txt file and moved all bugs
|
||||
|
|
|
|||
3797
src/hq3x.c
3797
src/hq3x.c
File diff suppressed because it is too large
Load diff
|
|
@ -1 +0,0 @@
|
|||
void hq3x_32( unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int BpL, int LUT16to32[65536], int RGBtoYUV[65536] );
|
||||
5269
src/hq4x.c
5269
src/hq4x.c
File diff suppressed because it is too large
Load diff
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef HQ4X_H
|
||||
#define HQ4X_H
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||
Uint32 RGBtoYUV[65536]);
|
||||
|
||||
#endif
|
||||
336
src/hqxx.c
336
src/hqxx.c
|
|
@ -1,336 +0,0 @@
|
|||
/*
|
||||
hqNx filter look-up table init and helper functions
|
||||
|
||||
Copyright (C) 2003 MaxSt <maxst@hiend3d.com>
|
||||
Library-ified by Bill Kendrick <bill@newbreedsoftware.com>
|
||||
Based on "hq3x_src_c.zip" dated August 5, 2003
|
||||
from: http://www.hiend3d.com/hq3x.html
|
||||
|
||||
December 20, 2003 - December 23, 2003
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "SDL.h"
|
||||
#include "hqxx.h"
|
||||
|
||||
|
||||
Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y, Uint8 * alpha)
|
||||
{
|
||||
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); */
|
||||
}
|
||||
|
||||
if (alpha == NULL)
|
||||
SDL_GetRGB(pixel, surface->format, &r, &g, &b);
|
||||
else
|
||||
SDL_GetRGBA(pixel, surface->format, &r, &g, &b, alpha);
|
||||
|
||||
|
||||
/* (Perhaps reducing the number of colors by chopping off the bottoms of
|
||||
R, G and B will help?) */
|
||||
|
||||
pixel16 = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
|
||||
|
||||
return pixel16;
|
||||
}
|
||||
|
||||
|
||||
void hqxx_putpixel(SDL_Surface * surface, int x, int y, Uint16 pixel, Uint8 alpha)
|
||||
{
|
||||
int bpp;
|
||||
Uint8 * p;
|
||||
Uint8 r, g, b;
|
||||
Uint32 sdlpixel;
|
||||
|
||||
|
||||
/* Convert the 16bpp RGB-565 to the current surface's format: */
|
||||
|
||||
r = (pixel & 0xF800) >> 8;
|
||||
g = ((pixel & 0x07E0) >> 5) << 2;
|
||||
b = (pixel & 0x001F) << 3;
|
||||
|
||||
sdlpixel = SDL_MapRGBA(surface->format, r, g, b, alpha);
|
||||
|
||||
|
||||
/* 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 = sdlpixel;
|
||||
else if (bpp == 2)
|
||||
*(Uint16 *)p = sdlpixel;
|
||||
else if (bpp == 3)
|
||||
{
|
||||
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
||||
{
|
||||
p[0] = (sdlpixel >> 16) & 0xff;
|
||||
p[1] = (sdlpixel >> 8) & 0xff;
|
||||
p[2] = sdlpixel & 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
p[0] = sdlpixel & 0xff;
|
||||
p[1] = (sdlpixel >> 8) & 0xff;
|
||||
p[2] = (sdlpixel >> 16) & 0xff;
|
||||
}
|
||||
}
|
||||
else if (bpp == 4)
|
||||
{
|
||||
*(Uint32 *)p = sdlpixel;
|
||||
}
|
||||
|
||||
/* SDL_UnlockSurface(surface); */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void InitLUTs(Uint32 * RGBtoYUV)
|
||||
{
|
||||
int i, j, k, r, g, b, Y, u, v;
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
for (j = 0; j < 64; j++)
|
||||
{
|
||||
for (k = 0; k < 32; k++)
|
||||
{
|
||||
r = i << 3;
|
||||
g = j << 2;
|
||||
b = k << 3;
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((-r + 2 * g - b) >> 3);
|
||||
RGBtoYUV[(i << 11) + (j << 5) + k] = (((Y & 0xF8) << 8) |
|
||||
((u & 0xFE) << 3) |
|
||||
(v >> 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Interp0(SDL_Surface * dest, int x, int y, Uint16 c, Uint8 alpha)
|
||||
{
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
void Interp1(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha)
|
||||
{
|
||||
Uint32 c;
|
||||
|
||||
// c = (c1 * 3 + c2) >> 2;
|
||||
|
||||
c = ((((c1 & 0x07E0) * 3 + (c2 & 0x07E0)) & (0x07E0 << 2)) +
|
||||
(((c1 & 0xF81F) * 3 + (c2 & 0xF81F)) & (0xF81F << 2))) >> 2;
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
void Interp2(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha)
|
||||
{
|
||||
Uint32 c;
|
||||
|
||||
/* FIXME? */
|
||||
|
||||
// c = (c1 * 2 + c2 + c3) >> 2;
|
||||
|
||||
c = ((((c1 & 0x07E0) * 2 + (c2 & 0x07E0) + (c3 & 0x07E0)) & (0x07E0 << 2)) +
|
||||
(((c1 & 0xF81F) * 2 + (c2 & 0xF81F) + (c3 & 0xF81F)) & (0xF81F << 2)))
|
||||
>> 2;
|
||||
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
void Interp3(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha)
|
||||
{
|
||||
Uint32 c;
|
||||
|
||||
//c = (c1 * 7 + c2) / 8;
|
||||
|
||||
//c = ((((c1 & 0x00FF00) * 7 + (c2 & 0x00FF00)) & 0x0007F800) +
|
||||
// (((c1 & 0xFF00FF) * 7 + (c2 & 0xFF00FF)) & 0x07F807F8)) >> 3;
|
||||
|
||||
c = ((((c1 & 0x07E0) * 7 + (c2 & 0x07E0)) & (0x07E0 << 3)) +
|
||||
(((c1 & 0xF81F) * 7 + (c2 & 0xF81F)) & (0xF81F << 3))) >> 3;
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
void Interp4(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha)
|
||||
{
|
||||
Uint32 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;
|
||||
|
||||
c = ((((c1 & 0x07E0) * 2 +
|
||||
((c2 & 0x07E0) +
|
||||
(c3 & 0x07E0)) * 7) & 0x7E00) +
|
||||
(((c1 & 0xF81F) * 2 +
|
||||
((c2 & 0xF81F) +
|
||||
(c3 & 0xF81F)) * 7) & 0xF81F0)) >> 4;
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
void Interp5(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha)
|
||||
{
|
||||
Uint32 c;
|
||||
|
||||
// c = (c1 + c2) >> 1;
|
||||
|
||||
c = ((((c1 & 0x07E0) + (c2 & 0x07E0)) & (0x07E0 << 1)) +
|
||||
(((c1 & 0xF81F) + (c2 & 0xF81F)) & (0xF81F << 1))) >> 1;
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
void Interp6(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha)
|
||||
{
|
||||
Uint32 c;
|
||||
|
||||
// c = (c1 * 5 + c2 * 2 + c3) / 8;
|
||||
|
||||
// c = ((((c1 & 0x00FF00) * 5 +
|
||||
// (c2 & 0x00FF00) * 2 + (c3 & 0x00FF00)) & 0x0007F800) +
|
||||
// (((c1 & 0xFF00FF) * 5 +
|
||||
// (c2 & 0xFF00FF) * 2 + (c3 & 0xFF00FF)) & 0x07F807F8)) >> 3;
|
||||
|
||||
c = ((((c1 & 0x07E0) * 5 +
|
||||
(c2 & 0x07E0) * 2 + (c3 & 0x07E0)) & (0x07E0 << 3)) +
|
||||
(((c1 & 0xF81F) * 5 +
|
||||
(c2 & 0xF81F) * 2 + (c3 & 0xF81F)) & (0xF81F << 3))) >> 3;
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
void Interp7(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha)
|
||||
{
|
||||
Uint32 c;
|
||||
|
||||
//c = (c1 * 6 + c2 + c3) / 8;
|
||||
|
||||
//c = ((((c1 & 0x00FF00)*6 + (c2 & 0x00FF00) + (c3 & 0x00FF00)) & 0x0007F800) +
|
||||
// (((c1 & 0xFF00FF)*6 + (c2 & 0xFF00FF) + (c3 & 0xFF00FF)) & 0x07F807F8))
|
||||
// >> 3;
|
||||
|
||||
c = ((((c1 & 0x07E0)*6 + (c2 & 0x07E0) + (c3 & 0x07E0)) & (0x07E0 << 3)) +
|
||||
(((c1 & 0xF81F)*6 + (c2 & 0xF81F) + (c3 & 0xF81F)) & (0xF81F << 3)))
|
||||
>> 3;
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
void Interp8(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha)
|
||||
{
|
||||
Uint32 c;
|
||||
|
||||
//c = (c1 * 5 + c2 * 3) / 8;
|
||||
|
||||
//c = ((((c1 & 0x00FF00) * 5 + (c2 & 0x00FF00) * 3) & 0x0007F800) +
|
||||
// (((c1 & 0xFF00FF) * 5 + (c2 & 0xFF00FF) * 3) & 0x07F807F8)) >> 3;
|
||||
|
||||
c = ((((c1 & 0x07E0) * 5 + (c2 & 0x07E0) * 3) & (0x07E0 << 3)) +
|
||||
(((c1 & 0xF81F) * 5 + (c2 & 0xF81F) * 3) & (0xF81F << 3))) >> 3;
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
|
||||
int Diff(unsigned int w1, unsigned int w2)
|
||||
{
|
||||
return ((abs((w1 & Ymask) - (w2 & Ymask)) > trY) ||
|
||||
(abs((w1 & Umask) - (w2 & Umask)) > trU) ||
|
||||
(abs((w1 & Vmask) - (w2 & Vmask)) > trV));
|
||||
}
|
||||
64
src/hqxx.h
64
src/hqxx.h
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
hqNx filter look-up table init and helper functions
|
||||
|
||||
Copyright (C) 2003 MaxSt ( maxst@hiend3d.com )
|
||||
Library-ified by Bill Kendrick <bill@newbreedsoftware.com>
|
||||
Based on "hq3x_src_c.zip" dated August 5, 2003
|
||||
from: http://www.hiend3d.com/hq3x.html
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser 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
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HQINIT_H
|
||||
#define HQINIT_H
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#define Ymask 0xF800
|
||||
#define Umask 0x07E0
|
||||
#define Vmask 0x001F
|
||||
|
||||
//trY in 32 = 0x00300000
|
||||
//trU in 32 = 0x00000700
|
||||
//trV in 32 = 0x00000006
|
||||
|
||||
#define trY ((0x30 & 0xF8) << 8)
|
||||
#define trU ((0x07 & 0x7E) << 3)
|
||||
#define trV ((0x06 & 0x1F))
|
||||
|
||||
#ifdef WIN32
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y, Uint8 * alpha);
|
||||
void InitLUTs(Uint32 * RGBtoYUV);
|
||||
inline void Interp0(SDL_Surface * dest, int x, int y, Uint16 c, Uint8 alpha);
|
||||
inline void Interp1(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha);
|
||||
inline void Interp2(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha);
|
||||
inline void Interp3(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha);
|
||||
inline void Interp4(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha);
|
||||
inline void Interp5(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha);
|
||||
inline void Interp6(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha);
|
||||
inline void Interp7(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha);
|
||||
inline void Interp8(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha);
|
||||
inline int Diff(unsigned int w1, unsigned int w2);
|
||||
|
||||
#ifdef WIN32
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -22,23 +22,30 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 14, 2002 - January 12, 2005
|
||||
June 14, 2002 - January 14, 2005
|
||||
*/
|
||||
|
||||
|
||||
#define VER_VERSION "0.9.15"
|
||||
#define VER_DATE "2005-01-12"
|
||||
#define VER_DATE "2005-01-14"
|
||||
|
||||
|
||||
/* Color depth for Tux Paint to run in, and store canvases in: */
|
||||
|
||||
//#define VIDEO_BPP 15 // saves memory
|
||||
//#define VIDEO_BPP 16 // causes discoloration
|
||||
//#define VIDEO_BPP 24 // compromise
|
||||
#define VIDEO_BPP 32 // might be fastest, if conversion funcs removed
|
||||
|
||||
|
||||
#define PRINTMETHOD_PS
|
||||
//#define PRINTMETHOD_PNM_PS
|
||||
//#define PRINTMETHOD_PNG_PNM_PS
|
||||
/* Method for printing images: */
|
||||
|
||||
#define PRINTMETHOD_PS /* Direct to PostScript */
|
||||
//#define PRINTMETHOD_PNM_PS /* Output PNM, assuming it gets printed */
|
||||
//#define PRINTMETHOD_PNG_PNM_PS /* Output PNG, assuming it gets printed */
|
||||
|
||||
|
||||
/* Default print command, depending on the print method: */
|
||||
|
||||
#ifdef PRINTMETHOD_PNG_PNM_PS
|
||||
#define PRINTCOMMAND "pngtopnm | pnmtops | lpr"
|
||||
|
|
@ -50,6 +57,9 @@
|
|||
#error No print method defined!
|
||||
#endif
|
||||
|
||||
|
||||
/* Compile-time options: */
|
||||
|
||||
/* #define DEBUG */
|
||||
/* #define DEBUG_MALLOC */
|
||||
/* #define LOW_QUALITY_THUMBNAILS */
|
||||
|
|
@ -59,10 +69,6 @@
|
|||
/* #define NO_PROMPT_SHADOWS */
|
||||
/* #define USE_HWSURFACE */
|
||||
|
||||
/* Use high quality 4x filter when scaling stamps up: */
|
||||
/* #define USE_HQ4X */
|
||||
|
||||
|
||||
/* Disable fancy cursors in fullscreen mode, to avoid SDL bug: */
|
||||
#define LARGE_CURSOR_FULLSCREEN_BUG
|
||||
|
||||
|
|
@ -111,13 +117,15 @@ static scaleparams scaletable[] = {
|
|||
{ 48, 1}, // 48
|
||||
};
|
||||
|
||||
|
||||
/* Macros: */
|
||||
|
||||
#define HARD_MIN_STAMP_SIZE 0 // bottom of scaletable
|
||||
#define HARD_MAX_STAMP_SIZE (sizeof scaletable / sizeof scaletable[0] - 1)
|
||||
|
||||
#define MIN_STAMP_SIZE (state_stamps[cur_stamp]->min)
|
||||
#define MAX_STAMP_SIZE (state_stamps[cur_stamp]->max)
|
||||
|
||||
#define CAN_USE_HQ4X (scaletable[state_stamps[cur_stamp]->size] == (scaleparams){4,1})
|
||||
// to scale some offset, in pixels, like the current stamp is scaled
|
||||
#define SCALE_LIKE_STAMP(x) ( ((x) * scaletable[state_stamps[cur_stamp]->size].numer + scaletable[state_stamps[cur_stamp]->size].denom-1) / scaletable[state_stamps[cur_stamp]->size].denom )
|
||||
// pixel dimensions of the current stamp, as scaled
|
||||
|
|
@ -127,8 +135,6 @@ static scaleparams scaletable[] = {
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// #define MAX_FILES 2048 /* Max. # of files in a dir. to worry about... */
|
||||
|
||||
#define REPEAT_SPEED 300 /* Initial repeat speed for scrollbars */
|
||||
#define CURSOR_BLINK_SPEED 500 /* Initial repeat speed for cursor */
|
||||
|
||||
|
|
@ -143,12 +149,6 @@ static scaleparams scaletable[] = {
|
|||
#include <math.h>
|
||||
#undef y1
|
||||
|
||||
#ifdef USE_HQ4X
|
||||
#include "hqxx.h"
|
||||
#include "hq3x.h"
|
||||
#include "hq4x.h"
|
||||
#endif
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#ifndef OLD_UPPERCASE_CODE
|
||||
|
|
@ -2104,10 +2104,6 @@ static SDL_Event scrolltimer_event;
|
|||
|
||||
static char * savedir;
|
||||
|
||||
#ifdef USE_HQ4X
|
||||
static int RGBtoYUV[65536];
|
||||
#endif
|
||||
|
||||
typedef struct dirent2 {
|
||||
struct dirent f;
|
||||
int place;
|
||||
|
|
@ -5017,45 +5013,7 @@ static void stamp_draw(int x, int y)
|
|||
|
||||
/* Shrink or grow it! */
|
||||
|
||||
#ifdef USE_HQ4X
|
||||
if (CAN_USE_HQ4X)
|
||||
{
|
||||
/* Use high quality 4x filter! */
|
||||
|
||||
|
||||
/* Make the new surface for the scaled image: */
|
||||
|
||||
amask = ~(img_stamps[cur_stamp]->format->Rmask |
|
||||
img_stamps[cur_stamp]->format->Gmask |
|
||||
img_stamps[cur_stamp]->format->Bmask);
|
||||
|
||||
final_surf = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
img_stamps[cur_stamp]->w * 4,
|
||||
img_stamps[cur_stamp]->h * 4,
|
||||
img_stamps[cur_stamp]->format->BitsPerPixel,
|
||||
img_stamps[cur_stamp]->format->Rmask,
|
||||
img_stamps[cur_stamp]->format->Gmask,
|
||||
img_stamps[cur_stamp]->format->Bmask,
|
||||
amask);
|
||||
|
||||
if (final_surf == NULL)
|
||||
{
|
||||
fprintf(stderr, "\nError: Can't build stamp thumbnails\n"
|
||||
"The Simple DirectMedia Layer error that occurred was:\n"
|
||||
"%s\n\n", SDL_GetError());
|
||||
|
||||
cleanup();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
hq4x_32(tmp_surf, final_surf, RGBtoYUV);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
final_surf = thumbnail(tmp_surf, CUR_STAMP_W, CUR_STAMP_H, 0);
|
||||
}
|
||||
final_surf = thumbnail(tmp_surf, CUR_STAMP_W, CUR_STAMP_H, 0);
|
||||
|
||||
|
||||
/* Where it will go? */
|
||||
|
|
@ -6993,13 +6951,6 @@ static void setup(int argc, char * argv[])
|
|||
SDL_Flip(screen);
|
||||
|
||||
|
||||
#ifdef USE_HQ4X
|
||||
/* Init high quality scaling stuff: */
|
||||
|
||||
InitLUTs(RGBtoYUV);
|
||||
#endif
|
||||
|
||||
|
||||
/* Load other images: */
|
||||
|
||||
for (i = 0; i < NUM_TOOLS; i++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue