annotate test/testshape.c @ 4802:f14a8c05f5bb

Minor bugfixes. testshape now draws a shaped window with bizarre, pixellated gashes of transparency across it, and in doing so seems to hog a system resource and slow the rest of the video system down.
author Eli Gottlieb <eligottlieb@gmail.com>
date Sun, 18 Jul 2010 23:05:40 -0400
parents 6d4be626225f
children a4c1df880690
rev   line source
4799
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
1 #include <stdlib.h>
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
2 #include <math.h>
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
3 #include <SDL_events.h>
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
4 #include <SDL_rect.h>
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
5 #include <SDL_pixels.h>
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
6 #include <SDL_video.h>
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
7 #include <SDL_shape.h>
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
8
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
9 #define SHAPED_WINDOW_X 150
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
10 #define SHAPED_WINDOW_Y 150
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
11 #define SHAPED_WINDOW_DIMENSION 640
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
12
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
13 int main(int argc,char** argv) {
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
14 if(argc < 2) {
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
15 printf("SDL_Shape requires at least one bitmap file as argument.\n");
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
16 exit(-1);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
17 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
18
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
19 if(SDL_VideoInit(NULL,0) == -1) {
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
20 printf("Could not initialize SDL video.\n");
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
21 exit(-2);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
22 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
23
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
24 Uint8 num_pictures = argc - 1;
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
25 SDL_Surface **pictures = malloc(sizeof(SDL_Surface*)*num_pictures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
26 int i = 0;
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
27 for(i=0;i<num_pictures;i++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
28 pictures[i] = NULL;
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
29 for(i=0;i<num_pictures;i++) {
4802
f14a8c05f5bb Minor bugfixes. testshape now draws a shaped window with bizarre, pixellated gashes of transparency across it, and in doing so seems to hog a system resource and slow the rest of the video system down.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4800
diff changeset
30 pictures[i] = SDL_LoadBMP(argv[i+1]);
f14a8c05f5bb Minor bugfixes. testshape now draws a shaped window with bizarre, pixellated gashes of transparency across it, and in doing so seems to hog a system resource and slow the rest of the video system down.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4800
diff changeset
31 if(pictures[i] == NULL) {
4799
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
32 int j = 0;
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
33 for(j=0;j<num_pictures;j++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
34 if(pictures[j] != NULL)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
35 SDL_FreeSurface(pictures[j]);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
36 free(pictures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
37 SDL_VideoQuit();
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
38 printf("Could not load surface from named bitmap file.\n");
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
39 exit(-3);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
40 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
41 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
42
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
43 SDL_Window *window = SDL_CreateShapedWindow("SDL_Shape test",SHAPED_WINDOW_X,SHAPED_WINDOW_Y,SHAPED_WINDOW_DIMENSION,SHAPED_WINDOW_DIMENSION,SDL_WINDOW_RESIZABLE | SDL_WINDOW_SHOWN);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
44 if(window == NULL) {
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
45 for(i=0;i<num_pictures;i++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
46 SDL_FreeSurface(pictures[i]);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
47 free(pictures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
48 SDL_VideoQuit();
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
49 printf("Could not create shaped window for SDL_Shape.\n");
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
50 exit(-4);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
51 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
52 if(SDL_CreateRenderer(window,-1,SDL_RENDERER_PRESENTFLIP2) == -1) {
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
53 SDL_DestroyWindow(window);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
54 for(i=0;i<num_pictures;i++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
55 SDL_FreeSurface(pictures[i]);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
56 free(pictures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
57 SDL_VideoQuit();
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
58 printf("Could not create rendering context for SDL_Shape window.\n");
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
59 exit(-5);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
60 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
61
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
62 SDL_Texture **textures = malloc(sizeof(SDL_Texture*)*num_pictures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
63 for(i=0;i<num_pictures;i++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
64 textures[i] = NULL;
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
65 for(i=0;i<num_pictures;i++) {
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
66 textures[i] = SDL_CreateTextureFromSurface(0,pictures[i]);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
67 if(textures[i] == NULL) {
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
68 int j = 0;
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
69 for(j=0;j<num_pictures;i++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
70 if(textures[i] != NULL)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
71 SDL_DestroyTexture(textures[i]);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
72 free(textures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
73 for(i=0;i<num_pictures;i++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
74 SDL_FreeSurface(pictures[i]);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
75 free(pictures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
76 SDL_DestroyRenderer(window);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
77 SDL_DestroyWindow(window);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
78 SDL_VideoQuit();
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
79 printf("Could not create texture for SDL_shape.\n");
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
80 exit(-6);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
81 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
82 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
83
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
84 SDL_Event event;
4800
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
85 int event_pending = 0,should_exit = 0;
4799
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
86 event_pending = SDL_PollEvent(&event);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
87 unsigned int current_picture = 0;
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
88 SDL_WindowShapeMode mode = {ShapeModeDefault,1};
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
89 int mouse_down = 0;
4802
f14a8c05f5bb Minor bugfixes. testshape now draws a shaped window with bizarre, pixellated gashes of transparency across it, and in doing so seems to hog a system resource and slow the rest of the video system down.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4800
diff changeset
90 Uint32 format = 0,access = 0;
4799
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
91 SDL_Rect texture_dimensions = {0,0,0,0};
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
92 SDL_QueryTexture(textures[current_picture],&format,&access,&texture_dimensions.w,&texture_dimensions.h);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
93 SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
4802
f14a8c05f5bb Minor bugfixes. testshape now draws a shaped window with bizarre, pixellated gashes of transparency across it, and in doing so seems to hog a system resource and slow the rest of the video system down.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4800
diff changeset
94 SDL_SetWindowShape(window,pictures[current_picture],&mode);
4800
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
95 while(should_exit == 0) {
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
96 event_pending = SDL_PollEvent(&event);
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
97 if(event_pending == 1) {
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
98 if(event.type == SDL_MOUSEBUTTONDOWN)
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
99 mouse_down = 1;
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
100 if(mouse_down && event.type == SDL_MOUSEBUTTONUP) {
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
101 mouse_down = 0;
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
102 current_picture += 1;
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
103 if(current_picture >= num_pictures)
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
104 current_picture = 0;
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
105 SDL_QueryTexture(textures[current_picture],&format,&access,&texture_dimensions.w,&texture_dimensions.h);
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
106 SDL_SetWindowSize(window,texture_dimensions.w,texture_dimensions.h);
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
107 SDL_SetWindowShape(window,pictures[current_picture],&mode);
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
108 }
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
109 if(event.type == SDL_QUIT)
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
110 should_exit = 1;
6d4be626225f Same place as before, but optimizing a bit to try to isolate the spot in the program that locks things up.
Eli Gottlieb <eligottlieb@gmail.com>
parents: 4799
diff changeset
111 event_pending = 0;
4799
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
112 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
113
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
114 SDL_SelectRenderer(window);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
115
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
116 //Clear render-target to blue.
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
117 SDL_SetRenderDrawColor(0x00,0x00,0xff,0xff);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
118 SDL_RenderClear();
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
119
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
120 //Render the texture.
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
121 SDL_RenderCopy(textures[current_picture],&texture_dimensions,&texture_dimensions);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
122
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
123 SDL_RenderPresent();
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
124 }
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
125
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
126 //Free the textures.
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
127 for(i=0;i<num_pictures;i++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
128 SDL_DestroyTexture(textures[i]);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
129 free(textures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
130 //Destroy the window.
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
131 SDL_DestroyWindow(window);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
132 //Free the original surfaces backing the textures.
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
133 for(i=0;i<num_pictures;i++)
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
134 SDL_FreeSurface(pictures[i]);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
135 free(pictures);
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
136 //Call SDL_VideoQuit() before quitting.
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
137 SDL_VideoQuit();
a0e096916474 Rewrote test program for shaped windows. It definitely displays recognizable pictures now, but the resizing and shaping functionality isn't behaving correctly, possibly due to a miscalculation of alpha values.
Eli Gottlieb <eligottlieb@gmail.com>
parents:
diff changeset
138 }