asm for colormod ops......... :)

SVN revision: 2600
This commit is contained in:
Carsten Haitzler 2000-05-05 16:28:39 +00:00
parent 15ff380285
commit 01d14d7867
7 changed files with 2532 additions and 631 deletions

View File

@ -16,11 +16,13 @@ include_HEADERS = Imlib2.h
libImlib2_la_SOURCES = rend.c ximage.c scale.c rgba.c image.c color.c grab.c \
blend.c file.c rgbadraw.c api.c draw.c context.c \
updates.c colormod.c font.c format.c grad.c rotate.c \
filter.c \
Imlib2.h image.h scale.h blend.h context.h updates.h \
color.h draw.h rend.h ximage.h colormod.h file.h \
rgba.h common.h grab.h rgbadraw.h font.h format.h \
rotate.h grad.h filter.h \
asm_blend.S filter.c asm_rgba.S asm_scale.S asm_rotate.S
asm_blend.S asm_rgba.S asm_scale.S asm_rotate.S \
asm_blend_cmod.S
libImlib2_la_LIBADD = @DLLDFLAGS@ $(top_builddir)/libltdl/libltdlc.la \
-lX11 -lXext -lttf $(LDFLAGS)
libImlib2_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -31,6 +31,7 @@
.global __imlib_mmx_copy_rgba_to_rgba
.type __imlib_mmx_copy_rgba_to_rgba,@function
.global __imlib_mmx_copy_rgb_to_rgba
.type __imlib_mmx_copy_rgb_to_rgba,@function
.global __imlib_mmx_add_blend_rgba_to_rgb
.type __imlib_mmx_add_blend_rgba_to_rgb,@function
@ -40,6 +41,9 @@
.type __imlib_mmx_add_copy_rgba_to_rgb,@function
.global __imlib_mmx_add_copy_rgba_to_rgba
.type __imlib_mmx_add_copy_rgba_to_rgba,@function
.global __imlib_mmx_add_copy_rgb_to_rgba
.type __imlib_mmx_add_copy_rgb_to_rgba,@function
.global __imlib_mmx_subtract_blend_rgba_to_rgb
.type __imlib_mmx_subtract_blend_rgba_to_rgb,@function
.global __imlib_mmx_subtract_blend_rgba_to_rgba
@ -48,6 +52,9 @@
.type __imlib_mmx_subtract_copy_rgba_to_rgb,@function
.global __imlib_mmx_subtract_copy_rgba_to_rgba
.type __imlib_mmx_subtract_copy_rgba_to_rgba,@function
.global __imlib_mmx_subtract_copy_rgb_to_rgba
.type __imlib_mmx_subtract_copy_rgb_to_rgba,@function
.global __imlib_mmx_reshade_blend_rgba_to_rgb
.type __imlib_mmx_reshade_blend_rgba_to_rgb,@function
.global __imlib_mmx_reshade_blend_rgba_to_rgba
@ -56,6 +63,8 @@
.type __imlib_mmx_reshade_copy_rgba_to_rgb,@function
.global __imlib_mmx_reshade_copy_rgba_to_rgba
.type __imlib_mmx_reshade_copy_rgba_to_rgba,@function
.global __imlib_mmx_reshade_copy_rgb_to_rgba
.type __imlib_mmx_reshade_copy_rgb_to_rgba,@function
.bss
.text
@ -84,51 +93,49 @@ c1: .word 0x1, 0x1, 0x1, 0x1
/*\ Common code \*/
/*\ Set MMX mode, save registers, load common parameters \*/
#define ENTER \
emms; \
pushl %ebp; \
movl %esp, %ebp; \
pushl %ebx; \
pushl %ecx; \
pushl %edx; \
pushl %edi; \
pushl %esi; \
movl src, %esi; \
movl dst, %edi; \
movl w, %ebx; \
movl h, %edx
#define ENTER \
pushl %ebp ;\
movl %esp, %ebp ;\
pushl %ebx ;\
pushl %ecx ;\
pushl %edx ;\
pushl %edi ;\
pushl %esi ;\
movl h, %edx ;\
movl w, %ebx ;\
movl src, %esi ;\
movl dst, %edi ;\
leal (%esi, %ebx, 4), %esi ;\
leal (%edi, %ebx, 4), %edi ;\
negl %ebx ;\
jz 9f ;\
decl %edx ;\
jz 9f ;\
#define LOOP_START \
decl %edx; \
js 3f; \
decl %ebx; \
js 3f; \
0: \
8: ;\
movl %ebx, %ecx
#define LOOP_END \
decl %ecx; \
jns 1b; \
2: \
movl sw, %ecx; \
leal (%esi, %ecx, 4), %esi; \
movl dw, %ecx; \
leal (%edi, %ecx, 4), %edi; \
decl %edx; \
jns 0b
movl sw, %ecx ;\
leal (%esi, %ecx, 4), %esi ;\
movl dw, %ecx ;\
leal (%edi, %ecx, 4), %edi ;\
decl %edx ;\
jns 8b
/*\ Unset MMX mode, reset registers, return \*/
#define LEAVE \
3: \
emms; \
popl %esi; \
popl %edi; \
popl %edx; \
popl %ecx; \
popl %ebx; \
movl %ebp, %esp; \
popl %ebp; \
9: ;\
emms ;\
popl %esi ;\
popl %edi ;\
popl %edx ;\
popl %ecx ;\
popl %ebx ;\
movl %ebp, %esp ;\
popl %ebp ;\
ret
@ -180,47 +187,8 @@ __imlib_mmx_blend_rgba_to_rgb:
packuswb %mm4, %mm2
movd %mm2, (%edi, %ecx, 4)
LOOP_END
LEAVE
__imlib_mmx_copy_rgba_to_rgb:
ENTER
movq m0XXX0XXX, %mm5
movq mX000X000, %mm6
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
/*\ Load source and destination \*/
movd (%esi, %ecx, 8), %mm1
movd (%edi, %ecx, 8), %mm2
/*\ Clear alpha channel of source, get alpha of destination \*/
pand %mm5, %mm1
pand %mm6, %mm2
/*\ d = d | s, and save \*/
por %mm1, %mm2
movd %mm2, (%edi, %ecx, 8)
decl %ecx
js 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 8), %mm1
movq (%edi, %ecx, 8), %mm2
/*\ Clear alpha channel of source \*/
pand %mm5, %mm1
pand %mm6, %mm2
/*\ d = d | s, and save \*/
por %mm1, %mm2
movq %mm2, (%edi, %ecx, 8)
incl %ecx
js 1b
LOOP_END
LEAVE
@ -273,6 +241,52 @@ __imlib_mmx_blend_rgba_to_rgba:
packuswb %mm4, %mm2
movd %mm2, (%edi, %ecx, 4)
incl %ecx
js 1b
LOOP_END
LEAVE
__imlib_mmx_copy_rgba_to_rgb:
ENTER
movq m0XXX0XXX, %mm5
movq mX000X000, %mm6
/*\ Two at a time: last item is at %ecx = 0 \*/
subl $4, %esi
subl $4, %edi
LOOP_START
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ Clear alpha channel of source, get alpha of destination \*/
pand %mm5, %mm1
pand %mm6, %mm2
/*\ d = d | s, and save \*/
por %mm1, %mm2
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
pand %mm5, %mm1
pand %mm6, %mm2
por %mm1, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
@ -280,23 +294,24 @@ __imlib_mmx_blend_rgba_to_rgba:
__imlib_mmx_copy_rgba_to_rgba:
ENTER
subl $4, %esi
subl $4, %edi
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
/*\ Load source, save destination \*/
movd (%esi, %ecx, 8), %mm1
movd %mm1, (%edi, %ecx, 8)
decl %ecx
incl %ecx
jz 2f
1:
/*\ Load source, save destination \*/
movq (%esi, %ecx, 8), %mm1
movq %mm1, (%edi, %ecx, 8)
movq (%esi, %ecx, 4), %mm1
movq %mm1, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd %mm1, (%edi)
3:
LOOP_END
LEAVE
@ -306,24 +321,26 @@ __imlib_mmx_copy_rgb_to_rgba:
movq mX000X000, %mm5
subl $4, %esi
subl $4, %edi
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
/*\ Load source, make alpha 0xff, save destination \*/
movd (%esi, %ecx, 8), %mm1
por %mm5, %mm1
movd %mm1, (%edi, %ecx, 8)
decl %ecx
incl %ecx
jz 2f
1:
/*\ Load source, save destination \*/
movq (%esi, %ecx, 8), %mm1
movq (%esi, %ecx, 4), %mm1
por %mm5, %mm1
movq %mm1, (%edi, %ecx, 8)
movq %mm1, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
por %mm5, %mm1
movd %mm1, (%edi)
3:
LOOP_END
LEAVE
@ -362,6 +379,9 @@ __imlib_mmx_add_blend_rgba_to_rgb:
packuswb %mm4, %mm2
movd %mm2, (%edi, %ecx, 4)
incl %ecx
js 1b
LOOP_END
LEAVE
@ -407,6 +427,9 @@ __imlib_mmx_add_blend_rgba_to_rgba:
packuswb %mm4, %mm2
movd %mm2, (%edi, %ecx, 4)
incl %ecx
js 1b
LOOP_END
LEAVE
@ -416,37 +439,34 @@ __imlib_mmx_add_copy_rgba_to_rgb:
movq m0XXX0XXX, %mm5
subl $4, %esi
subl $4, %edi
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
/*\ Load source and destination \*/
movd (%esi, %ecx, 8), %mm1
movd (%edi, %ecx, 8), %mm2
/*\ Clear alpha channel of source \*/
pand %mm5, %mm1
/*\ d = d + s, unsigned saturation, and save \*/
paddusb %mm1, %mm2
movd %mm2, (%edi, %ecx, 8)
decl %ecx
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 8), %mm1
movq (%edi, %ecx, 8), %mm2
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ Clear alpha channel of source \*/
pand %mm5, %mm1
/*\ d = d + s, unsigned saturation, and save \*/
paddusb %mm1, %mm2
movq %mm2, (%edi, %ecx, 8)
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
pand %mm5, %mm1
paddusb %mm1, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
@ -454,30 +474,67 @@ __imlib_mmx_add_copy_rgba_to_rgb:
__imlib_mmx_add_copy_rgba_to_rgba:
ENTER
subl $4, %esi
subl $4, %edi
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
/*\ Load source and destination \*/
movd (%esi, %ecx, 8), %mm1
movd (%edi, %ecx, 8), %mm2
/*\ d = d + s, unsigned saturation, and save \*/
paddusb %mm1, %mm2
movd %mm2, (%edi, %ecx, 8)
decl %ecx
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 8), %mm1
movq (%edi, %ecx, 8), %mm2
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ d = d + s, unsigned saturation, and save \*/
paddusb %mm1, %mm2
movq %mm2, (%edi, %ecx, 8)
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
paddusb %mm1, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
__imlib_mmx_add_copy_rgb_to_rgba:
ENTER
movq mX000X000, %mm5
subl $4, %esi
subl $4, %edi
LOOP_START
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ d = d + s, unsigned saturation, and save \*/
paddusb %mm1, %mm2
/*\ Make result alpha 0xff \*/
por %mm5, %mm2
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
paddusb %mm1, %mm2
por %mm5, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
@ -515,6 +572,9 @@ __imlib_mmx_subtract_blend_rgba_to_rgb:
packuswb %mm4, %mm2
movd %mm2, (%edi, %ecx, 4)
incl %ecx
js 1b
LOOP_END
LEAVE
@ -560,6 +620,9 @@ __imlib_mmx_subtract_blend_rgba_to_rgba:
packuswb %mm4, %mm2
movd %mm2, (%edi, %ecx, 4)
incl %ecx
js 1b
LOOP_END
LEAVE
@ -569,37 +632,34 @@ __imlib_mmx_subtract_copy_rgba_to_rgb:
movq m0XXX0XXX, %mm5
subl $4, %esi
subl $4, %edi
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
/*\ Load source and destination \*/
movd (%esi, %ecx, 8), %mm1
movd (%edi, %ecx, 8), %mm2
/*\ Clear alpha channel of source \*/
pand %mm5, %mm1
/*\ d = d - s, unsigned saturation, and save \*/
psubusb %mm1, %mm2
movd %mm2, (%edi, %ecx, 8)
decl %ecx
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 8), %mm1
movq (%edi, %ecx, 8), %mm2
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ Clear alpha channel of source \*/
pand %mm5, %mm1
/*\ d = d - s, unsigned saturation, and save \*/
psubusb %mm1, %mm2
movq %mm2, (%edi, %ecx, 8)
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
pand %mm5, %mm1
psubusb %mm1, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
@ -609,15 +669,16 @@ __imlib_mmx_subtract_copy_rgba_to_rgba:
movq mX000X000, %mm5
subl $4, %esi
subl $4, %edi
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movd (%esi, %ecx, 8), %mm1
movd (%edi, %ecx, 8), %mm2
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ Negate destination alphas \*/
pxor %mm5, %mm2
@ -627,20 +688,56 @@ __imlib_mmx_subtract_copy_rgba_to_rgba:
/*\ Negate result alphas \*/
pxor %mm5, %mm2
movd %mm2, (%edi, %ecx, 8)
decl %ecx
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
pxor %mm5, %mm2
psubusb %mm1, %mm2
pxor %mm5, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
__imlib_mmx_subtract_copy_rgb_to_rgba:
ENTER
movq mX000X000, %mm5
subl $4, %esi
subl $4, %edi
LOOP_START
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 8), %mm1
movq (%edi, %ecx, 8), %mm2
pxor %mm5, %mm2
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ d = d - s, unsigned saturation, and save \*/
psubusb %mm1, %mm2
pxor %mm5, %mm2
movq %mm2, (%edi, %ecx, 8)
/*\ Make result alpha 0xff \*/
por %mm5, %mm2
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
psubusb %mm1, %mm2
por %mm5, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
@ -680,6 +777,9 @@ __imlib_mmx_reshade_blend_rgba_to_rgb:
packuswb %mm4, %mm2
movd %mm2, (%edi, %ecx, 4)
incl %ecx
js 1b
LOOP_END
LEAVE
@ -728,6 +828,9 @@ __imlib_mmx_reshade_blend_rgba_to_rgba:
packuswb %mm4, %mm2
movd %mm2, (%edi, %ecx, 4)
incl %ecx
js 1b
LOOP_END
LEAVE
@ -739,15 +842,16 @@ __imlib_mmx_reshade_copy_rgba_to_rgb:
movq m0XXX0XXX, %mm5
movq m0VVV0VVV, %mm6
subl $4, %esi
subl $4, %edi
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movd (%esi, %ecx, 8), %mm1
movd (%edi, %ecx, 8), %mm2
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ To take advantage of saturation and be able to do 8 bytes
|*| at a time, we divide reshading into two separate steps:
@ -770,32 +874,26 @@ __imlib_mmx_reshade_copy_rgba_to_rgb:
/*\ d = d + s1 - s2, unsigned saturation, and save \*/
paddusb %mm1, %mm2
psubusb %mm3, %mm2
movd %mm2, (%edi, %ecx, 8)
/*\ MMX ops don't set flags \*/
decl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 8), %mm1
movq (%edi, %ecx, 8), %mm2
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
movq %mm1, %mm3
psubusb %mm6, %mm1
paddusb %mm1, %mm1
paddusb %mm6, %mm3
pxor %mm5, %mm3
paddusb %mm3, %mm3
/*\ Clear alpha channel of s1 and s2 \*/
pand %mm5, %mm1
pand %mm5, %mm3
/*\ d = d + s1 - s2, unsigned saturation, and save \*/
paddusb %mm1, %mm2
psubusb %mm3, %mm2
movq %mm2, (%edi, %ecx, 8)
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
@ -807,15 +905,16 @@ __imlib_mmx_reshade_copy_rgba_to_rgba:
movq m0XXX0XXX, %mm5
movq m0VVV0VVV, %mm6
subl $4, %esi
subl $4, %edi
LOOP_START
/*\ Check for oddness \*/
sarl $1, %ecx
jc 1f
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movd (%esi, %ecx, 8), %mm1
movd (%edi, %ecx, 8), %mm2
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
/*\ This time, the alpha channels have to be added.
|*| For that, the alpha channel of %mm1 should remain
@ -838,16 +937,14 @@ __imlib_mmx_reshade_copy_rgba_to_rgba:
/*\ d = d + s1 - s2, unsigned saturation, and save \*/
paddusb %mm1, %mm2
psubusb %mm3, %mm2
movd %mm2, (%edi, %ecx, 8)
/*\ MMX ops don't set flags \*/
decl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 8), %mm1
movq (%edi, %ecx, 8), %mm2
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
movq %mm1, %mm3
psubusb %mm6, %mm1
movq %mm1, %mm0
@ -856,15 +953,66 @@ __imlib_mmx_reshade_copy_rgba_to_rgba:
paddusb %mm6, %mm3
pxor %mm5, %mm3
paddusb %mm3, %mm3
/*\ Clear alpha channel of s2 \*/
pand %mm5, %mm3
paddusb %mm1, %mm2
psubusb %mm3, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE
__imlib_mmx_reshade_copy_rgb_to_rgba:
ENTER
pxor %mm4, %mm4
movq m0XXX0XXX, %mm5
movq m0VVV0VVV, %mm6
movq mX000X000, %mm7
subl $4, %esi
subl $4, %edi
LOOP_START
incl %ecx
jz 2f
1:
/*\ Load source and destination \*/
movq (%esi, %ecx, 4), %mm1
movq (%edi, %ecx, 4), %mm2
movq %mm1, %mm3
psubusb %mm6, %mm1
paddusb %mm1, %mm1
paddusb %mm6, %mm3
pxor %mm5, %mm3
paddusb %mm3, %mm3
/*\ d = d + s1 - s2, unsigned saturation, and save \*/
paddusb %mm1, %mm2
psubusb %mm3, %mm2
movq %mm2, (%edi, %ecx, 8)
/*\ Make result alpha 0xff \*/
por %mm7, %mm2
movq %mm2, (%edi, %ecx, 4)
addl $2, %ecx
js 1b
jnz 3f
2:
movd (%esi), %mm1
movd (%edi), %mm2
movq %mm1, %mm3
psubusb %mm6, %mm1
paddusb %mm1, %mm1
paddusb %mm6, %mm3
pxor %mm5, %mm3
paddusb %mm3, %mm3
paddusb %mm1, %mm2
psubusb %mm3, %mm2
por %mm7, %mm2
movd %mm2, (%edi)
3:
LOOP_END
LEAVE

1558
src/asm_blend_cmod.S Normal file

File diff suppressed because it is too large Load Diff

View File

@ -91,17 +91,6 @@ __imlib_BlendRGBAToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_BlendRGBToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START
*p2 = 0xff000000 | (*p1 & 0x00ffffff);
LOOP_END_WITH_INCREMENT
}
static void
__imlib_CopyRGBAToRGB(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
@ -186,7 +175,6 @@ __imlib_AddCopyRGBAToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
{
LOOP_START_3
SATURATE_UPPER(a, A_VAL(p1) + (255 - A_VAL(p2)));
ADD_COLOR(R_VAL(p2), R_VAL(p1), R_VAL(p2));
ADD_COLOR(G_VAL(p2), G_VAL(p1), G_VAL(p2));
ADD_COLOR(B_VAL(p2), B_VAL(p1), B_VAL(p2));
@ -195,6 +183,20 @@ __imlib_AddCopyRGBAToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_AddCopyRGBToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
ADD_COLOR(R_VAL(p2), R_VAL(p1), R_VAL(p2));
ADD_COLOR(G_VAL(p2), G_VAL(p1), G_VAL(p2));
ADD_COLOR(B_VAL(p2), B_VAL(p1), B_VAL(p2));
A_VAL(p2) = 0xff;
LOOP_END_WITH_INCREMENT
}
/* SUBTRACT OPS */
static void
@ -254,6 +256,20 @@ __imlib_SubCopyRGBAToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_SubCopyRGBToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
SUB_COLOR(R_VAL(p2), R_VAL(p1), R_VAL(p2));
SUB_COLOR(G_VAL(p2), G_VAL(p1), G_VAL(p2));
SUB_COLOR(B_VAL(p2), B_VAL(p1), B_VAL(p2));
A_VAL(p2) = 0xff;
LOOP_END_WITH_INCREMENT
}
/* RESHADE OPS */
@ -314,6 +330,20 @@ __imlib_ReCopyRGBAToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_ReCopyRGBToRGBA(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
RESHADE_COLOR(R_VAL(p2), R_VAL(p1), R_VAL(p2));
RESHADE_COLOR(G_VAL(p2), G_VAL(p1), G_VAL(p2));
RESHADE_COLOR(B_VAL(p2), B_VAL(p1), B_VAL(p2));
A_VAL(p2) = 0xff;
LOOP_END_WITH_INCREMENT
}
@ -369,10 +399,25 @@ __imlib_BlendRGBToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
{
LOOP_START_3
R_VAL(p2) = R_CMOD(cm, R_VAL(p1));
G_VAL(p2) = G_CMOD(cm, G_VAL(p1));
B_VAL(p2) = B_CMOD(cm, B_VAL(p1));
A_VAL(p2) = 0xff;
SATURATE_UPPER(a, A_CMOD(cm, 0xff) + (255 - A_VAL(p2)));
BLEND_COLOR(a, R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
BLEND_COLOR(a, G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
BLEND_COLOR(a, B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
SATURATE_UPPER(A_VAL(p2), A_CMOD(cm, 0xff) + A_VAL(p2));
LOOP_END_WITH_INCREMENT
}
static void
__imlib_BlendRGBToRGBCmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
a = A_CMOD(cm, 0xff);
BLEND_COLOR(a, R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
BLEND_COLOR(a, G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
BLEND_COLOR(a, B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
LOOP_END_WITH_INCREMENT
}
@ -399,7 +444,7 @@ __imlib_CopyRGBToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
R_VAL(p2) = R_CMOD(cm, R_VAL(p1));
G_VAL(p2) = G_CMOD(cm, G_VAL(p1));
B_VAL(p2) = B_CMOD(cm, B_VAL(p1));
A_VAL(p2) = 0xff;
A_VAL(p2) = A_CMOD(cm, 0xff);
LOOP_END_WITH_INCREMENT
}
@ -449,6 +494,35 @@ __imlib_AddBlendRGBAToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_AddBlendRGBToRGBCmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
a = A_CMOD(cm, 0xff);
ADD_COLOR_WITH_ALPHA(a, R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
ADD_COLOR_WITH_ALPHA(a, G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
ADD_COLOR_WITH_ALPHA(a, B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
LOOP_END_WITH_INCREMENT
}
static void
__imlib_AddBlendRGBToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
SATURATE_UPPER(a, A_CMOD(cm, 0xff) + (255 - A_VAL(p2)));
ADD_COLOR_WITH_ALPHA(a, R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
ADD_COLOR_WITH_ALPHA(a, G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
ADD_COLOR_WITH_ALPHA(a, B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
SATURATE_UPPER(A_VAL(p2), A_CMOD(cm, A_VAL(p1)) + A_VAL(p2));
LOOP_END_WITH_INCREMENT
}
static void
__imlib_AddCopyRGBAToRGBCmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
@ -476,6 +550,20 @@ __imlib_AddCopyRGBAToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_AddCopyRGBToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
ADD_COLOR(R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
ADD_COLOR(G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
ADD_COLOR(B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
SATURATE_UPPER(A_VAL(p2), A_CMOD(cm, 0xff) + A_VAL(p2));
LOOP_END_WITH_INCREMENT
}
/* SUBTRACT OPS */
static void
@ -508,6 +596,36 @@ __imlib_SubBlendRGBAToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_SubBlendRGBToRGBCmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_2
a = A_CMOD(cm, 0xff);
SUB_COLOR_WITH_ALPHA(a, R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
SUB_COLOR_WITH_ALPHA(a, G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
SUB_COLOR_WITH_ALPHA(a, B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
LOOP_END_WITH_INCREMENT
}
static void
__imlib_SubBlendRGBToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
SATURATE_UPPER(a, A_CMOD(cm, 0xff) + (255 - A_VAL(p2)));
SUB_COLOR_WITH_ALPHA(a, R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
SUB_COLOR_WITH_ALPHA(a, G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
SUB_COLOR_WITH_ALPHA(a, B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
SATURATE_UPPER(A_VAL(p2), A_CMOD(cm, 0xff) + A_VAL(p2));
LOOP_END_WITH_INCREMENT
}
static void
__imlib_SubCopyRGBAToRGBCmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
@ -535,6 +653,20 @@ __imlib_SubCopyRGBAToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_SubCopyRGBToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
SUB_COLOR(R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
SUB_COLOR(G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
SUB_COLOR(B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
SATURATE_UPPER(A_VAL(p2), A_CMOD(cm, 0xff) + A_VAL(p2));
LOOP_END_WITH_INCREMENT
}
/* RESHADE OPS */
@ -568,6 +700,36 @@ __imlib_ReBlendRGBAToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_ReBlendRGBToRGBCmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_2
a = A_CMOD(cm, 0xff);
RESHADE_COLOR_WITH_ALPHA(a, R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
RESHADE_COLOR_WITH_ALPHA(a, G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
RESHADE_COLOR_WITH_ALPHA(a, B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
LOOP_END_WITH_INCREMENT
}
static void
__imlib_ReBlendRGBToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
SATURATE_UPPER(a, A_CMOD(cm, A_VAL(p1)) + (255 - A_VAL(p2)));
RESHADE_COLOR_WITH_ALPHA(a, R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
RESHADE_COLOR_WITH_ALPHA(a, G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
RESHADE_COLOR_WITH_ALPHA(a, B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
SATURATE_UPPER(A_VAL(p2), A_CMOD(cm, 0xff) + A_VAL(p2));
LOOP_END_WITH_INCREMENT
}
static void
__imlib_ReCopyRGBAToRGBCmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
@ -595,271 +757,169 @@ __imlib_ReCopyRGBAToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
LOOP_END_WITH_INCREMENT
}
static void
__imlib_ReCopyRGBToRGBACmod(DATA32 *src, int srcw, DATA32 *dst, int dstw,
int w, int h, ImlibColorModifier *cm)
{
LOOP_START_3
RESHADE_COLOR(R_VAL(p2), R_CMOD(cm, R_VAL(p1)), R_VAL(p2));
RESHADE_COLOR(G_VAL(p2), G_CMOD(cm, G_VAL(p1)), G_VAL(p2));
RESHADE_COLOR(B_VAL(p2), B_CMOD(cm, B_VAL(p1)), B_VAL(p2));
SATURATE_UPPER(A_VAL(p2), A_CMOD(cm, 0xff) + A_VAL(p2));
LOOP_END_WITH_INCREMENT
}
/*\ Equivalent functions \*/
#define __imlib_CopyRGBToRGB __imlib_CopyRGBToRGBA
#define __imlib_BlendRGBToRGB __imlib_CopyRGBToRGB
#define __imlib_BlendRGBToRGBA __imlib_CopyRGBToRGBA
#define __imlib_mmx_copy_rgb_to_rgb __imlib_mmx_copy_rgb_to_rgba
#define __imlib_mmx_blend_rgb_to_rgb __imlib_mmx_copy_rgb_to_rgb
#define __imlib_mmx_blend_rgb_to_rgba __imlib_mmx_copy_rgb_to_rgba
#define __imlib_CopyRGBToRGBCmod __imlib_CopyRGBAToRGBCmod
#define __imlib_mmx_copy_rgb_to_rgb_cmod __imlib_mmx_copy_rgba_to_rgb_cmod
#define __imlib_AddCopyRGBToRGB __imlib_AddCopyRGBAToRGB
#define __imlib_AddBlendRGBToRGB __imlib_AddCopyRGBToRGB
#define __imlib_AddBlendRGBToRGBA __imlib_AddCopyRGBToRGBA
#define __imlib_mmx_add_copy_rgb_to_rgb __imlib_mmx_add_copy_rgba_to_rgb
#define __imlib_mmx_add_blend_rgb_to_rgb __imlib_mmx_add_copy_rgb_to_rgb
#define __imlib_mmx_add_blend_rgb_to_rgba __imlib_mmx_add_copy_rgb_to_rgba
#define __imlib_AddCopyRGBToRGBCmod __imlib_AddCopyRGBAToRGBCmod
#define __imlib_mmx_add_copy_rgb_to_rgb_cmod __imlib_mmx_add_copy_rgb_to_rgba_cmod
#define __imlib_SubCopyRGBToRGB __imlib_SubCopyRGBAToRGB
#define __imlib_SubBlendRGBToRGB __imlib_SubCopyRGBToRGB
#define __imlib_SubBlendRGBToRGBA __imlib_SubCopyRGBToRGBA
#define __imlib_mmx_subtract_copy_rgb_to_rgba __imlib_mmx_subtract_copy_rgba_to_rgba
#define __imlib_mmx_subtract_copy_rgb_to_rgb __imlib_mmx_subtract_copy_rgba_to_rgb
#define __imlib_mmx_subtract_blend_rgb_to_rgb __imlib_mmx_subtract_copy_rgb_to_rgb
#define __imlib_mmx_subtract_blend_rgb_to_rgba __imlib_mmx_subtract_copy_rgb_to_rgba
#define __imlib_SubCopyRGBToRGBCmod __imlib_SubCopyRGBAToRGBCmod
#define __imlib_mmx_subtract_copy_rgb_to_rgb_cmod __imlib_mmx_subtract_copy_rgb_to_rgba_cmod
#define __imlib_ReCopyRGBToRGB __imlib_ReCopyRGBAToRGB
#define __imlib_ReBlendRGBToRGB __imlib_ReCopyRGBToRGB
#define __imlib_ReBlendRGBToRGBA __imlib_ReCopyRGBToRGBA
#define __imlib_mmx_reshade_copy_rgb_to_rgba __imlib_mmx_reshade_copy_rgba_to_rgba
#define __imlib_mmx_reshade_copy_rgb_to_rgb __imlib_mmx_reshade_copy_rgba_to_rgb
#define __imlib_mmx_reshade_blend_rgb_to_rgb __imlib_mmx_reshade_copy_rgb_to_rgb
#define __imlib_mmx_reshade_blend_rgb_to_rgba __imlib_mmx_reshade_copy_rgb_to_rgba
#define __imlib_ReCopyRGBToRGBCmod __imlib_ReCopyRGBAToRGBCmod
#define __imlib_mmx_reshade_copy_rgb_to_rgb_cmod __imlib_mmx_reshade_copy_rgb_to_rgba_cmod
ImlibBlendFunction
__imlib_GetBlendFunction(ImlibOp op, char blend, char merge_alpha, char rgb_src,
ImlibColorModifier * cm)
{
ImlibBlendFunction blender = NULL;
/*\ [ mmx ][ operation ][ cmod ][ merge_alpha ][ rgb_src ][ blend ] \*/
static ImlibBlendFunction ibfuncs[][4][2][2][2][2] = {
/*\ OP_COPY \*/
{{{{{ __imlib_CopyRGBAToRGB, __imlib_BlendRGBAToRGB },
{ __imlib_CopyRGBToRGB, __imlib_BlendRGBToRGB } },
{{ __imlib_CopyRGBAToRGBA, __imlib_BlendRGBAToRGBA },
{ __imlib_CopyRGBToRGBA, __imlib_BlendRGBToRGBA } } },
{{{ __imlib_CopyRGBAToRGBCmod, __imlib_BlendRGBAToRGBCmod },
{ __imlib_CopyRGBToRGBCmod, __imlib_BlendRGBToRGBCmod } },
{{ __imlib_CopyRGBAToRGBACmod, __imlib_BlendRGBAToRGBACmod },
{ __imlib_CopyRGBToRGBACmod, __imlib_BlendRGBToRGBACmod } } } },
/*\ OP_ADD \*/
{{{{ __imlib_AddCopyRGBAToRGB, __imlib_AddBlendRGBAToRGB },
{ __imlib_AddCopyRGBToRGB, __imlib_AddBlendRGBToRGB } },
{{ __imlib_AddCopyRGBAToRGBA, __imlib_AddBlendRGBAToRGBA },
{ __imlib_AddCopyRGBToRGBA, __imlib_AddBlendRGBToRGBA } } },
{{{ __imlib_AddCopyRGBAToRGBCmod, __imlib_AddBlendRGBAToRGBCmod },
{ __imlib_AddCopyRGBToRGBCmod, __imlib_AddBlendRGBToRGBCmod } },
{{ __imlib_AddCopyRGBAToRGBACmod, __imlib_AddBlendRGBAToRGBACmod },
{ __imlib_AddCopyRGBToRGBACmod, __imlib_AddBlendRGBToRGBACmod } } } },
/*\ OP_SUBTRACT \*/
{{{{ __imlib_SubCopyRGBAToRGB, __imlib_SubBlendRGBAToRGB },
{ __imlib_SubCopyRGBToRGB, __imlib_SubBlendRGBToRGB } },
{{ __imlib_SubCopyRGBAToRGBA, __imlib_SubBlendRGBAToRGBA },
{ __imlib_SubCopyRGBToRGBA, __imlib_SubBlendRGBToRGBA } } },
{{{ __imlib_SubCopyRGBAToRGBCmod, __imlib_SubBlendRGBAToRGBCmod },
{ __imlib_SubCopyRGBToRGBCmod, __imlib_SubBlendRGBToRGBCmod } },
{{ __imlib_SubCopyRGBAToRGBACmod, __imlib_SubBlendRGBAToRGBACmod },
{ __imlib_SubCopyRGBToRGBACmod, __imlib_SubBlendRGBToRGBACmod } } } },
/*\ OP_RESHADE \*/
{{{{ __imlib_ReCopyRGBAToRGB, __imlib_ReBlendRGBAToRGB },
{ __imlib_ReCopyRGBToRGB, __imlib_ReBlendRGBToRGB } },
{{ __imlib_ReCopyRGBAToRGBA, __imlib_ReBlendRGBAToRGBA },
{ __imlib_ReCopyRGBToRGBA, __imlib_ReBlendRGBToRGBA } } },
{{{ __imlib_ReCopyRGBAToRGBCmod, __imlib_ReBlendRGBAToRGBCmod },
{ __imlib_ReCopyRGBToRGBCmod, __imlib_ReBlendRGBToRGBCmod } },
{{ __imlib_ReCopyRGBAToRGBACmod, __imlib_ReBlendRGBAToRGBACmod },
{ __imlib_ReCopyRGBToRGBACmod, __imlib_ReBlendRGBToRGBACmod } } } } },
if (cm)
{
switch(op)
{
case OP_COPY:
if (merge_alpha)
{
if (rgb_src)
{
if (blend)
blender = __imlib_BlendRGBToRGBACmod;
else
blender = __imlib_CopyRGBAToRGBACmod;
}
else
{
if (blend)
blender = __imlib_BlendRGBAToRGBACmod;
else
blender = __imlib_CopyRGBAToRGBACmod;
}
}
else
{
if (blend)
blender = __imlib_BlendRGBAToRGBCmod;
else
blender = __imlib_CopyRGBAToRGBCmod;
}
break;
case OP_ADD:
if (merge_alpha)
{
if (blend)
blender = __imlib_AddBlendRGBAToRGBACmod;
else
blender = __imlib_AddCopyRGBAToRGBACmod;
}
else
{
if (blend)
blender = __imlib_AddBlendRGBAToRGBCmod;
else
blender = __imlib_AddCopyRGBAToRGBCmod;
}
break;
case OP_SUBTRACT:
if (merge_alpha)
{
if (blend)
blender = __imlib_SubBlendRGBAToRGBACmod;
else
blender = __imlib_SubCopyRGBAToRGBACmod;
}
else
{
if (blend)
blender = __imlib_SubBlendRGBAToRGBCmod;
else
blender = __imlib_SubCopyRGBAToRGBCmod;
}
break;
case OP_RESHADE:
if (merge_alpha)
{
if (blend)
blender = __imlib_ReBlendRGBAToRGBACmod;
else
blender = __imlib_ReCopyRGBAToRGBACmod;
}
else
{
if (blend)
blender = __imlib_ReBlendRGBAToRGBCmod;
else
blender = __imlib_ReCopyRGBAToRGBCmod;
}
break;
default:
break;
}
}
else
{
#ifdef DO_MMX_ASM
if (__imlib_get_cpuid() & CPUID_MMX)
{
switch(op)
{
case OP_COPY:
if (merge_alpha)
{
if (rgb_src)
{
blender = __imlib_mmx_copy_rgb_to_rgba;
}
else
{
if (blend)
blender = __imlib_mmx_blend_rgba_to_rgba;
else
blender = __imlib_mmx_copy_rgba_to_rgba;
}
}
else
{
if (blend)
blender = __imlib_mmx_blend_rgba_to_rgb;
else
blender = __imlib_mmx_copy_rgba_to_rgb;
}
break;
case OP_ADD:
if (merge_alpha)
{
if (blend)
blender = __imlib_mmx_add_blend_rgba_to_rgba;
else
blender = __imlib_mmx_add_copy_rgba_to_rgba;
}
else
{
if (blend)
blender = __imlib_mmx_add_blend_rgba_to_rgb;
else
blender = __imlib_mmx_add_copy_rgba_to_rgb;
}
break;
case OP_SUBTRACT:
if (merge_alpha)
{
if (blend)
blender = __imlib_mmx_subtract_blend_rgba_to_rgba;
else
blender = __imlib_mmx_subtract_copy_rgba_to_rgba;
}
else
{
if (blend)
blender = __imlib_mmx_subtract_blend_rgba_to_rgb;
else
blender = __imlib_mmx_subtract_copy_rgba_to_rgb;
}
break;
case OP_RESHADE:
if (merge_alpha)
{
if (blend)
blender = __imlib_mmx_reshade_blend_rgba_to_rgba;
else
blender = __imlib_mmx_reshade_copy_rgba_to_rgba;
}
else
{
if (blend)
blender = __imlib_mmx_reshade_blend_rgba_to_rgb;
else
blender = __imlib_mmx_reshade_copy_rgba_to_rgb;
}
break;
default:
break;
}
}
else
#endif
{
switch(op)
{
case OP_COPY:
if (merge_alpha)
{
if (rgb_src)
{
if (blend)
{
blender = __imlib_BlendRGBToRGBA;
}
else
blender = __imlib_CopyRGBAToRGBA;
}
else
{
if (blend)
blender = __imlib_BlendRGBAToRGBA;
else
blender = __imlib_CopyRGBAToRGBA;
}
}
else
{
if (blend)
blender = __imlib_BlendRGBAToRGB;
else
blender = __imlib_CopyRGBAToRGB;
}
break;
case OP_ADD:
if (merge_alpha)
{
if (blend)
blender = __imlib_AddBlendRGBAToRGBA;
else
blender = __imlib_AddCopyRGBAToRGBA;
}
else
{
if (blend)
blender = __imlib_AddBlendRGBAToRGB;
else
blender = __imlib_AddCopyRGBAToRGB;
}
break;
case OP_SUBTRACT:
if (merge_alpha)
{
if (blend)
blender = __imlib_SubBlendRGBAToRGBA;
else
blender = __imlib_SubCopyRGBAToRGBA;
}
else
{
if (blend)
blender = __imlib_SubBlendRGBAToRGB;
else
blender = __imlib_SubCopyRGBAToRGB;
}
break;
case OP_RESHADE:
if (merge_alpha)
{
if (blend)
blender = __imlib_ReBlendRGBAToRGBA;
else
blender = __imlib_ReCopyRGBAToRGBA;
}
else
{
if (blend)
blender = __imlib_ReBlendRGBAToRGB;
else
blender = __imlib_ReCopyRGBAToRGB;
}
break;
default:
break;
}
}
}
/*\ OP_COPY \*/
{{{{{ __imlib_mmx_copy_rgba_to_rgb, __imlib_mmx_blend_rgba_to_rgb },
{ __imlib_mmx_copy_rgb_to_rgb, __imlib_mmx_blend_rgb_to_rgb } },
{{ __imlib_mmx_copy_rgba_to_rgba, __imlib_mmx_blend_rgba_to_rgba },
{ __imlib_mmx_copy_rgb_to_rgba, __imlib_mmx_blend_rgb_to_rgba } } },
return blender;
{{{ __imlib_mmx_copy_rgba_to_rgb_cmod, __imlib_mmx_blend_rgba_to_rgb_cmod },
{ __imlib_mmx_copy_rgb_to_rgb_cmod, __imlib_mmx_blend_rgb_to_rgb_cmod } },
{{ __imlib_mmx_copy_rgba_to_rgba_cmod, __imlib_mmx_blend_rgba_to_rgba_cmod },
{ __imlib_mmx_copy_rgb_to_rgba_cmod, __imlib_mmx_blend_rgb_to_rgba_cmod } } } },
/*\ OP_ADD \*/
{{{{ __imlib_mmx_add_copy_rgba_to_rgb, __imlib_mmx_add_blend_rgba_to_rgb },
{ __imlib_mmx_add_copy_rgb_to_rgb, __imlib_mmx_add_blend_rgb_to_rgb } },
{{ __imlib_mmx_add_copy_rgba_to_rgba, __imlib_mmx_add_blend_rgba_to_rgba },
{ __imlib_mmx_add_copy_rgb_to_rgba, __imlib_mmx_add_blend_rgb_to_rgba } } },
{{{ __imlib_mmx_add_copy_rgba_to_rgb_cmod, __imlib_mmx_add_blend_rgba_to_rgb_cmod },
{ __imlib_mmx_add_copy_rgb_to_rgb_cmod, __imlib_mmx_add_blend_rgb_to_rgb_cmod } },
{{ __imlib_mmx_add_copy_rgba_to_rgba_cmod, __imlib_mmx_add_blend_rgba_to_rgba_cmod },
{ __imlib_mmx_add_copy_rgb_to_rgba_cmod, __imlib_mmx_add_blend_rgb_to_rgba_cmod } } } },
/*\ OP_SUBTRACT \*/
{{{{ __imlib_mmx_subtract_copy_rgba_to_rgb, __imlib_mmx_subtract_blend_rgba_to_rgb },
{ __imlib_mmx_subtract_copy_rgb_to_rgb, __imlib_mmx_subtract_blend_rgb_to_rgb } },
{{ __imlib_mmx_subtract_copy_rgba_to_rgba, __imlib_mmx_subtract_blend_rgba_to_rgba },
{ __imlib_mmx_subtract_copy_rgb_to_rgba, __imlib_mmx_subtract_blend_rgb_to_rgba } } },
{{{ __imlib_mmx_subtract_copy_rgba_to_rgb_cmod, __imlib_mmx_subtract_blend_rgba_to_rgb_cmod },
{ __imlib_mmx_subtract_copy_rgb_to_rgb_cmod, __imlib_mmx_subtract_blend_rgb_to_rgb_cmod } },
{{ __imlib_mmx_subtract_copy_rgba_to_rgba_cmod, __imlib_mmx_subtract_blend_rgba_to_rgba_cmod },
{ __imlib_mmx_subtract_copy_rgb_to_rgba_cmod, __imlib_mmx_subtract_blend_rgb_to_rgba_cmod } } } },
/*\ OP_RESHADE \*/
{{{{ __imlib_mmx_reshade_copy_rgba_to_rgb, __imlib_mmx_reshade_blend_rgba_to_rgb },
{ __imlib_mmx_reshade_copy_rgb_to_rgb, __imlib_mmx_reshade_blend_rgb_to_rgb } },
{{ __imlib_mmx_reshade_copy_rgba_to_rgba, __imlib_mmx_reshade_blend_rgba_to_rgba },
{ __imlib_mmx_reshade_copy_rgb_to_rgba, __imlib_mmx_reshade_blend_rgb_to_rgba } } },
{{{ __imlib_mmx_reshade_copy_rgba_to_rgb_cmod, __imlib_mmx_reshade_blend_rgba_to_rgb_cmod },
{ __imlib_mmx_reshade_copy_rgb_to_rgb_cmod, __imlib_mmx_reshade_blend_rgb_to_rgb_cmod } },
{{ __imlib_mmx_reshade_copy_rgba_to_rgba_cmod, __imlib_mmx_reshade_blend_rgba_to_rgba_cmod },
{ __imlib_mmx_reshade_copy_rgb_to_rgba_cmod, __imlib_mmx_reshade_blend_rgb_to_rgba_cmod } } } } },
#endif
};
int opi = (op == OP_COPY) ? 0
: (op == OP_ADD) ? 1
: (op == OP_SUBTRACT) ? 2
: (op == OP_RESHADE) ? 3 : -1;
int do_mmx = 0;
if (opi == -1) return NULL;
#ifdef DO_MMX_ASM
do_mmx = !!(__imlib_get_cpuid() & CPUID_MMX);
#endif
if (cm && rgb_src && (A_CMOD(cm, 0xff) == 0xff))
blend = 0;
return ibfuncs[!!do_mmx][opi][!!cm][!!merge_alpha][!!rgb_src][!!blend];
}
void
@ -948,8 +1008,6 @@ __imlib_BlendImageToImage(ImlibImage *im_src, ImlibImage *im_dst,
rgb_src = 1;
if (merge_alpha)
blend = 1;
else
blend = 0;
}
__imlib_BlendRGBAToData(im_src->data, im_src->w, im_src->h,
@ -1047,8 +1105,6 @@ __imlib_BlendImageToImage(ImlibImage *im_src, ImlibImage *im_dst,
rgb_src = 1;
if (merge_alpha)
blend = 1;
else
blend = 0;
}
__imlib_BlendRGBAToData(im_src->data, im_src->w, im_src->h,
im_dst->data, im_dst->w, im_dst->h,
@ -1074,8 +1130,6 @@ __imlib_BlendImageToImage(ImlibImage *im_src, ImlibImage *im_dst,
rgb_src = 1;
if (merge_alpha)
blend = 1;
else
blend = 0;
}
/* scale in LINESIZE Y chunks and convert to depth*/
#ifdef DO_MMX_ASM

View File

@ -373,6 +373,9 @@ void
__imlib_mmx_add_copy_rgba_to_rgba(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_add_copy_rgb_to_rgba(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_blend_rgba_to_rgb(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
@ -385,6 +388,9 @@ void
__imlib_mmx_subtract_copy_rgba_to_rgba(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_copy_rgb_to_rgba(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_blend_rgba_to_rgb(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
@ -396,5 +402,94 @@ __imlib_mmx_reshade_copy_rgba_to_rgb(DATA32 *src, int sw, DATA32 *dst,
void
__imlib_mmx_reshade_copy_rgba_to_rgba(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_copy_rgb_to_rgba(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_blend_rgba_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_blend_rgba_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_blend_rgb_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_blend_rgb_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_copy_rgba_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_copy_rgba_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_copy_rgb_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_add_blend_rgba_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_add_blend_rgba_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_add_blend_rgb_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_add_blend_rgb_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_add_copy_rgba_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_add_copy_rgba_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_add_copy_rgb_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_blend_rgba_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_blend_rgba_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_blend_rgb_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_blend_rgb_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_copy_rgba_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_copy_rgba_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_subtract_copy_rgb_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_blend_rgba_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_blend_rgba_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_blend_rgb_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_blend_rgb_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_copy_rgba_to_rgb_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_copy_rgba_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
void
__imlib_mmx_reshade_copy_rgb_to_rgba_cmod(DATA32 *src, int sw, DATA32 *dst,
int dw, int w, int h, ImlibColorModifier *cm);
#endif
#endif

View File

@ -89,9 +89,9 @@ __imlib_DataCmodApply(DATA32 *data, int w, int h, int jump,
for (x = 0; x < w; x++)
{
R_VAL(p) = R_CMOD(cm, R_VAL(p));
G_VAL(p) = R_CMOD(cm, G_VAL(p));
B_VAL(p) = R_CMOD(cm, B_VAL(p));
A_VAL(p) = R_CMOD(cm, A_VAL(p));
G_VAL(p) = G_CMOD(cm, G_VAL(p));
B_VAL(p) = B_CMOD(cm, B_VAL(p));
A_VAL(p) = A_CMOD(cm, A_VAL(p));
p++;
}
p += jump;

View File

@ -27,7 +27,7 @@ Colormap cm;
int depth;
void progress(Imlib_Image *im, char percent, int update_x, int update_y,
int update_w, int update_h);
int update_w, int update_h);
void
progress(Imlib_Image *im, char percent,
@ -76,113 +76,136 @@ int main (int argc, char **argv)
int scaleup = 0;
int scaleboth = 0;
int origone = 0;
Imlib_Color_Modifier colormod = 0;
/**
* Parse all the command line arguments
*/
if ((argc > 1) && (!strcmp(argv[1], "-help"))
if ((argc > 1) && (!strcmp(argv[1], "-help")))
{
printf ("Imlib2 program test. (Imlib v2.0.0.4)\n");
printf ("usage: imlib2 [options] [file]\n");
printf ("options are:\n");
printf ("-help\t\tDisplays this help.\n");
printf ("-root\t\tDraw in the root window.\n");
printf ("-smooth\t\tWhen scaling images scale with anti-aliasing.\n");
printf ("-up\t\tWhen doing scal test scale up, not down.\n");
printf ("-both\t\tScale horizontally AND vertically in scale test.\n");
printf ("-orig\t\tKeep original width and height in each pass of scale test.\n");
printf ("-blend\t\tBlending test.\n");
printf ("-dither\t\tTurn dithering on for depths < 24bpp\n");
printf ("-scale\t\tScale test.\n");
printf ("-noloop\t\tDont loop - timing test.\n");
printf ("-rotate\t\tAlso rotate background image with mouse in interative test.\n");
printf ("-size <w> <h>\t\tScale from w x h down in scaling test.\n"); // require parameters w / h
printf ("-maxcolors <n>\t\tLimit color allocation count to n colors.\n"); // require parameter nb colors
printf ("-text\t\tDisplays the text following this option. Need a loaded font.\n");
printf ("-font\t\tLoads a font. The parameter must follow the police_name/size format. Example: loading the grunge font at size 18 is : grunge/18.");
printf ("The following options requires a file to work properly.\n");
printf ("-blast\t\tDisplays the file.\n");
printf ("-loop\t\tScales down the image.\n");
printf ("-blendtest\tPerforms a blending test on the file.\n");
printf ("-rotatetest\tPerforms a rotate test on the file.\n");
printf ("-filter\t\tPerforms filtering. Possible filters are,\n\t\t\t1:Blur filter, 2:Sharpen filter, 3:Color blur filter, \n\t\t\t4:Emboss filter, 5:Grayscale filter, 6:Saturation filter,\n\t\t\t7:Edge detection filter.\n");
return 0;
printf ("Imlib2 program test. (Imlib v2.0.0.4)\n");
printf ("usage: imlib2 [options] [file]\n");
printf ("options are:\n");
printf ("-help\t\tDisplays this help.\n");
printf ("-root\t\tDraw in the root window.\n");
printf ("-smooth\t\tWhen scaling images scale with anti-aliasing.\n");
printf ("-up\t\tWhen doing scal test scale up, not down.\n");
printf ("-both\t\tScale horizontally AND vertically in scale test.\n");
printf ("-orig\t\tKeep original width and height in each pass of scale test.\n");
printf ("-blend\t\tBlending test.\n");
printf ("-dither\t\tTurn dithering on for depths < 24bpp\n");
printf ("-colormod <r> <g> <b> <a>\t\tSet up color mod tables\n");
printf ("-scale\t\tScale test.\n");
printf ("-noloop\t\tDont loop - timing test.\n");
printf ("-rotate\t\tAlso rotate background image with mouse in interative test.\n");
printf ("-size <w> <h>\t\tScale from w x h down in scaling test.\n"); // require parameters w / h
printf ("-maxcolors <n>\t\tLimit color allocation count to n colors.\n"); // require parameter nb colors
printf ("-text\t\tDisplays the text following this option. Need a loaded font.\n");
printf ("-font\t\tLoads a font. The parameter must follow the police_name/size format. Example: loading the grunge font at size 18 is : grunge/18.");
printf ("The following options requires a file to work properly.\n");
printf ("-blast\t\tDisplays the file.\n");
printf ("-loop\t\tScales down the image.\n");
printf ("-blendtest\tPerforms a blending test on the file.\n");
printf ("-rotatetest\tPerforms a rotate test on the file.\n");
printf ("-filter\t\tPerforms filtering. Possible filters are,\n\t\t\t1:Blur filter, 2:Sharpen filter, 3:Color blur filter, \n\t\t\t4:Emboss filter, 5:Grayscale filter, 6:Saturation filter,\n\t\t\t7:Edge detection filter.\n");
return 0;
}
for (i = 1; i < argc; i++)
{
if (!strcmp(argv[i], "-root"))
root = 1;
else if (!strcmp(argv[i], "-smooth"))
aa = 1;
else if (!strcmp(argv[i], "-blast"))
interactive = 0;
else if (!strcmp(argv[i], "-loop"))
{
if (!strcmp(argv[i], "-root"))
root = 1;
else if (!strcmp(argv[i], "-smooth"))
aa = 1;
else if (!strcmp(argv[i], "-blast"))
interactive = 0;
loop = 1;
}
else if (!strcmp(argv[i], "-up"))
scaleup = 1;
else if (!strcmp(argv[i], "-both"))
scaleboth = 1;
else if (!strcmp(argv[i], "-orig"))
else if (!strcmp(argv[i], "-loop"))
{
interactive = 0;
loop = 1;
}
else if (!strcmp(argv[i], "-up"))
scaleup = 1;
else if (!strcmp(argv[i], "-both"))
scaleboth = 1;
else if (!strcmp(argv[i], "-orig"))
origone = 1;
else if (!strcmp(argv[i], "-blend"))
blend = 1;
else if (!strcmp(argv[i], "-blendtest"))
{
blendtest = 1;
interactive = 0;
}
else if (!strcmp(argv[i], "-dither"))
dith = 1;
else if (!strcmp(argv[i], "-scale"))
scale = 1;
else if (!strcmp(argv[i], "-noloop"))
loop = 0;
else if (!strcmp(argv[i], "-size"))
{
i++;
w = atoi(argv[i++]);
h = atoi(argv[i]);
}
else if (!strcmp(argv[i], "-maxcolors"))
{
i++;
imlib_set_color_usage(atoi(argv[i]));
blend = 1;
else if (!strcmp(argv[i], "-blendtest"))
{
blendtest = 1;
interactive = 0;
}
else if (!strcmp(argv[i], "-font"))
{
i++;
fon = argv[i];
}
else if (!strcmp(argv[i], "-text"))
{
i++;
str = argv[i];
}
else if (!strcmp(argv[i], "-rotate"))
rotate = 1;
else if (!strcmp(argv[i], "-filter"))
{
filter = atoi(argv[++i]);
interactive = 0;
}
else if (!strcmp(argv[i], "-rotatetest"))
{
rottest = 1;
interactive = 0;
}
else
file = argv[i];
else if (!strcmp(argv[i], "-colormod"))
{
DATA8 rt[256], gt[256], bt[256], at[256];
double rm, gm, bm, am;
int j;
/*\ Setup color mod tables \*/
if (!colormod) colormod = imlib_create_color_modifier();
imlib_context_set_color_modifier(colormod);
rm = strtod(argv[++i], 0);
gm = strtod(argv[++i], 0);
bm = strtod(argv[++i], 0);
am = strtod(argv[++i], 0);
imlib_get_color_modifier_tables(rt, gt, bt, at);
for (j = 0x100; --j >= 0; ) {
rt[j] = ((double)rt[j]) * rm;
gt[j] = ((double)gt[j]) * gm;
bt[j] = ((double)bt[j]) * bm;
at[j] = ((double)at[j]) * am;
}
imlib_set_color_modifier_tables(rt, gt, bt, at);
}
else if (!strcmp(argv[i], "-dither"))
dith = 1;
else if (!strcmp(argv[i], "-scale"))
scale = 1;
else if (!strcmp(argv[i], "-noloop"))
loop = 0;
else if (!strcmp(argv[i], "-size"))
{
i++;
w = atoi(argv[i++]);
h = atoi(argv[i]);
}
else if (!strcmp(argv[i], "-maxcolors"))
{
i++;
imlib_set_color_usage(atoi(argv[i]));
}
else if (!strcmp(argv[i], "-font"))
{
i++;
fon = argv[i];
}
else if (!strcmp(argv[i], "-text"))
{
i++;
str = argv[i];
}
else if (!strcmp(argv[i], "-rotate"))
rotate = 1;
else if (!strcmp(argv[i], "-filter"))
{
filter = atoi(argv[++i]);
interactive = 0;
}
else if (!strcmp(argv[i], "-rotatetest"))
{
rottest = 1;
interactive = 0;
}
else
file = argv[i];
}
/**
* Initialization according to options
*/
printf("init\n");
/**
* First tests to determine which rendering task to perform
*/
@ -204,7 +227,7 @@ int main (int argc, char **argv)
ButtonMotionMask | PointerMotionMask | ExposureMask);
}
}
if (!interactive)
{
printf("load %s\n", file);
@ -219,7 +242,7 @@ int main (int argc, char **argv)
h = imlib_image_get_height();
printf("image %i x %i\n", w, h);
}
if (!blendtest)
{
if (!root)
@ -241,13 +264,13 @@ int main (int argc, char **argv)
}
XSync(disp, False);
}
/**
* Start rendering
*/
printf("rend\n");
if (!blendtest)
{
imlib_context_set_display(disp);
@ -269,7 +292,7 @@ int main (int argc, char **argv)
if (loop)
{
printf("loop\n");
// first test
if (scaleup)
{
@ -305,7 +328,7 @@ int main (int argc, char **argv)
pixels += (w + i) * (((w + i) * h) / w);
}
}
// else if // second
else if (scaleboth)
{
@ -318,7 +341,7 @@ int main (int argc, char **argv)
Imlib_Image im_tmp;
im_tmp = imlib_create_cropped_scaled_image(0, 0, w, h,
w, (((i) * h) / w));
w, (((i) * h) / w));
if (im_tmp)
{
imlib_context_set_image(im_tmp);
@ -387,7 +410,7 @@ int main (int argc, char **argv)
}
else
{
printf("scale down 0 -> %i incriment by 1\n", w);
printf("scale down 0 -> %i incriment by 1\n", w);
for (i = 0; i < w; i++)
{
if (!blendtest)
@ -409,40 +432,41 @@ int main (int argc, char **argv)
}
}
}
// last test
/* else if (scaleboth)
// last test
/* else if (scaleboth)
{
for (i = 0; i < w * 2; i+= 1)
{
for (i = 0; i < w * 2; i+= 1)
if (!blendtest)
imlib_render_image_on_drawable_at_size(0, 0,
2 * w - i, (((i) * h) / w));
else
{
if (!blendtest)
imlib_render_image_on_drawable_at_size(0, 0,
2 * w - i, (((i) * h) / w));
else
Imlib_Image im_tmp;
im_tmp = imlib_create_cropped_scaled_image(0, 0, w, h,
2 * w - i, (((i) * h) / w));
if (im_tmp)
{
Imlib_Image im_tmp;
im_tmp = imlib_create_cropped_scaled_image(0, 0, w, h,
2 * w - i, (((i) * h) / w));
if (im_tmp)
{
imlib_context_set_image(im_tmp);
imlib_free_image();
}
imlib_context_set_image(im);
imlib_context_set_image(im_tmp);
imlib_free_image();
}
pixels += (2 * w - i) * (((i) * h) / w);
imlib_context_set_image(im);
}
pixels += (2 * w - i) * (((i) * h) / w);
}
} */// end if loop
}
} */// end if loop
else if (blendtest)
{
Imlib_Image im2;
im2 = imlib_create_image(w, h);
imlib_context_set_image(im2);
w = imlib_image_get_width();
h = imlib_image_get_height();
imlib_context_set_image(im2);
imlib_context_set_color_modifier(colormod);
for (i = 0; i < 256; i++)
{
imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
@ -451,7 +475,8 @@ int main (int argc, char **argv)
}
else if (rottest)
{
int w, h, i;
int w, h;
double i;
imlib_context_set_image(im);
imlib_render_image_on_drawable(0, 0);
@ -462,31 +487,49 @@ int main (int argc, char **argv)
imlib_context_set_blend(1);
imlib_context_set_image(imlib_create_image(w, h));
for (i = h; (i -= 10) >= 0; ) {
for (i = 0; i < 1; i += 0.01) {
imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
imlib_context_set_color_modifier(colormod);
imlib_blend_image_onto_image_at_angle(im, 0, 0, 0, w, h,
0, h - i, w, i);
0, h * i,
w * (1 - i), -(h * i));
imlib_context_set_color_modifier(NULL);
imlib_render_image_on_drawable(0, 0);
pixels += w * h;
}
for (i = w; (i -= 10) >= 0; ) {
for (i = 0; i < 1; i += 0.01) {
imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
imlib_context_set_color_modifier(colormod);
imlib_context_set_operation(IMLIB_OP_ADD);
imlib_blend_image_onto_image_at_angle(im, 0, 0, 0, w, h,
w - i, h, i, 0);
w * i, h,
-(w * i), h * (i - 1));
imlib_context_set_operation(IMLIB_OP_COPY);
imlib_context_set_color_modifier(NULL);
imlib_render_image_on_drawable(0, 0);
pixels += w * h;
}
for (i = h; (i -= 10) >= 0; ) {
for (i = 0; i < 1; i += 0.01) {
imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
imlib_context_set_color_modifier(colormod);
imlib_context_set_operation(IMLIB_OP_SUBTRACT);
imlib_blend_image_onto_image_at_angle(im, 0, 0, 0, w, h,
w, i, 0, h - i);
w, h * (1 - i),
w * (i - 1), h * i);
imlib_context_set_operation(IMLIB_OP_COPY);
imlib_context_set_color_modifier(NULL);
imlib_render_image_on_drawable(0, 0);
pixels += w * h;
}
for (i = w; (i -= 10) >= 0; ) {
for (i = 0; i < 1; i += 0.01) {
imlib_blend_image_onto_image(im, 0, 0, 0, w, h, 0, 0, w, h);
imlib_context_set_color_modifier(colormod);
imlib_context_set_operation(IMLIB_OP_RESHADE);
imlib_blend_image_onto_image_at_angle(im, 0, 0, 0, w, h,
i, 0, w - i, h);
w * (1 - i), 0,
w * i, h * (1 - i));
imlib_context_set_operation(IMLIB_OP_COPY);
imlib_context_set_color_modifier(NULL);
imlib_render_image_on_drawable(0, 0);
pixels += w * h;
}
@ -536,7 +579,7 @@ int main (int argc, char **argv)
imlib_filter_set_green( 0, 0, 0, 1, 1, 1);
imlib_filter_set_blue (-1, -1, 0, -1, -1, -1);
imlib_filter_set_blue ( 0, 0, 0, 1, 1, 1);
imlib_filter_constants(0, 768, 768, 768);
imlib_filter_divisors (0, 6, 6, 6);
break;
@ -630,8 +673,8 @@ int main (int argc, char **argv)
{
case Expose:
up = imlib_update_append_rect(up,
ev.xexpose.x, ev.xexpose.y,
ev.xexpose.width, ev.xexpose.height);
ev.xexpose.x, ev.xexpose.y,
ev.xexpose.width, ev.xexpose.height);
break;
case ButtonRelease:
exit(0);
@ -662,7 +705,7 @@ int main (int argc, char **argv)
im_ic[10] = imlib_load_image("test_images/tnt.png");
im_ic[11] = imlib_load_image("test_images/bulb.png");
im_ic[12] = imlib_load_image("test_images/lock.png");
imlib_context_set_image(im);
if (first)
{
@ -731,7 +774,7 @@ int main (int argc, char **argv)
if (fon)
{
int retw, reth, ty, nx, ny, cx, cy, cw, ch, cp;
if (!str)
str = "This is a test string";
ty = 50;
@ -739,7 +782,7 @@ int main (int argc, char **argv)
{
int al;
double an = (double)i / 10.0;
imlib_context_set_direction(IMLIB_TEXT_TO_ANGLE);
imlib_context_set_angle(an);
@ -821,19 +864,20 @@ int main (int argc, char **argv)
imlib_context_set_image(im_ic[1]);imlib_free_image();
imlib_context_set_image(im_ic[2]);imlib_free_image();
imlib_context_set_image(im_ic[3]);imlib_free_image();
}
}
else
{
pixels = 0;
imlib_context_set_color_modifier(colormod);
for (i = 0; i < w; i++)
{
imlib_render_image_on_drawable_at_size(0, 0, w, h);
pixels += w * h;
}
}
/**
* Determine horse power of your video card driver
*/