Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h tclass.c ttfont.c 


Log Message:
Freetype stuff is now only in ttfont.c.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -3 -r1.157 -r1.158
--- E.h 9 Dec 2003 20:35:14 -0000       1.157
+++ E.h 12 Dec 2003 18:42:15 -0000      1.158
@@ -195,13 +195,6 @@
 #include <sys/resource.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
-#ifdef HAVE_FREETYPE1_FREETYPE_FREETYPE_H
-#include <freetype1/freetype/freetype.h>
-#elif defined(HAVE_FREETYPE_FREETYPE_H)
-#include <freetype/freetype.h>
-#else
-#include <freetype.h>
-#endif
 
 /* workaround for 64bit architectures - xlib expects 32bit CARDINALS to be */
 /* long's on 64bit machines... thus well the CARD32's Im unsing shoudl be.. */
@@ -671,6 +664,8 @@
 typedef struct _button Button;
 typedef struct _buttoncontainer Container;
 
+typedef struct _efont Efont;
+
 typedef struct
 {
    char                type;
@@ -786,21 +781,6 @@
 }
 ImageClass;
 
-typedef struct _efont
-{
-   TT_Engine           engine;
-   TT_Face             face;
-   TT_Instance         instance;
-   TT_Face_Properties  properties;
-   int                 num_glyph;
-   TT_Glyph           *glyphs;
-   TT_Raster_Map     **glyphs_cached;
-   TT_CharMap          char_map;
-   int                 max_descent;
-   int                 max_ascent;
-}
-Efont;
-
 #if !USE_FNLIB
 #define MODE_VERBATIM  0
 #define MODE_WRAP_CHAR 1
@@ -2498,7 +2478,13 @@
 Window             *ListProgressWindows(int *num);
 void                RaiseProgressbars(void);
 
-#if defined(__FILE__) && defined(__LINE__)
+#if defined(USE_LIBC_MALLOC)
+
+#define Emalloc malloc
+#define Efree free
+
+#elif defined(__FILE__) && defined(__LINE__)
+
 #define Efree(x) \
 __Efree(x, __FILE__, __LINE__)
 #define Emalloc(x) \
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/tclass.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- tclass.c    5 Nov 2003 17:24:46 -0000       1.16
+++ tclass.c    12 Dec 2003 18:42:15 -0000      1.17
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (C) 2000-2003 Carsten Haitzler, Geoff Harrison and various contributors
  *
@@ -48,9 +47,6 @@
 void
 FreeTextState(TextState * ts)
 {
-
-   int                 i = 0;
-
    if (ts->fontname)
       Efree(ts->fontname);
 #if USE_FNLIB
@@ -60,21 +56,8 @@
    if (ts->xfont)
       XFreeFont(disp, ts->xfont);
    if (ts->efont)
-     {
-       for (i = 0; i < ts->efont->num_glyph; i++)
-         {
-            Efree(ts->efont->glyphs_cached[i]->bitmap);
-            Efree(ts->efont->glyphs_cached[i]);
-            TT_Done_Glyph(ts->efont->glyphs[i]);
-         }
-       Efree(ts->efont->glyphs_cached);
-       Efree(ts->efont->glyphs);
-       Efree(ts->efont);
-     }
+      Efont_free(ts->efont);
    Efree(ts);
-
-   return;
-
 }
 
 void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ttfont.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -3 -r1.26 -r1.27
--- ttfont.c    15 Nov 2003 22:27:17 -0000      1.26
+++ ttfont.c    12 Dec 2003 18:42:15 -0000      1.27
@@ -22,6 +22,35 @@
  */
 #include "E.h"
 
+#if TEST_TTFONT
+#undef XSync
+#undef IC_RenderDepth
+#define IC_RenderDepth() DefaultDepth(disp, DefaultScreen(disp))
+#define EGetGeometry XGetGeometry
+#endif
+
+#ifdef HAVE_FREETYPE1_FREETYPE_FREETYPE_H
+#include <freetype1/freetype/freetype.h>
+#elif defined(HAVE_FREETYPE_FREETYPE_H)
+#include <freetype/freetype.h>
+#else
+#include <freetype.h>
+#endif
+
+struct _efont
+{
+   TT_Engine           engine;
+   TT_Face             face;
+   TT_Instance         instance;
+   TT_Face_Properties  properties;
+   int                 num_glyph;
+   TT_Glyph           *glyphs;
+   TT_Raster_Map     **glyphs_cached;
+   TT_CharMap          char_map;
+   int                 max_descent;
+   int                 max_ascent;
+};
+
 typedef struct _efont_color_tab EfontColorTable;
 
 struct _efont_color_tab
@@ -343,8 +372,8 @@
        /* This was the cause of strange misplacements when Bit.rows */
        /* was unsigned.                                             */
 
-       if (xmin >= (int)rmap->width || ymin >= (int)rmap->rows || xmax < 0
-           || ymax < 0)
+       if (xmin >= (int)rmap->width || ymin >= (int)rmap->rows ||
+           xmax < 0 || ymax < 0)
           continue;
 
        /* Note that the clipping check is performed _after_ rendering */
@@ -421,8 +450,7 @@
    cb = (col << 3) & 0xf8;
    for (y = 0; y < xim->height; y++)
      {
-       ptr =
-          (unsigned char *)rmap->bitmap + offset_x +
+       ptr = (unsigned char *)rmap->bitmap + offset_x +
           ((y + offset_y) * rmap->cols);
        for (x = 0; x < xim->width; x++)
          {
@@ -441,8 +469,7 @@
                       ng = g + ((tmp + (tmp >> 8) + 0x80) >> 8);
                       tmp = (cb - b) * a;
                       nb = b + ((tmp + (tmp >> 8) + 0x80) >> 8);
-                      pixel =
-                         ((nr & 0xf8) << 8) | ((ng & 0xfc) << 3) |
+                      pixel = ((nr & 0xf8) << 8) | ((ng & 0xfc) << 3) |
                          ((nb & 0xf8) >> 3);
                       XPutPixel(xim, x, y, pixel);
                    }
@@ -468,8 +495,7 @@
    cb = (col << 3) & 0xf8;
    for (y = 0; y < xim->height; y++)
      {
-       ptr =
-          (unsigned char *)rmap->bitmap + offset_x +
+       ptr = (unsigned char *)rmap->bitmap + offset_x +
           ((y + offset_y) * rmap->cols);
        for (x = 0; x < xim->width; x++)
          {
@@ -488,8 +514,7 @@
                       ng = g + ((tmp + (tmp >> 8) + 0x80) >> 8);
                       tmp = (cb - b) * a;
                       nb = b + ((tmp + (tmp >> 8) + 0x80) >> 8);
-                      pixel =
-                         ((nr & 0xf8) << 7) | ((ng & 0xf8) << 2) |
+                      pixel = ((nr & 0xf8) << 7) | ((ng & 0xf8) << 2) |
                          ((nb & 0xf8) >> 3);
                       XPutPixel(xim, x, y, pixel);
                    }
@@ -515,8 +540,7 @@
    cb = col & 0xff;
    for (y = 0; y < xim->height; y++)
      {
-       ptr =
-          (unsigned char *)rmap->bitmap + offset_x +
+       ptr = (unsigned char *)rmap->bitmap + offset_x +
           ((y + offset_y) * rmap->cols);
        for (x = 0; x < xim->width; x++)
          {
@@ -594,8 +618,7 @@
 
    for (y = 0; y < xim->height; y++)
      {
-       ptr =
-          (unsigned char *)rmap->bitmap + offset_x +
+       ptr = (unsigned char *)rmap->bitmap + offset_x +
           ((y + offset_y) * rmap->cols);
        for (x = 0; x < xim->width; x++)
          {
@@ -649,9 +672,9 @@
      {
        x_error = 0;
        is_pixmap = 1;
-       EGetGeometry(disp, win, &chld, &rx, &rx, (unsigned int *)&xatt.width,
-                    (unsigned int *)&xatt.height, (unsigned int *)&rx,
-                    (unsigned int *)&xatt.depth);
+       EGetGeometry(disp, win, &chld, &rx, &rx,
+                    (unsigned int *)&xatt.width, (unsigned int *)&xatt.height,
+                    (unsigned int *)&rx, (unsigned int *)&xatt.depth);
        XFlush(disp);
        if (x_error)
          {
@@ -744,9 +767,8 @@
          {
             erh = XSetErrorHandler((XErrorHandler) handle_x_error);
          }
-       xim =
-          XShmCreateImage(disp, vis, xatt.depth, ZPixmap, NULL, &shminfo,
-                          width, height);
+       xim = XShmCreateImage(disp, vis, xatt.depth, ZPixmap, NULL,
+                             &shminfo, width, height);
        if (!shm_checked)
          {
             XSync(disp, False);
@@ -754,24 +776,21 @@
               {
                  shm = 0;
                  XDestroyImage(xim);
-                 xim =
-                    XGetImage(disp, win, x, y, width, height, 0xffffffff,
-                              ZPixmap);
+                 xim = XGetImage(disp, win, x, y, width, height,
+                                 0xffffffff, ZPixmap);
                  XSetErrorHandler((XErrorHandler) erh);
                  shm_checked = 1;
               }
             else
               {
-                 shminfo.shmid =
-                    shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height,
-                           IPC_CREAT | 0666);
+                 shminfo.shmid = shmget(IPC_PRIVATE, xim->bytes_per_line *
+                                        xim->height, IPC_CREAT | 0666);
                  if (shminfo.shmid < 0)
                    {
                       shm = 0;
                       XDestroyImage(xim);
-                      xim =
-                         XGetImage(disp, win, x, y, width, height, 0xffffffff,
-                                   ZPixmap);
+                      xim = XGetImage(disp, win, x, y, width, height,
+                                      0xffffffff, ZPixmap);
                       XSetErrorHandler((XErrorHandler) erh);
                       shm_checked = 1;
                    }
@@ -785,16 +804,14 @@
          }
        else
          {
-            shminfo.shmid =
-               shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height,
-                      IPC_CREAT | 0666);
+            shminfo.shmid = shmget(IPC_PRIVATE, xim->bytes_per_line *
+                                   xim->height, IPC_CREAT | 0666);
             if (shminfo.shmid < 0)
               {
                  shm = 0;
                  XDestroyImage(xim);
-                 xim =
-                    XGetImage(disp, win, x, y, width, height, 0xffffffff,
-                              ZPixmap);
+                 xim = XGetImage(disp, win, x, y, width, height,
+                                 0xffffffff, ZPixmap);
                  XSetErrorHandler((XErrorHandler) erh);
                  shm_checked = 1;
               }
@@ -812,9 +829,8 @@
               {
                  shm = 0;
                  XDestroyImage(xim);
-                 xim =
-                    XGetImage(disp, win, x, y, width, height, 0xffffffff,
-                              ZPixmap);
+                 xim = XGetImage(disp, win, x, y, width, height,
+                                 0xffffffff, ZPixmap);
                  shm_checked = 1;
               }
             XSetErrorHandler((XErrorHandler) erh);
@@ -829,22 +845,22 @@
 /*  XUngrabServer(disp); */
 /*  XFlush(disp); */
 
-/*  
- * if (xatt.depth == 16)
- * {
- * XVisualInfo         xvi, *xvir;
- * int                 num;
- * 
- * xvi.visualid = XVisualIDFromVisual(vis);;
- * xvir = XGetVisualInfo(disp, VisualIDMask, &xvi, &num);
- * if (xvir)
- * {
- * if (xvir->red_mask != 0xf800)
- * xatt.depth = 15;
- * XFree(xvir);
- * }
- * }
- */
+#if 0
+   if (xatt.depth == 16)
+     {
+       XVisualInfo         xvi, *xvir;
+       int                 num;
+
+       xvi.visualid = XVisualIDFromVisual(vis);;
+       xvir = XGetVisualInfo(disp, VisualIDMask, &xvi, &num);
+       if (xvir)
+         {
+            if (xvir->red_mask != 0xf800)
+               xatt.depth = 15;
+            XFree(xvir);
+         }
+     }
+#endif
    if (xim)
      {
        if (xatt.depth == 16)
@@ -961,8 +977,8 @@
    for (i = 0; i < n; i++)
      {
        TT_Get_CharMap_ID(f->face, i, &platform, &encoding);
-       if ((platform == 3 && encoding == 1)
-           || (platform == 0 && encoding == 0))
+       if ((platform == 3 && encoding == 1) ||
+           (platform == 0 && encoding == 0))
          {
             /* TT_Get_CharMap(f->face, i, &char_map); */
             TT_Get_CharMap(f->face, i, &(f->char_map));
@@ -1076,42 +1092,56 @@
       *max_descent_return = f->max_descent;
 }
 
-/*
- * int
- * main( int argc, char **argv)
- * {
- * Display            *disp;
- * Efont              *f;
- * GC                  gc;
- * XGCValues           gcv;
- * Window              win;
- * int                 i;
- * 
- * disp=XOpenDisplay(NULL);
- * XSync(disp, False);
- * srand(time(NULL));
- * win = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, 640, 480, 0, 
- * 0, 0);
- * EMapWindow(disp, win);
- * XSync(disp, False);
- * 
- * gcv.subwindow_mode = IncludeInferiors;
- * gc = XCreateGC(disp, win, GCSubwindowMode, &gcv);
- * for (;;)
- * {
- * for (i = 3; i < argc; i++)
- * {
- * XSetForeground(disp, gc, rand()<<16 | rand());
- * f = Efont_load(argv[i], atoi(argv[1]));
- * if (f)
- * EFont_draw_string(disp, win, gc, 20, (atoi(argv[1])/10) * (i-2), argv[2], 
- * f,
- * DefaultVisual(disp, DefaultScreen(disp)),
- * DefaultColormap(disp, DefaultScreen(disp)));
- * Efont_free(f);
- * f = NULL;
- * }
- * }
- * return 0;
- * }
- */
+#if TEST_TTFONT
+Display            *disp;
+
+int
+main(int argc, char **argv)
+{
+   Efont              *f;
+   GC                  gc;
+   XGCValues           gcv;
+   Window              win;
+   int                 i, j;
+
+   disp = XOpenDisplay(NULL);
+   XSync(disp, False);
+   srand(time(NULL));
+   win = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, 640, 480, 0,
+                            0, 0);
+   XMapWindow(disp, win);
+   XSync(disp, False);
+
+   gcv.subwindow_mode = IncludeInferiors;
+   gc = XCreateGC(disp, win, GCSubwindowMode, &gcv);
+   for (;; j++)
+     {
+       for (i = 3; i < argc; i++)
+         {
+            XSetForeground(disp, gc, rand() << 16 | rand());
+            f = Efont_load(argv[i], atoi(argv[1]));
+            if (f)
+               EFont_draw_string(disp, win, gc, 20,
+                                 atoi(argv[1]) * (i - 2), argv[2], f,
+                                 DefaultVisual(disp, DefaultScreen(disp)),
+                                 DefaultColormap(disp, DefaultScreen(disp)));
+            Efont_free(f);
+            f = NULL;
+         }
+     }
+   return 0;
+}
+
+void
+GrabX()
+{
+   XGrabServer(disp);
+}
+
+void
+UngrabX()
+{
+   XUngrabServer(disp);
+   XFlush(disp);
+}
+#endif




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to