bmp: Set ALPHA_EMBEDDED on load

This commit is contained in:
K. Lange 2020-04-23 20:15:56 +09:00
parent c6da6020f4
commit 3cacd56bce
11 changed files with 4 additions and 36 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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...");

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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();

View File

@ -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;

View File

@ -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")) {

View File

@ -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);

View File

@ -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;