[gnome-mag/cairo-port: 2/8] Remove recoloring code
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-mag/cairo-port: 2/8] Remove recoloring code
- Date: Fri, 13 Aug 2010 02:29:38 +0000 (UTC)
commit e9153c72a0ef56a8d5b8e373d06b556d2280e1e8
Author: Benjamin Otte <otte redhat com>
Date: Fri Aug 13 01:28:15 2010 +0200
Remove recoloring code
The code was broken and just did not work.
magnifier/magnifier.c | 57 +------------------------------------------------
magnifier/magnifier.h | 1 -
2 files changed, 1 insertions(+), 57 deletions(-)
---
diff --git a/magnifier/magnifier.c b/magnifier/magnifier.c
index fb9a605..c775fd9 100644
--- a/magnifier/magnifier.c
+++ b/magnifier/magnifier.c
@@ -53,7 +53,6 @@ enum {
MAGNIFIER_CURSOR_SET_PROP,
MAGNIFIER_CURSOR_SIZE_PROP,
MAGNIFIER_CURSOR_ZOOM_PROP,
- MAGNIFIER_CURSOR_COLOR_PROP,
MAGNIFIER_CURSOR_HOTSPOT_PROP,
MAGNIFIER_CURSOR_DEFAULT_SIZE_PROP,
MAGNIFIER_CROSSWIRE_SIZE_PROP,
@@ -584,39 +583,6 @@ magnifier_exit (GtkObject *object)
exit (0);
}
-#define GET_PIXEL(a,i,j,s,b) \
-(*(guint32 *)(memcpy (b,(a) + ((j) * s + (i) * pixel_size_t), pixel_size_t)))
-
-#define PUT_PIXEL(a,i,j,s,b) \
-(memcpy (a + ((j) * s + (i) * pixel_size_t), &(b), pixel_size_t))
-
-static void
-magnifier_recolor_pixbuf (Magnifier *magnifier, GdkPixbuf *pixbuf)
-{
- int rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- int i, j;
- int w = gdk_pixbuf_get_width (pixbuf);
- int h = gdk_pixbuf_get_height (pixbuf);
- guchar *pixels = gdk_pixbuf_get_pixels (pixbuf);
- guint32 pixval = 0, cursor_color = 0;
- size_t pixel_size_t = 3; /* FIXME: invalid assumption ? */
-
- cursor_color = ((magnifier->cursor_color & 0xFF0000) >> 16) +
- (magnifier->cursor_color & 0x00FF00) +
- ((magnifier->cursor_color & 0x0000FF) << 16);
- for (j = 0; j < h; ++j) {
- for (i = 0; i < w; ++i) {
- pixval = GET_PIXEL (pixels, i, j, rowstride, &pixval);
- if ((pixval & 0x808080) == 0)
- {
- pixval = cursor_color;
- PUT_PIXEL (pixels, i, j, rowstride,
- pixval);
- }
- }
- }
-}
-
void
magnifier_transform_cursor (Magnifier *magnifier)
{
@@ -647,8 +613,7 @@ magnifier_transform_cursor (Magnifier *magnifier)
magnifier->cursor_scale_factor;
}
gdk_drawable_get_size (magnifier->priv->cursor, &width, &height);
- if ((size_x == width) && (size_y == height)
- && (magnifier->cursor_color == 0xFF000000)) {
+ if ((size_x == width) && (size_y == height)) {
return; /* nothing changes */
}
cgc = gdk_gc_new (cursor_pixmap);
@@ -656,8 +621,6 @@ magnifier_transform_cursor (Magnifier *magnifier)
cursor_pixbuf = gdk_pixbuf_get_from_drawable (NULL, cursor_pixmap,
NULL, 0, 0, 0, 0,
width, height);
- if (magnifier->cursor_color != 0xFF000000)
- magnifier_recolor_pixbuf (magnifier, cursor_pixbuf);
mask_pixbuf = gdk_pixbuf_get_from_drawable (NULL,
mask_pixmap,
NULL, 0, 0, 0, 0,
@@ -1000,8 +963,6 @@ get_property_cb (GDBusConnection *connection,
retval = g_variant_new_array (G_VARIANT_TYPE_INT32, children, 2);
} else if (g_strcmp0 (property_name, "CursorZoom") == 0) {
retval = g_variant_new_double (magnifier->cursor_scale_factor);
- } else if (g_strcmp0 (property_name, "CursorColor") == 0) {
- retval = g_variant_new_uint32 (magnifier->cursor_color);
} else if (g_strcmp0 (property_name, "CursorHotspot") == 0) {
GVariant *children[2];
@@ -1243,9 +1204,6 @@ magnifier_gobject_get_property (GObject *object,
case MAGNIFIER_CURSOR_ZOOM_PROP:
g_value_set_float (value, magnifier->cursor_scale_factor);
break;
- case MAGNIFIER_CURSOR_COLOR_PROP:
- g_value_set_ulong (value, magnifier->cursor_color);
- break;
case MAGNIFIER_CURSOR_HOTSPOT_PROP: {
Point *point = g_new (Point, 1);
@@ -1470,11 +1428,6 @@ magnifier_gobject_set_property (GObject *object,
DBG (fprintf (stderr, "Setting cursor scale factor: \t%f\n", (float) magnifier->cursor_scale_factor));
magnifier_transform_cursor (magnifier);
break;
- case MAGNIFIER_CURSOR_COLOR_PROP:
- magnifier->cursor_color = g_value_get_ulong (value);
- magnifier_transform_cursor (magnifier);
- DBG (fprintf (stderr, "Setting cursor color: \t%u\n", (unsigned) magnifier->cursor_color));
- break;
case MAGNIFIER_CURSOR_HOTSPOT_PROP: {
Point *point = g_value_get_pointer (value);
@@ -1517,7 +1470,6 @@ magnifier_init (Magnifier *magnifier)
magnifier->priv = MAGNIFIER_GET_PRIVATE (magnifier);
magnifier->cursor_scale_factor = 1.0F;
- magnifier->cursor_color = 0xFF000000;
magnifier->crosswire_size = 1;
magnifier->priv->use_source_cursor = TRUE;
magnifier_init_cursor_set (magnifier, "default");
@@ -1623,13 +1575,6 @@ magnifier_class_init (MagnifierClass *klass)
0, G_MAXFLOAT, 1.0F,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
- MAGNIFIER_CURSOR_COLOR_PROP,
- g_param_spec_ulong ("cursor-color",
- "CursorColor",
- "foreground color for 1-bit cursors, as ARGB",
- 0, G_MAXULONG, 0xFF000000,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
MAGNIFIER_CURSOR_HOTSPOT_PROP,
g_param_spec_pointer ("cursor-hotspot",
"CursorHotspot",
diff --git a/magnifier/magnifier.h b/magnifier/magnifier.h
index 905ffc7..6885462 100644
--- a/magnifier/magnifier.h
+++ b/magnifier/magnifier.h
@@ -59,7 +59,6 @@ typedef struct {
gchar *cursor_set;
gint cursor_size_x;
gint cursor_size_y;
- guint32 cursor_color;
float cursor_scale_factor;
RectBounds source_bounds;
RectBounds target_bounds;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]