Browse Source

bmp: Set ALPHA_EMBEDDED on load

K. Lange 9 months ago
parent
commit
3cacd56bce
11 changed files with 4 additions and 36 deletions
  1. 0 1
      apps/about.c
  2. 0 1
      apps/cat-img.c
  3. 0 6
      apps/compositor.c
  4. 0 1
      apps/glogin-provider.c
  5. 0 1
      apps/imgviewer.c
  6. 0 10
      apps/panel.c
  7. 0 3
      apps/pong.c
  8. 0 1
      apps/showdialog.c
  9. 0 3
      apps/snow.c
  10. 0 9
      apps/tutorial.c
  11. 4 0
      lib/graphics.c

+ 0 - 1
apps/about.c

@@ -149,7 +149,6 @@ int main(int argc, char * argv[]) {
 
 	ctx = init_graphics_yutani_double_buffer(window);
 	load_sprite(&logo, icon_path);
-	logo.alpha = ALPHA_EMBEDDED;
 
 	redraw();
 

+ 0 - 1
apps/cat-img.c

@@ -91,7 +91,6 @@ int main (int argc, char * argv[]) {
 	while (optind < argc) {
 		sprite_t * image = calloc(sizeof(sprite_t),1);
 		load_sprite(image, argv[optind]);
-		image->alpha = ALPHA_EMBEDDED;
 
 		sprite_t * source = image;
 

+ 0 - 6
apps/compositor.c

@@ -2175,17 +2175,11 @@ int main(int argc, char * argv[]) {
 	TRACE("Loading sprites...");
 #define MOUSE_DIR "/usr/share/cursor/"
 	load_sprite(&yg->mouse_sprite, MOUSE_DIR "mouse.bmp");
-	yg->mouse_sprite.alpha = ALPHA_EMBEDDED;
 	load_sprite(&yg->mouse_sprite_drag, MOUSE_DIR "drag.bmp");
-	yg->mouse_sprite_drag.alpha = ALPHA_EMBEDDED;
 	load_sprite(&yg->mouse_sprite_resize_v, MOUSE_DIR "resize-vertical.bmp");
-	yg->mouse_sprite_resize_v.alpha = ALPHA_EMBEDDED;
 	load_sprite(&yg->mouse_sprite_resize_h, MOUSE_DIR "resize-horizontal.bmp");
-	yg->mouse_sprite_resize_h.alpha = ALPHA_EMBEDDED;
 	load_sprite(&yg->mouse_sprite_resize_da, MOUSE_DIR "resize-uldr.bmp");
-	yg->mouse_sprite_resize_da.alpha = ALPHA_EMBEDDED;
 	load_sprite(&yg->mouse_sprite_resize_db, MOUSE_DIR "resize-dlur.bmp");
-	yg->mouse_sprite_resize_db.alpha = ALPHA_EMBEDDED;
 	TRACE("Done.");
 
 	TRACE("Initializing variables...");

+ 0 - 1
apps/glogin-provider.c

@@ -260,7 +260,6 @@ int main (int argc, char ** argv) {
 
 	TRACE("Loading logo...");
 	load_sprite(&logo, LOGO);
-	logo.alpha = ALPHA_EMBEDDED;
 	TRACE("... done.");
 
 	/* Generate surface for background */

+ 0 - 1
apps/imgviewer.c

@@ -154,7 +154,6 @@ int main(int argc, char * argv[]) {
 		fprintf(stderr, "%s: failed to open image %s\n", argv[0], argv[optind]);
 		return 1;
 	}
-	img.alpha = ALPHA_EMBEDDED;
 
 	width = img.width;
 	height = img.height;

+ 0 - 10
apps/panel.c

@@ -364,7 +364,6 @@ static void update_weather_status(void) {
 		char path[512];
 		sprintf(path,"/usr/share/icons/weather/%s.bmp", icon);
 		load_sprite(tmp, path);
-		tmp->alpha = ALPHA_FORCE_SLOW_EMBEDDED;
 		hashmap_set(weather_icons, icon, tmp);
 	}
 
@@ -1367,7 +1366,6 @@ struct MenuEntry * menu_create_clock(void) {
 	if (!watchface) {
 		watchface = malloc(sizeof(sprite_t));
 		load_sprite(watchface, "/usr/share/icons/watchface.bmp");
-		watchface->alpha = ALPHA_EMBEDDED;
 	}
 
 	out->_type = -1; /* Special */
@@ -1525,9 +1523,7 @@ int main (int argc, char ** argv) {
 	sprite_logout = malloc(sizeof(sprite_t));
 
 	load_sprite(sprite_panel,  "/usr/share/panel.bmp");
-	sprite_panel->alpha = ALPHA_EMBEDDED;
 	load_sprite(sprite_logout, "/usr/share/icons/panel-shutdown.bmp");
-	sprite_logout->alpha = ALPHA_FORCE_SLOW_EMBEDDED;
 
 	struct stat stat_tmp;
 	if (!stat("/dev/dsp",&stat_tmp)) {
@@ -1538,13 +1534,9 @@ int main (int argc, char ** argv) {
 		sprite_volume_med  = malloc(sizeof(sprite_t));
 		sprite_volume_high = malloc(sizeof(sprite_t));
 		load_sprite(sprite_volume_mute, "/usr/share/icons/24/volume-mute.bmp");
-		sprite_volume_mute->alpha = ALPHA_FORCE_SLOW_EMBEDDED;
 		load_sprite(sprite_volume_low,  "/usr/share/icons/24/volume-low.bmp");
-		sprite_volume_low->alpha = ALPHA_FORCE_SLOW_EMBEDDED;
 		load_sprite(sprite_volume_med,  "/usr/share/icons/24/volume-medium.bmp");
-		sprite_volume_med->alpha = ALPHA_FORCE_SLOW_EMBEDDED;
 		load_sprite(sprite_volume_high, "/usr/share/icons/24/volume-full.bmp");
-		sprite_volume_high->alpha = ALPHA_FORCE_SLOW_EMBEDDED;
 		/* XXX store current volume */
 	}
 
@@ -1553,10 +1545,8 @@ int main (int argc, char ** argv) {
 		widgets_width += WIDGET_WIDTH;
 		sprite_net_active = malloc(sizeof(sprite_t));
 		load_sprite(sprite_net_active, "/usr/share/icons/24/net-active.bmp");
-		sprite_net_active->alpha = ALPHA_FORCE_SLOW_EMBEDDED;
 		sprite_net_disabled = malloc(sizeof(sprite_t));
 		load_sprite(sprite_net_disabled, "/usr/share/icons/24/net-disconnected.bmp");
-		sprite_net_disabled->alpha = ALPHA_FORCE_SLOW_EMBEDDED;
 	}
 
 	/* TODO Probably should use the app launch shortcut */

+ 0 - 3
apps/pong.c

@@ -233,11 +233,8 @@ int main (int argc, char ** argv) {
 
 	fprintf(stderr, "Loading sprites...\n");
 	load_sprite(&left.sprite, GAME_PATH "/paddle-red.bmp");
-	left.sprite.alpha = ALPHA_EMBEDDED;
 	load_sprite(&right.sprite,GAME_PATH "/paddle-blue.bmp");
-	right.sprite.alpha = ALPHA_EMBEDDED;
 	load_sprite(&ball.sprite, GAME_PATH "/ball.bmp");
-	ball.sprite.alpha = ALPHA_EMBEDDED;
 
 	redraw();
 	update_left();

+ 0 - 1
apps/showdialog.c

@@ -180,7 +180,6 @@ int main(int argc, char * argv[]) {
 	ctx = init_graphics_yutani_double_buffer(window);
 	setup_buttons();
 	load_sprite(&logo, icon_path);
-	logo.alpha = ALPHA_EMBEDDED;
 	redraw();
 
 	struct TTKButton * _down_button = NULL;

+ 0 - 3
apps/snow.c

@@ -110,9 +110,6 @@ int main (int argc, char ** argv) {
 	}
 
 	load_sprite(&snowflake, "/usr/share/snowflake.bmp");
-	snowflake.alpha = ALPHA_EMBEDDED;
-	snowflake.masks = NULL;
-	snowflake.blank = 0;
 
 	wina = yutani_window_create(yctx, 100, 100);
 	if (argc < 2 || strcmp(argv[1],"--no-ad")) {

+ 0 - 9
apps/tutorial.c

@@ -328,19 +328,10 @@ int main(int argc, char * argv[]) {
 
 	/* Load icons */
 	load_sprite(&logo, "/usr/share/logo_login.bmp");
-	logo.alpha = ALPHA_EMBEDDED;
-
 	load_sprite(&terminal, "/usr/share/icons/48/utilities-terminal.bmp");
-	terminal.alpha = ALPHA_EMBEDDED;
-
 	load_sprite(&folder, "/usr/share/icons/48/folder.bmp");
-	folder.alpha = ALPHA_EMBEDDED;
-
 	load_sprite(&package, "/usr/share/icons/48/package.bmp");
-	package.alpha = ALPHA_EMBEDDED;
-
 	load_sprite(&mouse_drag, "/usr/share/cursor/drag.bmp");
-	mouse_drag.alpha = ALPHA_EMBEDDED;
 
 	load_page(0);
 

+ 4 - 0
lib/graphics.c

@@ -470,6 +470,10 @@ int load_sprite_bmp(sprite_t * sprite, char * filename) {
 		#define _BMP_G 0x100
 		#define _BMP_B 0x10000
 
+		if (bpp == 32) {
+			sprite->alpha = ALPHA_EMBEDDED;
+		}
+
 		for (y = 0; y < height; ++y) {
 			for (x = 0; x < width; ++x) {
 				if (i > image_size) goto _cleanup_sprite;