< prev index next >

src/java.base/share/native/libjli/java.c

Print this page




1803     for (i = 0; i < knownVMsCount; i++) {
1804         JLI_MemFree(knownVMs[i].name);
1805         knownVMs[i].name = NULL;
1806     }
1807     JLI_MemFree(knownVMs);
1808 }
1809 
1810 /*
1811  * Displays the splash screen according to the jar file name
1812  * and image file names stored in environment variables
1813  */
1814 void
1815 ShowSplashScreen()
1816 {
1817     const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
1818     const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
1819     int data_size;
1820     void *image_data = NULL;
1821     float scale_factor = 1;
1822     char *scaled_splash_name = NULL;
1823 

1824     if (file_name == NULL){
1825         return;
1826     }

1827 
1828     scaled_splash_name = DoSplashGetScaledImageName(
1829                         jar_name, file_name, &scale_factor);



1830     if (jar_name) {
1831 
1832         if (scaled_splash_name) {
1833             image_data = JLI_JarUnpackFile(
1834                     jar_name, scaled_splash_name, &data_size);
1835         }
1836 
1837         if (!image_data) {
1838             scale_factor = 1;
1839             image_data = JLI_JarUnpackFile(
1840                             jar_name, file_name, &data_size);
1841         }
1842         if (image_data) {
1843             DoSplashInit();
1844             DoSplashSetScaleFactor(scale_factor);
1845             DoSplashLoadMemory(image_data, data_size);
1846             JLI_MemFree(image_data);
1847         }
1848     } else {
1849         DoSplashInit();
1850         if (scaled_splash_name) {
1851             DoSplashSetScaleFactor(scale_factor);
1852             DoSplashLoadFile(scaled_splash_name);
1853         } else {
1854             DoSplashLoadFile(file_name);
1855         }
1856     }
1857 
1858     if (scaled_splash_name) {
1859         JLI_MemFree(scaled_splash_name);
1860     }
1861 
1862     DoSplashSetFileJarName(file_name, jar_name);
1863 
1864     /*
1865      * Done with all command line processing and potential re-execs so
1866      * clean up the environment.
1867      */
1868     (void)UnsetEnv(ENV_ENTRY);
1869     (void)UnsetEnv(SPLASH_FILE_ENV_ENTRY);
1870     (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY);
1871 
1872     JLI_MemFree(splash_jar_entry);
1873     JLI_MemFree(splash_file_entry);
1874 
1875 }
1876 
1877 const char*
1878 GetFullVersion()
1879 {
1880     return _fVersion;




1803     for (i = 0; i < knownVMsCount; i++) {
1804         JLI_MemFree(knownVMs[i].name);
1805         knownVMs[i].name = NULL;
1806     }
1807     JLI_MemFree(knownVMs);
1808 }
1809 
1810 /*
1811  * Displays the splash screen according to the jar file name
1812  * and image file names stored in environment variables
1813  */
1814 void
1815 ShowSplashScreen()
1816 {
1817     const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
1818     const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
1819     int data_size;
1820     void *image_data = NULL;
1821     float scale_factor = 1;
1822     char *scaled_splash_name = NULL;
1823     jboolean isImageScaled = JNI_FALSE;
1824     size_t maxScaledImgNameLength = 0;
1825     if (file_name == NULL){
1826         return;
1827     }
1828     maxScaledImgNameLength = DoSplashGetScaledImgNameMaxPstfixLen(file_name);
1829 
1830     scaled_splash_name = JLI_MemAlloc(
1831                             maxScaledImgNameLength * sizeof(char));
1832     isImageScaled = DoSplashGetScaledImageName(jar_name, file_name,
1833                             &scale_factor,
1834                             scaled_splash_name, maxScaledImgNameLength);
1835     if (jar_name) {
1836 
1837         if (isImageScaled) {
1838             image_data = JLI_JarUnpackFile(
1839                     jar_name, scaled_splash_name, &data_size);
1840         }
1841 
1842         if (!image_data) {
1843             scale_factor = 1;
1844             image_data = JLI_JarUnpackFile(
1845                             jar_name, file_name, &data_size);
1846         }
1847         if (image_data) {
1848             DoSplashInit();
1849             DoSplashSetScaleFactor(scale_factor);
1850             DoSplashLoadMemory(image_data, data_size);
1851             JLI_MemFree(image_data);
1852         }
1853     } else {
1854         DoSplashInit();
1855         if (isImageScaled) {
1856             DoSplashSetScaleFactor(scale_factor);
1857             DoSplashLoadFile(scaled_splash_name);
1858         } else {
1859             DoSplashLoadFile(file_name);
1860         }
1861     }


1862     JLI_MemFree(scaled_splash_name);

1863 
1864     DoSplashSetFileJarName(file_name, jar_name);
1865 
1866     /*
1867      * Done with all command line processing and potential re-execs so
1868      * clean up the environment.
1869      */
1870     (void)UnsetEnv(ENV_ENTRY);
1871     (void)UnsetEnv(SPLASH_FILE_ENV_ENTRY);
1872     (void)UnsetEnv(SPLASH_JAR_ENV_ENTRY);
1873 
1874     JLI_MemFree(splash_jar_entry);
1875     JLI_MemFree(splash_file_entry);
1876 
1877 }
1878 
1879 const char*
1880 GetFullVersion()
1881 {
1882     return _fVersion;


< prev index next >