< prev index next >

src/java.desktop/unix/native/libsplashscreen/splashscreen_sys.c

Print this page
rev 15262 : 8163408: Fix wrong prototype of getNativeScaleFactor() in systemScale.h


 789 
 790 void
 791 SplashUpdate(Splash * splash) {
 792     sendctl(splash, SPLASHCTL_UPDATE);
 793 }
 794 
 795 void
 796 SplashReconfigure(Splash * splash) {
 797     sendctl(splash, SPLASHCTL_RECONFIGURE);
 798 }
 799 
 800 SPLASHEXPORT jboolean
 801 SplashGetScaledImageName(const char* jarName, const char* fileName,
 802                            float *scaleFactor, char *scaledImgName,
 803                            const size_t scaledImageNameLength)
 804 {
 805     *scaleFactor = 1;
 806 #ifndef __linux__
 807     return JNI_FALSE;
 808 #endif
 809     *scaleFactor = getNativeScaleFactor();
 810     if (*scaleFactor == 2.0) {
 811         size_t length = 0;
 812         char *stringToAppend = ".java-scale2x";
 813         char *dupFileName = strdup(fileName);
 814         char *fileExtension = strrchr(dupFileName, '.');
 815         if (fileExtension == NULL) {
 816             length = strlen(dupFileName) + strlen(stringToAppend) + 1;
 817             if (length > scaledImageNameLength) {
 818                 *scaleFactor = 1;
 819                 free(dupFileName);
 820                 return JNI_FALSE;
 821             }
 822             int retVal = snprintf(scaledImgName, length, "%s%s",
 823                 dupFileName, stringToAppend);
 824             if (retVal < 0 || (retVal != length - 1)) {
 825                 free(dupFileName);
 826                 *scaleFactor = 1;
 827                 return JNI_FALSE;
 828             }
 829         } else {




 789 
 790 void
 791 SplashUpdate(Splash * splash) {
 792     sendctl(splash, SPLASHCTL_UPDATE);
 793 }
 794 
 795 void
 796 SplashReconfigure(Splash * splash) {
 797     sendctl(splash, SPLASHCTL_RECONFIGURE);
 798 }
 799 
 800 SPLASHEXPORT jboolean
 801 SplashGetScaledImageName(const char* jarName, const char* fileName,
 802                            float *scaleFactor, char *scaledImgName,
 803                            const size_t scaledImageNameLength)
 804 {
 805     *scaleFactor = 1;
 806 #ifndef __linux__
 807     return JNI_FALSE;
 808 #endif
 809     *scaleFactor = getNativeScaleFactor(NULL);
 810     if (*scaleFactor == 2.0) {
 811         size_t length = 0;
 812         char *stringToAppend = ".java-scale2x";
 813         char *dupFileName = strdup(fileName);
 814         char *fileExtension = strrchr(dupFileName, '.');
 815         if (fileExtension == NULL) {
 816             length = strlen(dupFileName) + strlen(stringToAppend) + 1;
 817             if (length > scaledImageNameLength) {
 818                 *scaleFactor = 1;
 819                 free(dupFileName);
 820                 return JNI_FALSE;
 821             }
 822             int retVal = snprintf(scaledImgName, length, "%s%s",
 823                 dupFileName, stringToAppend);
 824             if (retVal < 0 || (retVal != length - 1)) {
 825                 free(dupFileName);
 826                 *scaleFactor = 1;
 827                 return JNI_FALSE;
 828             }
 829         } else {


< prev index next >