From: Charlie Brej Date: Tue, 30 Jun 2009 16:38:48 +0000 (+0100) Subject: [script] Add support for loading the system logo image X-Git-Tag: 0.7.0~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0774cc8f140f9575efd5665adf79d789f3a8a9f;p=thirdparty%2Fplymouth.git [script] Add support for loading the system logo image This is done specifying the filename is special://logo. Not sure if this is the best way of implementing but it is expandable to other special files. --- diff --git a/src/plugins/splash/script/script-lib-image.c b/src/plugins/splash/script/script-lib-image.c index cf051cab..81fa019b 100644 --- a/src/plugins/splash/script/script-lib-image.c +++ b/src/plugins/splash/script/script-lib-image.c @@ -35,7 +35,23 @@ static script_return image_new (script_state* state, void* user_data) script_obj* script_obj_filename = script_obj_hash_get_element (state->local, "filename"); filename = script_obj_as_string(script_obj_filename); - asprintf(&path_filename, "%s/%s", data->image_dir, filename); + + char* test_string = filename; + char* prefix_string = "special://"; + while (*test_string && *prefix_string && *test_string == *prefix_string){ + test_string++; + prefix_string++; + } + if (!*prefix_string) { + if (strcmp(test_string, "logo") == 0) + path_filename = strdup (PLYMOUTH_LOGO_FILE); + else + path_filename = strdup (""); + } + else + asprintf(&path_filename, "%s/%s", data->image_dir, filename); + + script_obj_unref(script_obj_filename); ply_image_t *image = ply_image_new (path_filename); diff --git a/themes/script/script.script b/themes/script/script.script index 59a43e97..dccea015 100644 --- a/themes/script/script.script +++ b/themes/script/script.script @@ -1,4 +1,7 @@ +logo.image = ImageNew("special://logo"); +logo.sprite = SpriteNew(); +SpriteSetImage(logo.sprite, logo.image); index = 0; @@ -19,11 +22,16 @@ fun refresh (){ int_frame_index = MathInt(frame_index); SpriteSetImage (throbber_sprite, frame_image[int_frame_index]); SpriteSetX (throbber_sprite, 400 - ImageGetWidth(frame_image[int_frame_index]) / 2); - SpriteSetY (throbber_sprite, 300 - ImageGetHeight(frame_image[int_frame_index]) / 2); + SpriteSetY (throbber_sprite, 300); SpriteSetOpacity (throbber_sprite, 1); + SpriteSetX (logo.sprite, 400 - ImageGetWidth(logo.image) / 2); + SpriteSetY (logo.sprite, 300 - ImageGetHeight(logo.image)); + SpriteSetOpacity (logo.sprite, 1); } if (status != "normal"){ SpriteSetOpacity (throbber_sprite, 0); + SpriteSetX (logo.sprite, 0); + SpriteSetY (logo.sprite, 0); } }