< 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     size_t maxScaledImgNameLength = 0;
1824     if (file_name == NULL){
1825         return;
1826     }
1827     //Max scaled Image file name length
1828     maxScaledImgNameLength = JLI_StrLen(file_name) +
1829                                   JLI_StrLen(".java-scale-200") + 1;
1830 
1831     scaled_splash_name = JLI_MemAlloc(
1832                             maxScaledImgNameLength * sizeof(char));
1833     
1834     memset(scaled_splash_name, '\0', maxScaledImgNameLength * sizeof(char));
1835     DoSplashGetScaledImageName(jar_name, file_name,
1836                                 &scale_factor,
1837                                  scaled_splash_name, maxScaledImgNameLength);
1838     if (jar_name) {
1839 
1840         if (scaled_splash_name[0] != '\0') {
1841             image_data = JLI_JarUnpackFile(
1842                     jar_name, scaled_splash_name, &data_size);
1843         }
1844 
1845         if (!image_data) {
1846             scale_factor = 1;
1847             image_data = JLI_JarUnpackFile(
1848                             jar_name, file_name, &data_size);
1849         }
1850         if (image_data) {
1851             DoSplashInit();
1852             DoSplashSetScaleFactor(scale_factor);
1853             DoSplashLoadMemory(image_data, data_size);
1854             JLI_MemFree(image_data);
1855         }
1856     } else {
1857         DoSplashInit();
1858         if (scaled_splash_name[0] != '\0') {
1859             DoSplashSetScaleFactor(scale_factor);
1860             DoSplashLoadFile(scaled_splash_name);
1861         } else {
1862             DoSplashLoadFile(file_name);
1863         }
1864     }


1865     JLI_MemFree(scaled_splash_name);

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


< prev index next >