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.243 by root, Thu Dec 27 06:54:36 2007 UTC vs.
Revision 1.250 by root, Fri Dec 28 16:09:03 2007 UTC

45#define G_DISABLE_CAST_CHECKS 45#define G_DISABLE_CAST_CHECKS
46 46
47#include <glib/gmacros.h> 47#include <glib/gmacros.h>
48 48
49#include <pango/pango.h> 49#include <pango/pango.h>
50
51#if !(defined (PANGO_VERSION_CHECK) && PANGO_VERSION_CHECK (1, 15, 2))
52# define pango_layout_get_line_readonly pango_layout_get_line_readonly
53# define pango_layout_get_lines_readonly pango_layout_get_lines_readonly
54# define pango_layout_iter_get_line_readonly pango_layout_iter_get_line_readonly
55# define pango_layout_iter_get_run_readonly pango_layout_iter_get_run_readonly
56#endif
50 57
51#ifndef _WIN32 58#ifndef _WIN32
52# include <sys/types.h> 59# include <sys/types.h>
53# include <sys/socket.h> 60# include <sys/socket.h>
54# include <netinet/in.h> 61# include <netinet/in.h>
659 CODE: 666 CODE:
660{ 667{
661 opengl_fontmap = pango_opengl_font_map_new (); 668 opengl_fontmap = pango_opengl_font_map_new ();
662 pango_opengl_font_map_set_default_substitute ((PangoOpenGLFontMap *)opengl_fontmap, substitute_func, 0, 0); 669 pango_opengl_font_map_set_default_substitute ((PangoOpenGLFontMap *)opengl_fontmap, substitute_func, 0, 0);
663 opengl_context = pango_opengl_font_map_create_context ((PangoOpenGLFontMap *)opengl_fontmap); 670 opengl_context = pango_opengl_font_map_create_context ((PangoOpenGLFontMap *)opengl_fontmap);
671#if defined (PANGO_VERSION_CHECK) && PANGO_VERSION_CHECK (1, 15, 2)
672 pango_context_set_language (opengl_context, pango_language_from_string ("en"));
673 /*pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR);*/
674#endif
664} 675}
665 676
666char * 677char *
667SDL_GetError () 678SDL_GetError ()
668 679
1165{ 1176{
1166 PangoLayoutIter *iter = pango_layout_get_iter (self->pl); 1177 PangoLayoutIter *iter = pango_layout_get_iter (self->pl);
1167 1178
1168 do 1179 do
1169 { 1180 {
1170 PangoLayoutRun *run = pango_layout_iter_get_run (iter); 1181 PangoLayoutRun *run = pango_layout_iter_get_run_readonly (iter);
1171 1182
1172 if (run && shape_attr_p (run)) 1183 if (run && shape_attr_p (run))
1173 { 1184 {
1174 PangoRectangle extents; 1185 PangoRectangle extents;
1175 pango_layout_iter_get_run_extents (iter, 0, &extents); 1186 pango_layout_iter_get_run_extents (iter, 0, &extents);
1279int 1290int
1280descent (DC::Layout self) 1291descent (DC::Layout self)
1281 CODE: 1292 CODE:
1282{ 1293{
1283 PangoRectangle rect; 1294 PangoRectangle rect;
1284 PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); 1295 PangoLayoutLine *line = pango_layout_get_line_readonly (self->pl, 0);
1285 pango_layout_line_get_pixel_extents (line, 0, &rect); 1296 pango_layout_line_get_pixel_extents (line, 0, &rect);
1286 RETVAL = PANGO_DESCENT (rect); 1297 RETVAL = PANGO_DESCENT (rect);
1287} 1298}
1288 OUTPUT: 1299 OUTPUT:
1289 RETVAL 1300 RETVAL
1317 PPCODE: 1328 PPCODE:
1318{ 1329{
1319 int line, x; 1330 int line, x;
1320 1331
1321 pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x); 1332 pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x);
1333#if !(defined (PANGO_VERSION_CHECK) && PANGO_VERSION_CHECK (1, 17, 3))
1322 /* pango bug: line is between 1..numlines, not 0..numlines-1 */ 1334 /* pango bug: line is between 1..numlines, not 0..numlines-1 */
1323 1335 --line;
1336#endif
1324 EXTEND (SP, 2); 1337 EXTEND (SP, 2);
1325 PUSHs (sv_2mortal (newSViv (line - 1))); 1338 PUSHs (sv_2mortal (newSViv (line)));
1326 PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE))); 1339 PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE)));
1327} 1340}
1328 1341
1329void 1342void
1330line_x_to_index (DC::Layout self, int line, int x) 1343line_x_to_index (DC::Layout self, int line, int x)
1334 int index, trailing; 1347 int index, trailing;
1335 1348
1336 if (line < 0) 1349 if (line < 0)
1337 XSRETURN_EMPTY; 1350 XSRETURN_EMPTY;
1338 1351
1339 if (!(lp = pango_layout_get_line (self->pl, line))) 1352 if (!(lp = pango_layout_get_line_readonly (self->pl, line)))
1340 XSRETURN_EMPTY; /* do better */ 1353 XSRETURN_EMPTY; /* do better */
1341 1354
1342 pango_layout_line_x_to_index (lp, x * PANGO_SCALE, &index, &trailing); 1355 pango_layout_line_x_to_index (lp, x * PANGO_SCALE, &index, &trailing);
1343 1356
1344 EXTEND (SP, 2); 1357 EXTEND (SP, 2);
2846void glSeparableFilter2D (int target, int internalformat, int width, int height, int format, int type, char *row, char *column) 2859void glSeparableFilter2D (int target, int internalformat, int width, int height, int format, int type, char *row, char *column)
2847 CODE: 2860 CODE:
2848 if (gl.SeparableFilter2D) 2861 if (gl.SeparableFilter2D)
2849 gl.SeparableFilter2D (target, internalformat, width, height, format, type, row, column); 2862 gl.SeparableFilter2D (target, internalformat, width, height, format, type, row, column);
2850 2863
2851void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data) 2864void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type, char *data = 0)
2852 2865
2853void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) 2866void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border)
2854 2867
2855void glDrawPixels (int width, int height, int format, int type, char *pixels) 2868void glDrawPixels (int width, int height, int format, int type, char *pixels)
2856 2869

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines