freesci-develop
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freesci-develop] r1561 - in freesci/trunk: . src/gfx src/gfx/drivers sr


From: freesci
Subject: [freesci-develop] r1561 - in freesci/trunk: . src/gfx src/gfx/drivers src/include
Date: Sun, 19 Feb 2006 20:27:50 +0100

Author: jameson
Date: 2006-02-19 20:27:44 +0100 (Sun, 19 Feb 2006)
New Revision: 1561

Modified:
   freesci/trunk/ChangeLog
   freesci/trunk/TODO
   freesci/trunk/src/gfx/drivers/xlib_driver.c
   freesci/trunk/src/gfx/gfx_support.c
   freesci/trunk/src/include/gfx_driver.h
Log:
* Updated TODO list
* Moved pointer computations to gfx_support.c as per the patch sent to 
  Alex

-- Christoph



Modified: freesci/trunk/ChangeLog
===================================================================
--- freesci/trunk/ChangeLog     2006-02-18 07:18:10 UTC (rev 1560)
+++ freesci/trunk/ChangeLog     2006-02-19 19:27:44 UTC (rev 1561)
@@ -64,6 +64,10 @@
 
 2006-02-05  Christoph Reichenbach  <address@hidden>
 
+       * src/gfx/gfx_support.c (gfx_create_mono_cursor_mask): Relocated
+       cursor bitmask computation to a place where it is more easily
+       re-usable
+
        * src/scicore/resource.c (scir_unlock_resource): Swapped
        parameters to correspond to prototype.
 

Modified: freesci/trunk/TODO
===================================================================
--- freesci/trunk/TODO  2006-02-18 07:18:10 UTC (rev 1560)
+++ freesci/trunk/TODO  2006-02-19 19:27:44 UTC (rev 1561)
@@ -2,13 +2,17 @@
 
 Primary goals:
        * update calle, callk docs
+       * Address parser errors
+       * Add dynamic module system for gfx/PCM/midiout drivers
+       * A better domain-specific language for customising graphics
+       * Make sure all READMEs are present in the Makefile.ams
 
 Secondary goals:
-       + Change "version dependancies" to global "interpreter type flags"
-       + Add on-screen editor for sound mappings
+       * Change "version dependancies" to global "interpreter type flags"
+       * Add on-screen editor for sound mappings
        * docs: Mention words with class set to zero (no word).
-       * grammar.c: Replace proto-Earley parser with backtracking Earley
-       * Don't crash when loading SCI1 resources
+       + grammar.c: Replace proto-Earley parser with backtracking Earley
+       + Don't crash when loading SCI1 resources
 
 Bonus goals:
        + Add glx graphics driver

Modified: freesci/trunk/src/gfx/drivers/xlib_driver.c
===================================================================
--- freesci/trunk/src/gfx/drivers/xlib_driver.c 2006-02-18 07:18:10 UTC (rev 
1560)
+++ freesci/trunk/src/gfx/drivers/xlib_driver.c 2006-02-19 19:27:44 UTC (rev 
1561)
@@ -1020,50 +1020,6 @@
 
   /*** Mouse pointer operations ***/
 
-byte *
-xlib_create_cursor_data(gfx_driver_t *drv, gfx_pixmap_t *pointer, int mode)
-{
-       int linewidth = (pointer->xl + 7) >> 3;
-       int lines = pointer->yl;
-       int xc, yc;
-       int xfact = drv->mode->xfact;
-       byte *data = sci_calloc(linewidth, lines);
-       byte *linebase = data, *pos;
-       byte *src = pointer->index_data;
-
-
-       for (yc = 0; yc < pointer->index_yl; yc++) {
-               int scalectr;
-               int bitc = 0;
-               pos = linebase;
-
-
-               for (xc = 0; xc < pointer->index_xl; xc++) {
-                       int draw = mode?
-                               (*src == 0) : (*src < 255);
-
-                       for (scalectr = 0; scalectr < xfact; scalectr++) {
-                               if (draw)
-                                       *pos |= (1 << bitc);
-
-                               bitc++;
-                               if (bitc == 8) {
-                                       bitc = 0;
-                                       pos++;
-                               }
-                       }
-
-                       src++;
-               }
-               for (scalectr = 1; scalectr < drv->mode->yfact; scalectr++)
-                       memcpy(linebase + linewidth * scalectr, linebase, 
linewidth);
-
-               linebase += linewidth * drv->mode->yfact;
-       }
-
-       return data;
-}
-
 static int
 xlib_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer)
 {
@@ -1094,8 +1050,8 @@
                        cols[i].blue |= (cols[i].blue << 8);
                }
 
-               S->pointer_data[0] = visual_data = xlib_create_cursor_data(drv, 
pointer, 1);
-               S->pointer_data[1] = mask_data = xlib_create_cursor_data(drv, 
pointer, 0);
+               visual_data = gfx_create_mono_cursor_mask(pointer, 
drv->mode->xfact, drv->mode->yfact, 1);
+               mask_data = gfx_create_mono_cursor_mask(pointer, 
drv->mode->xfact, drv->mode->yfact, 0);
                S->pointer_data[0] = NULL;
                S->pointer_data[1] = NULL;
                visual = XCreateBitmapFromData(S->display, S->window, (char *) 
visual_data, real_xl, pointer->yl);

Modified: freesci/trunk/src/gfx/gfx_support.c
===================================================================
--- freesci/trunk/src/gfx/gfx_support.c 2006-02-18 07:18:10 UTC (rev 1560)
+++ freesci/trunk/src/gfx/gfx_support.c 2006-02-19 19:27:44 UTC (rev 1561)
@@ -394,3 +394,47 @@
 
 
 
+
+byte *
+gfx_create_mono_cursor_mask(gfx_pixmap_t *pointer, int xfact, int yfact, int 
mode)
+{
+       int linewidth = (pointer->xl + 7) >> 3;
+       int lines = pointer->yl;
+       int xc, yc;
+       byte *data = sci_calloc(linewidth, lines);
+       byte *linebase = data, *pos;
+       byte *src = pointer->index_data;
+
+
+       for (yc = 0; yc < pointer->index_yl; yc++) {
+               int scalectr;
+               int bitc = 0;
+               pos = linebase;
+
+
+               for (xc = 0; xc < pointer->index_xl; xc++) {
+                       int draw = mode?
+                               (*src == 0) : (*src < 
GFX_COLOR_INDEX_TRANSPARENT);
+
+                       for (scalectr = 0; scalectr < xfact; scalectr++) {
+                               if (draw)
+                                       *pos |= (1 << bitc);
+
+                               bitc++;
+                               if (bitc == 8) {
+                                       bitc = 0;
+                                       pos++;
+                               }
+                       }
+
+                       src++;
+               }
+               for (scalectr = 1; scalectr < yfact; scalectr++)
+                       memcpy(linebase + linewidth * scalectr, linebase, 
linewidth);
+
+               linebase += linewidth * yfact;
+       }
+
+       return data;
+}
+

Modified: freesci/trunk/src/include/gfx_driver.h
===================================================================
--- freesci/trunk/src/include/gfx_driver.h      2006-02-18 07:18:10 UTC (rev 
1560)
+++ freesci/trunk/src/include/gfx_driver.h      2006-02-19 19:27:44 UTC (rev 
1561)
@@ -414,7 +414,7 @@
 ** with 0 <= nr' < nr so that gfx_get_driver_name(nr') == NULL.
 */
 
-/*** Utility functions for set_parameter implementations */
+/*** Utility functions for set_parameter implementations ***/
 
 int
 string_truep(char *value);
@@ -433,5 +433,22 @@
 */
 
 
+/*** Utility functions for driver implementations ***/
+/* Cf. also gfx_support.c for line drawing facilities */
 
+byte *
+gfx_create_mono_cursor_mask(gfx_pixmap_t *pointer, int xfact, int yfact, int 
mode);
+/* Computes the bitmap(s) underlying a mouse pointer
+** Parameters: (gfx_pixmap_t *) pointer: Pixmap of the pointer whose index 
data will
+**                                       serve as source for the bitmaps
+**             (int x int) xfact, yfact: horizontal and vertical scaling 
factors
+**             (int) mode: If 0, compute the opaqueness map (1 means opaque, 0 
means transparent)
+**                         Otherwise, compute the "is-zero" map, useful for 
monochrome pointers which
+**                         only use transparency, 0, and 1.
+** Returns   : A freshly allocated bitmap matching the above specification. If
+**             (pointer->xl * xfact)  mod 8  > 0, then empty (zero) bits will 
be added for
+**             padding at the end of each bitmap line.
+*/
+
+
 #endif /* !_SCI_GFX_DRIVER_H_ */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]