Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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
Eli Gottlieb committed Jul 19, 2010
1 parent a2ad75b commit 558f9f8
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 282 deletions.
9 changes: 6 additions & 3 deletions src/video/SDL_shape.c
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions test/Makefile.in
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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@

Expand Down
2 changes: 1 addition & 1 deletion test/README
Expand Up @@ -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
Expand All @@ -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
Expand Down
232 changes: 0 additions & 232 deletions test/testeyes.c

This file was deleted.

21 changes: 0 additions & 21 deletions test/testeyes_bitmap.h

This file was deleted.

21 changes: 0 additions & 21 deletions test/testeyes_mask_bitmap.h

This file was deleted.

0 comments on commit 558f9f8

Please sign in to comment.