Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Rewrote test program for shaped windows. It definitely displays recog…

…nizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
  • Loading branch information
esennesh committed Jul 19, 2010
1 parent a2ad75b commit 558f9f895f9143845f75616eaa86bafe3e16860d
Showing with 179 additions and 282 deletions.
  1. +6 −3 src/video/SDL_shape.c
  2. +4 −4 test/Makefile.in
  3. +1 −1 test/README
  4. +0 −232 test/testeyes.c
  5. +0 −21 test/testeyes_bitmap.h
  6. +0 −21 test/testeyes_mask_bitmap.h
  7. +168 −0 test/testshape.c
@@ -63,14 +63,17 @@ void SDL_CalculateShapeBitmap(Uint8 alphacutoff,SDL_Surface *shape,Uint8* bitmap
Uint32 bitmap_pixel;
if(SDL_MUSTLOCK(shape))
SDL_LockSurface(shape);
for(x = 0;x<shape->w;x++)
for(y = 0;y<shape->h;y++) {
pixel = (Uint8 *)(shape->pixels) + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
pixel = (Uint8*)shape->pixels;
for(y = 0;y<shape->h;y++) {
pixel = (Uint8 *)(shape->pixels) + y * shape->pitch;
for(x=0;x<shape->w;x++) {
alpha = 0;
SDL_GetRGBA(*(Uint32*)pixel,shape->format,&r,&g,&b,&alpha);
bitmap_pixel = y*shape->w + x;
bitmap[bitmap_pixel / ppb] |= (alpha >= alphacutoff ? value : 0) << ((ppb - 1) - (bitmap_pixel % ppb));
pixel += shape->format->BytesPerPixel;
}
}
if(SDL_MUSTLOCK(shape))
SDL_UnlockSurface(shape);
}
@@ -7,7 +7,7 @@ EXE = @EXE@
CFLAGS = @CFLAGS@
LIBS = @LIBS@

TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testalpha$(EXE) testatomic$(EXE) testaudioinfo$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcursor$(EXE) testdraw2$(EXE) testdyngles$(EXE) testdyngl$(EXE) testerror$(EXE) testeyes$(EXE) testfile$(EXE) testfill$(EXE) testgamma$(EXE) testgl2$(EXE) testgles$(EXE) testgl$(EXE) testhaptic$(EXE) testhread$(EXE) testiconv$(EXE) testime$(EXE) testintersections$(EXE) testjoystick$(EXE) testkeys$(EXE) testloadso$(EXE) testlock$(EXE) testmmousetablet$(EXE) testmultiaudio$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testpower$(EXE) testresample$(EXE) testsem$(EXE) testsprite2$(EXE) testsprite$(EXE) testspriteminimal$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm2$(EXE) testwm$(EXE) threadwin$(EXE) torturethread$(EXE)
TARGETS = checkkeys$(EXE) graywin$(EXE) loopwave$(EXE) testalpha$(EXE) testatomic$(EXE) testaudioinfo$(EXE) testbitmap$(EXE) testblitspeed$(EXE) testcursor$(EXE) testdraw2$(EXE) testdyngles$(EXE) testdyngl$(EXE) testerror$(EXE) testfile$(EXE) testfill$(EXE) testgamma$(EXE) testgl2$(EXE) testgles$(EXE) testgl$(EXE) testhaptic$(EXE) testhread$(EXE) testiconv$(EXE) testime$(EXE) testintersections$(EXE) testjoystick$(EXE) testkeys$(EXE) testloadso$(EXE) testlock$(EXE) testmmousetablet$(EXE) testmultiaudio$(EXE) testoverlay2$(EXE) testoverlay$(EXE) testpalette$(EXE) testplatform$(EXE) testpower$(EXE) testresample$(EXE) testsem$(EXE) testshape$(EXE) testsprite2$(EXE) testsprite$(EXE) testspriteminimal$(EXE) testtimer$(EXE) testver$(EXE) testvidinfo$(EXE) testwin$(EXE) testwm2$(EXE) testwm$(EXE) threadwin$(EXE) torturethread$(EXE)

all: Makefile $(TARGETS)

@@ -62,9 +62,6 @@ testdyngles$(EXE): $(srcdir)/testdyngles.c
testerror$(EXE): $(srcdir)/testerror.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS)

testeyes$(EXE): $(srcdir)/testeyes.c
$(CC) -o $@ $? -std=c99 $(CFLAGS) $(LIBS)

testfile$(EXE): $(srcdir)/testfile.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS)

@@ -113,6 +110,9 @@ testplatform$(EXE): $(srcdir)/testplatform.c
testsem$(EXE): $(srcdir)/testsem.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS)

testshape$(EXE): $(srcdir)/testshape.c
$(CC) -o $@ $? -std=c99 $(CFLAGS) $(LIBS)

testspriteminimal$(EXE): $(srcdir)/testspriteminimal.c
$(CC) -o $@ $? $(CFLAGS) $(LIBS) @MATHLIB@

@@ -12,7 +12,6 @@ These are test programs for the SDL library:
testcursor Tests custom mouse cursor
testdyngl Tests dynamically loading OpenGL library
testerror Tests multi-threaded error handling
testeyes Tests shaped windows
testfile Tests RWops layer
testgamma Tests video device gamma ramp
testgl A very simple example of using OpenGL with SDL
@@ -29,6 +28,7 @@ These are test programs for the SDL library:
testpalette Tests palette color cycling
testplatform Tests types, endianness and cpu capabilities
testsem Tests SDL's semaphore implementation
testshape Tests shaped windows
testsprite Example of fast sprite movement on the screen
testsprite2 Improved version of testsprite
testtimer Test the timer facilities

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 558f9f8

Please sign in to comment.