@@ -21,10 +21,12 @@ extern void JNIprepare(int width, int height, int fontsize);
21
21
#define ANDROID_TEXT_WIDTH (length , fontsize ) (((length) * (fontsize))/2)
22
22
#define ANDROID_FONTSIZE_SCALE (size ) (((size) * 11) / 9)
23
23
24
- static void native_android_box (struct lstopo_output * loutput , const struct lstopo_color * lcolor , unsigned depth __hwloc_attribute_unused , unsigned x , unsigned width , unsigned y , unsigned height , hwloc_obj_t obj , unsigned box_id __hwloc_attribute_unused )
24
+ #define GP_INDEX_MULTIPLIER 100 /* there can be multiple boxes per object, so multiple gp_index by 100 and add the box_id to get a unique box ID */
25
+
26
+ static void native_android_box (struct lstopo_output * loutput , const struct lstopo_color * lcolor , unsigned depth __hwloc_attribute_unused , unsigned x , unsigned width , unsigned y , unsigned height , hwloc_obj_t obj , unsigned box_id )
25
27
{
26
28
unsigned cpukind_style = lstopo_obj_cpukind_style (loutput , obj );
27
- int gp_index = -1 ;
29
+ int viewid = -1 ;
28
30
int r = lcolor -> r , g = lcolor -> g , b = lcolor -> b ;
29
31
char * info = malloc (1096 );
30
32
const char * sep = " " ;
@@ -34,14 +36,14 @@ static void native_android_box(struct lstopo_output *loutput, const struct lstop
34
36
/* we could remove this info for factorized objects and bridges,
35
37
* but it pretty much doesn't appear at all anyway because it's in the very small bow.
36
38
*/
37
- gp_index = obj -> gp_index ;
39
+ viewid = obj -> gp_index * GP_INDEX_MULTIPLIER + box_id ;
38
40
hwloc_obj_attr_snprintf (info , 1096 , obj , sep , HWLOC_OBJ_SNPRINTF_FLAG_LONG_NAMES |HWLOC_OBJ_SNPRINTF_FLAG_MORE_ATTRS );
39
41
}
40
42
41
43
if (cpukind_style )
42
44
style = cpukind_style ;
43
45
44
- JNIbox (r , g , b , x , y , width , height , style , gp_index , info );
46
+ JNIbox (r , g , b , x , y , width , height , style , viewid , info );
45
47
//Creating a usable java string from char * may trigger an UTF-8 error
46
48
//This code creates a byte array from the char * variable before creating the java string
47
49
}
@@ -65,13 +67,13 @@ static void
65
67
native_android_text (struct lstopo_output * loutput , const struct lstopo_color * lcolor __hwloc_attribute_unused , int size __hwloc_attribute_unused , unsigned depth __hwloc_attribute_unused , unsigned x , unsigned y , const char * text , hwloc_obj_t obj , unsigned text_id __hwloc_attribute_unused )
66
68
{
67
69
unsigned cpukind_style = lstopo_obj_cpukind_style (loutput , obj );
68
- int gp_index = -1 ;
70
+ int viewid = -1 ;
69
71
int bold = 0 ;
70
72
int outside = 0 ;
71
73
72
74
if (obj ) {
73
75
struct lstopo_obj_userdata * lud = obj -> userdata ;
74
- gp_index = obj -> gp_index ;
76
+ viewid = obj -> gp_index * GP_INDEX_MULTIPLIER ;
75
77
/* no info box in small boxes */
76
78
if (loutput -> factorize_enabled
77
79
&& lud -> factorized == 1
@@ -84,7 +86,7 @@ native_android_text(struct lstopo_output *loutput, const struct lstopo_color *lc
84
86
if (cpukind_style % 2 )
85
87
bold = 1 ;
86
88
87
- JNItext ((char * )text , gp_index , x , y , loutput -> fontsize , bold , outside );
89
+ JNItext ((char * )text , viewid , x , y , loutput -> fontsize , bold , outside );
88
90
}
89
91
90
92
static struct draw_methods native_android_draw_methods = {
0 commit comments