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.124 by root, Tue Jul 4 23:23:31 2006 UTC vs.
Revision 1.130 by root, Wed Jul 12 17:21:01 2006 UTC

51#define MAP_EXTEND_X 32 51#define MAP_EXTEND_X 32
52#define MAP_EXTEND_Y 512 52#define MAP_EXTEND_Y 512
53 53
54#define MIN_FONT_HEIGHT 10 54#define MIN_FONT_HEIGHT 10
55 55
56#if 1 56#if 0
57# define PARACHUTE SDL_INIT_NOPARACHUTE 57# define PARACHUTE SDL_INIT_NOPARACHUTE
58#else 58#else
59# define PARACHUTE 0 59# define PARACHUTE 0
60#endif 60#endif
61 61
121{ 121{
122 FcPatternAddBool (pattern, FC_HINTING, 1); 122 FcPatternAddBool (pattern, FC_HINTING, 1);
123#ifdef FC_HINT_STYLE 123#ifdef FC_HINT_STYLE
124 FcPatternAddBool (pattern, FC_HINT_STYLE, FC_HINT_FULL); 124 FcPatternAddBool (pattern, FC_HINT_STYLE, FC_HINT_FULL);
125#endif 125#endif
126#ifdef _WIN32
127 FcPatternAddBool (pattern, FC_AUTOHINT, 1);
128#else
129 FcPatternAddBool (pattern, FC_AUTOHINT, 0); 126 FcPatternAddBool (pattern, FC_AUTOHINT, 0);
130#endif
131} 127}
132 128
133static void 129static void
134layout_update_font (CFClient__Layout self) 130layout_update_font (CFClient__Layout self)
135{ 131{
467 463
468 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 464 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
469 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 465 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
470} 466}
471 467
468int
469in_destruct ()
470 CODE:
471 RETVAL = PL_main_cv == Nullcv;
472 OUTPUT:
473 RETVAL
474
472NV floor (NV x) 475NV floor (NV x)
473 476
474NV ceil (NV x) 477NV ceil (NV x)
475 478
476void 479void
628#endif 631#endif
629 632
630void 633void
631add_font (char *file) 634add_font (char *file)
632 CODE: 635 CODE:
633 FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ 636 FcConfigAppFontAddFile (0, (const FcChar8 *)file);
634 637
635void 638void
636load_image_inline (SV *image_) 639load_image_inline (SV *image_)
637 ALIAS: 640 ALIAS:
638 load_image_file = 1 641 load_image_file = 1
680 683
681 surface2 = SDL_ConvertSurface (surface, &fmt, SDL_SWSURFACE); 684 surface2 = SDL_ConvertSurface (surface, &fmt, SDL_SWSURFACE);
682 685
683 assert (surface2->pitch == surface2->w * 4); 686 assert (surface2->pitch == surface2->w * 4);
684 687
688 SDL_LockSurface (surface2);
685 EXTEND (SP, 5); 689 EXTEND (SP, 6);
686 PUSHs (sv_2mortal (newSViv (surface2->w))); 690 PUSHs (sv_2mortal (newSViv (surface2->w)));
687 PUSHs (sv_2mortal (newSViv (surface2->h))); 691 PUSHs (sv_2mortal (newSViv (surface2->h)));
688 SDL_LockSurface (surface2);
689 PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); 692 PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch)));
690 SDL_UnlockSurface (surface2);
691 PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); 693 PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB)));
692 PUSHs (sv_2mortal (newSViv (GL_RGBA))); 694 PUSHs (sv_2mortal (newSViv (GL_RGBA)));
693 PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); 695 PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE)));
696 SDL_UnlockSurface (surface2);
694 697
695 SDL_FreeSurface (surface); 698 SDL_FreeSurface (surface);
696 SDL_FreeSurface (surface2); 699 SDL_FreeSurface (surface2);
697} 700}
698 701
768 default_font = self; 771 default_font = self;
769 772
770MODULE = CFClient PACKAGE = CFClient::Layout 773MODULE = CFClient PACKAGE = CFClient::Layout
771 774
772void 775void
773clear_font_cache () 776reset_glyph_cache ()
774 CODE: 777 CODE:
775 pango_fc_font_map_cache_clear ((PangoFcFontMap *)opengl_fontmap);
776 tc_clear (); 778 tc_clear ();
777 779
778CFClient::Layout 780CFClient::Layout
779new (SV *class, int type = 0) 781new (SV *class)
780 CODE: 782 CODE:
781 New (0, RETVAL, 1, struct cf_layout); 783 New (0, RETVAL, 1, struct cf_layout);
782 784
783 RETVAL->pl = pango_layout_new (opengl_context); 785 RETVAL->pl = pango_layout_new (opengl_context);
784 RETVAL->r = 1.; 786 RETVAL->r = 1.;
877 if (run && shape_attr_p (run)) 879 if (run && shape_attr_p (run))
878 { 880 {
879 PangoRectangle extents; 881 PangoRectangle extents;
880 pango_layout_iter_get_run_extents (iter, 0, &extents); 882 pango_layout_iter_get_run_extents (iter, 0, &extents);
881 883
884 EXTEND (SP, 2);
882 PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.x)))); 885 PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.x))));
883 PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.y)))); 886 PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.y))));
884 } 887 }
885 } 888 }
886 while (pango_layout_iter_next_run (iter)); 889 while (pango_layout_iter_next_run (iter));
1911 r *= a; 1914 r *= a;
1912 g *= a; 1915 g *= a;
1913 b *= a; 1916 b *= a;
1914 } 1917 }
1915 // microsoft visual "c" rounds instead of truncating... 1918 // microsoft visual "c" rounds instead of truncating...
1916 glColor4ub (MIN ((int)(r * 256.f), 255), 1919 glColor4f (r, g, b, a);
1917 MIN ((int)(g * 256.f), 255),
1918 MIN ((int)(b * 256.f), 255),
1919 MIN ((int)(a * 256.f), 255));
1920 1920
1921void glInterleavedArrays (int format, int stride, char *data) 1921void glInterleavedArrays (int format, int stride, char *data)
1922 1922
1923void glDrawElements (int mode, int count, int type, char *indices) 1923void glDrawElements (int mode, int count, int type, char *indices)
1924 1924

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines