equal
deleted
inserted
replaced
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 #include <stdio.h> |
26 #include <stdio.h> |
27 #include "splashscreen.h" |
27 #include "splashscreen.h" |
28 |
28 #include "jni.h" |
29 extern void* SplashProcAddress(const char* name); /* in java_md.c */ |
29 extern void* SplashProcAddress(const char* name); /* in java_md.c */ |
30 |
30 |
31 /* |
31 /* |
32 * Prototypes of pointers to functions in splashscreen shared lib |
32 * Prototypes of pointers to functions in splashscreen shared lib |
33 */ |
33 */ |
36 typedef void (*SplashInit_t)(void); |
36 typedef void (*SplashInit_t)(void); |
37 typedef void (*SplashClose_t)(void); |
37 typedef void (*SplashClose_t)(void); |
38 typedef void (*SplashSetFileJarName_t)(const char* fileName, |
38 typedef void (*SplashSetFileJarName_t)(const char* fileName, |
39 const char* jarName); |
39 const char* jarName); |
40 typedef void (*SplashSetScaleFactor_t)(float scaleFactor); |
40 typedef void (*SplashSetScaleFactor_t)(float scaleFactor); |
41 typedef char* (*SplashGetScaledImageName_t)(const char* fileName, |
41 typedef jboolean (*SplashGetScaledImageName_t)(const char* fileName, |
42 const char* jarName, float* scaleFactor); |
42 const char* jarName, float* scaleFactor, |
|
43 char *scaleImageName, const size_t scaleImageNameLength); |
|
44 typedef int (*SplashGetScaledImgNameMaxPstfixLen_t)(const char* filename); |
43 |
45 |
44 /* |
46 /* |
45 * This macro invokes a function from the shared lib. |
47 * This macro invokes a function from the shared lib. |
46 * it locates a function with SplashProcAddress on demand. |
48 * it locates a function with SplashProcAddress on demand. |
47 * if SplashProcAddress fails, def value is returned. |
49 * if SplashProcAddress fails, def value is returned. |
57 if (!proc) { return def; } \ |
59 if (!proc) { return def; } \ |
58 ret ((name##_t)proc) |
60 ret ((name##_t)proc) |
59 |
61 |
60 #define INVOKE(name,def) _INVOKE(name,def,return) |
62 #define INVOKE(name,def) _INVOKE(name,def,return) |
61 #define INVOKEV(name) _INVOKE(name, ,;) |
63 #define INVOKEV(name) _INVOKE(name, ,;) |
|
64 |
62 |
65 |
63 int DoSplashLoadMemory(void* pdata, int size) { |
66 int DoSplashLoadMemory(void* pdata, int size) { |
64 INVOKE(SplashLoadMemory, 0)(pdata, size); |
67 INVOKE(SplashLoadMemory, 0)(pdata, size); |
65 } |
68 } |
66 |
69 |
82 |
85 |
83 void DoSplashSetScaleFactor(float scaleFactor) { |
86 void DoSplashSetScaleFactor(float scaleFactor) { |
84 INVOKEV(SplashSetScaleFactor)(scaleFactor); |
87 INVOKEV(SplashSetScaleFactor)(scaleFactor); |
85 } |
88 } |
86 |
89 |
87 char* DoSplashGetScaledImageName(const char* fileName, const char* jarName, |
90 jboolean DoSplashGetScaledImageName(const char* fileName, const char* jarName, |
88 float* scaleFactor) { |
91 float* scaleFactor, char *scaledImageName, const size_t scaledImageNameLength) { |
89 INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor); |
92 INVOKE(SplashGetScaledImageName, 0)(fileName, jarName, scaleFactor, |
|
93 scaledImageName, scaledImageNameLength); |
90 } |
94 } |
|
95 |
|
96 int DoSplashGetScaledImgNameMaxPstfixLen(const char *fileName) { |
|
97 INVOKE(SplashGetScaledImgNameMaxPstfixLen, 0)(fileName); |
|
98 } |
|
99 |