ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.164 by root, Tue Nov 7 22:41:27 2006 UTC vs.
Revision 1.165 by root, Fri Dec 8 14:59:54 2006 UTC

1049xy_to_index (CFPlus::Layout self, int x, int y) 1049xy_to_index (CFPlus::Layout self, int x, int y)
1050 CODE: 1050 CODE:
1051{ 1051{
1052 int index, trailing; 1052 int index, trailing;
1053 pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); 1053 pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing);
1054 RETVAL = index; 1054 RETVAL = index + trailing;
1055} 1055}
1056 OUTPUT: 1056 OUTPUT:
1057 RETVAL 1057 RETVAL
1058 1058
1059void 1059void
1065 1065
1066 EXTEND (SP, 3); 1066 EXTEND (SP, 3);
1067 PUSHs (sv_2mortal (newSViv (strong_pos.x / PANGO_SCALE))); 1067 PUSHs (sv_2mortal (newSViv (strong_pos.x / PANGO_SCALE)));
1068 PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); 1068 PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE)));
1069 PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); 1069 PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE)));
1070}
1071
1072void
1073index_to_line_x (CFPlus::Layout self, int index, int trailing = 0)
1074 PPCODE:
1075{
1076 int line, x;
1077
1078 pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x);
1079 /* pango bug: line is between 1..numlines, not 0..numlines-1 */
1080
1081 EXTEND (SP, 2);
1082 PUSHs (sv_2mortal (newSViv (line - 1)));
1083 PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE)));
1084}
1085
1086void
1087line_x_to_index (CFPlus::Layout self, int line, int x)
1088 PPCODE:
1089{
1090 PangoLayoutLine *lp;
1091 int index, trailing;
1092
1093 if (line < 0)
1094 XSRETURN_EMPTY;
1095
1096 if (!(lp = pango_layout_get_line (self->pl, line)))
1097 XSRETURN_EMPTY; /* do better */
1098
1099 if (!pango_layout_line_x_to_index (lp, x * PANGO_SCALE, &index, &trailing))
1100 XSRETURN_EMPTY; /* do better */
1101
1102 EXTEND (SP, 2);
1103 if (GIMME_V == G_SCALAR)
1104 PUSHs (sv_2mortal (newSViv (index + trailing)));
1105 else
1106 {
1107 PUSHs (sv_2mortal (newSViv (index)));
1108 PUSHs (sv_2mortal (newSViv (trailing)));
1109 }
1070} 1110}
1071 1111
1072void 1112void
1073render (CFPlus::Layout self, float x, float y, int flags = 0) 1113render (CFPlus::Layout self, float x, float y, int flags = 0)
1074 PPCODE: 1114 PPCODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines