src/java.base/share/native/libjli/java.c
changeset 55189 fdaf7287ea3a
parent 54543 4fc566b7a9c0
child 55193 5f9ef936707c
equal deleted inserted replaced
55188:e29c0c8ebd90 55189:fdaf7287ea3a
  1167 
  1167 
  1168     /*
  1168     /*
  1169      * Passing on splash screen info in environment variables
  1169      * Passing on splash screen info in environment variables
  1170      */
  1170      */
  1171     if (splash_file_name && !headlessflag) {
  1171     if (splash_file_name && !headlessflag) {
  1172         char* splash_file_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_FILE_ENV_ENTRY "=")+JLI_StrLen(splash_file_name)+1);
  1172         splash_file_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_FILE_ENV_ENTRY "=")+JLI_StrLen(splash_file_name)+1);
  1173         JLI_StrCpy(splash_file_entry, SPLASH_FILE_ENV_ENTRY "=");
  1173         JLI_StrCpy(splash_file_entry, SPLASH_FILE_ENV_ENTRY "=");
  1174         JLI_StrCat(splash_file_entry, splash_file_name);
  1174         JLI_StrCat(splash_file_entry, splash_file_name);
  1175         putenv(splash_file_entry);
  1175         putenv(splash_file_entry);
  1176     }
  1176     }
  1177     if (splash_jar_name && !headlessflag) {
  1177     if (splash_jar_name && !headlessflag) {
  1178         char* splash_jar_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_JAR_ENV_ENTRY "=")+JLI_StrLen(splash_jar_name)+1);
  1178         splash_jar_entry = JLI_MemAlloc(JLI_StrLen(SPLASH_JAR_ENV_ENTRY "=")+JLI_StrLen(splash_jar_name)+1);
  1179         JLI_StrCpy(splash_jar_entry, SPLASH_JAR_ENV_ENTRY "=");
  1179         JLI_StrCpy(splash_jar_entry, SPLASH_JAR_ENV_ENTRY "=");
  1180         JLI_StrCat(splash_jar_entry, splash_jar_name);
  1180         JLI_StrCat(splash_jar_entry, splash_jar_name);
  1181         putenv(splash_jar_entry);
  1181         putenv(splash_jar_entry);
  1182     }
  1182     }
  1183 
  1183 
  2239     jboolean isImageScaled = JNI_FALSE;
  2239     jboolean isImageScaled = JNI_FALSE;
  2240     size_t maxScaledImgNameLength = 0;
  2240     size_t maxScaledImgNameLength = 0;
  2241     if (file_name == NULL){
  2241     if (file_name == NULL){
  2242         return;
  2242         return;
  2243     }
  2243     }
       
  2244 
       
  2245     if (!DoSplashInit()) {
       
  2246         goto exit;
       
  2247     }
       
  2248 
  2244     maxScaledImgNameLength = DoSplashGetScaledImgNameMaxPstfixLen(file_name);
  2249     maxScaledImgNameLength = DoSplashGetScaledImgNameMaxPstfixLen(file_name);
  2245 
  2250 
  2246     scaled_splash_name = JLI_MemAlloc(
  2251     scaled_splash_name = JLI_MemAlloc(
  2247                             maxScaledImgNameLength * sizeof(char));
  2252                             maxScaledImgNameLength * sizeof(char));
  2248     isImageScaled = DoSplashGetScaledImageName(jar_name, file_name,
  2253     isImageScaled = DoSplashGetScaledImageName(jar_name, file_name,
  2259             scale_factor = 1;
  2264             scale_factor = 1;
  2260             image_data = JLI_JarUnpackFile(
  2265             image_data = JLI_JarUnpackFile(
  2261                             jar_name, file_name, &data_size);
  2266                             jar_name, file_name, &data_size);
  2262         }
  2267         }
  2263         if (image_data) {
  2268         if (image_data) {
  2264             DoSplashInit();
       
  2265             DoSplashSetScaleFactor(scale_factor);
  2269             DoSplashSetScaleFactor(scale_factor);
  2266             DoSplashLoadMemory(image_data, data_size);
  2270             DoSplashLoadMemory(image_data, data_size);
  2267             JLI_MemFree(image_data);
  2271             JLI_MemFree(image_data);
       
  2272         } else {
       
  2273             DoSplashClose();
  2268         }
  2274         }
  2269     } else {
  2275     } else {
  2270         DoSplashInit();
       
  2271         if (isImageScaled) {
  2276         if (isImageScaled) {
  2272             DoSplashSetScaleFactor(scale_factor);
  2277             DoSplashSetScaleFactor(scale_factor);
  2273             DoSplashLoadFile(scaled_splash_name);
  2278             DoSplashLoadFile(scaled_splash_name);
  2274         } else {
  2279         } else {
  2275             DoSplashLoadFile(file_name);
  2280             DoSplashLoadFile(file_name);
  2277     }
  2282     }
  2278     JLI_MemFree(scaled_splash_name);
  2283     JLI_MemFree(scaled_splash_name);
  2279 
  2284 
  2280     DoSplashSetFileJarName(file_name, jar_name);
  2285     DoSplashSetFileJarName(file_name, jar_name);
  2281 
  2286 
       
  2287     exit:
  2282     /*
  2288     /*
  2283      * Done with all command line processing and potential re-execs so
  2289      * Done with all command line processing and potential re-execs so
  2284      * clean up the environment.
  2290      * clean up the environment.
  2285      */
  2291      */
  2286     (void)UnsetEnv(ENV_ENTRY);
  2292     (void)UnsetEnv(ENV_ENTRY);