summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-03-14 18:55:09 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-03-14 18:55:09 +0100
commit838d69baab20fd545b9788bf1ddd734c2ab14a7d (patch)
tree19b68af81a125f9a260ee9718a9ec074d14376bd
parent7f9b9b0ec979c9f35c1b922412c7b2731a3a6c66 (diff)
downloadcv-838d69baab20fd545b9788bf1ddd734c2ab14a7d.tar.gz
cv-838d69baab20fd545b9788bf1ddd734c2ab14a7d.tar.bz2
cv-838d69baab20fd545b9788bf1ddd734c2ab14a7d.zip
util: Be faster by disabling asserts and alpha
-rw-r--r--util.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/util.c b/util.c
index 03551b5..76df227 100644
--- a/util.c
+++ b/util.c
@@ -8,9 +8,11 @@
*/
guchar *pixbuf_point(GdkPixbuf *pixbuf, point_t point)
{
+#if 0
g_assert(point.x >= 0 && point.x < gdk_pixbuf_get_width (pixbuf));
g_assert(point.y >= 0 && point.y < gdk_pixbuf_get_height(pixbuf));
g_assert(gdk_pixbuf_get_bits_per_sample(pixbuf) == 8);
+#endif
return gdk_pixbuf_get_pixels(pixbuf)
+ point.y * gdk_pixbuf_get_rowstride (pixbuf)
@@ -19,30 +21,36 @@ guchar *pixbuf_point(GdkPixbuf *pixbuf, point_t point)
void put_pixel(GdkPixbuf *pixbuf, point_t point, color_t color)
{
- const gint n_channels = gdk_pixbuf_get_n_channels(pixbuf);
+ //const gint n_channels = gdk_pixbuf_get_n_channels(pixbuf);
+#if 0
g_assert(n_channels == 4 || n_channels == 3);
g_assert(gdk_pixbuf_get_colorspace(pixbuf) == GDK_COLORSPACE_RGB);
g_assert(gdk_pixbuf_get_bits_per_sample(pixbuf) == 8);
+#endif
guchar *p = pixbuf_point(pixbuf, point);
p[0] = color.r;
p[1] = color.g;
p[2] = color.b;
+#if 0
if (n_channels == 4)
p[3] = color.a;
+#endif
}
color_t get_pixel(GdkPixbuf *pixbuf, point_t point)
{
- const gint n_channels = gdk_pixbuf_get_n_channels(pixbuf);
+ //const gint n_channels = gdk_pixbuf_get_n_channels(pixbuf);
+#if 0
g_assert(gdk_pixbuf_get_colorspace(pixbuf) == GDK_COLORSPACE_RGB);
g_assert(gdk_pixbuf_get_bits_per_sample(pixbuf) == 8);
g_assert(n_channels == 4 || n_channels == 3);
+#endif
guchar *p = pixbuf_point(pixbuf, point);
- return COLOR(p[0], p[1], p[2], n_channels == 4 ? p[3] : COL_MAX);
+ return COLOR(p[0], p[1], p[2], 0 /*n_channels == 4 ? p[3] : COL_MAX*/);
}
void color_to_yiq(color_t color, guint8 *y, guint8 *i, guint8 *q)