summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-01-28 05:34:17 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-01-28 05:34:17 +0000
commit6090d199a5ccf44c2777b66e13254754c8486e0c (patch)
tree3a43cedd0b1b1da95b767621ed95aa738f9b0682 /modules
parent624b01a92e5d435e67bc2ed29ce09a103925d1ee (diff)
downloadgdk-pixbuf-6090d199a5ccf44c2777b66e13254754c8486e0c.tar.gz
Optimize the case where a component is entirely transparent by skipping
Sun Jan 27 23:58:13 2002 Owen Taylor <otaylor@redhat.com> * pixbuf-render.c (compute_hint): Optimize the case where a component is entirely transparent by skipping drawing it. * pixbuf-rc-style.c (theme_parse_image): Catch case where background or overlay border/stretch are specified without a background image. * pixbuf-render.c (theme_pixbuf_destroy): Actually free the structure and filename.
Diffstat (limited to 'modules')
-rw-r--r--modules/engines/pixbuf/ChangeLog13
-rw-r--r--modules/engines/pixbuf/Makefile.am4
-rw-r--r--modules/engines/pixbuf/pixbuf-draw.c3
-rw-r--r--modules/engines/pixbuf/pixbuf-rc-style.c14
-rw-r--r--modules/engines/pixbuf/pixbuf-render.c26
-rw-r--r--modules/engines/pixbuf/pixbuf.h3
6 files changed, 55 insertions, 8 deletions
diff --git a/modules/engines/pixbuf/ChangeLog b/modules/engines/pixbuf/ChangeLog
index cc8e0f4e1..b1cc57482 100644
--- a/modules/engines/pixbuf/ChangeLog
+++ b/modules/engines/pixbuf/ChangeLog
@@ -1,3 +1,16 @@
+Sun Jan 27 23:58:13 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pixbuf-render.c (compute_hint): Optimize the case
+ where a component is entirely transparent by skipping
+ drawing it.
+
+ * pixbuf-rc-style.c (theme_parse_image): Catch case
+ where background or overlay border/stretch are specified
+ without a background image.
+
+ * pixbuf-render.c (theme_pixbuf_destroy): Actually free
+ the structure and filename.
+
=================== Move back into gtk-engines ====================
Sat Jan 19 02:45:17 2002 Owen Taylor <otaylor@redhat.com>
diff --git a/modules/engines/pixbuf/Makefile.am b/modules/engines/pixbuf/Makefile.am
index 22bb327e8..d3e6bdef4 100644
--- a/modules/engines/pixbuf/Makefile.am
+++ b/modules/engines/pixbuf/Makefile.am
@@ -14,3 +14,7 @@ libpixmap_la_SOURCES = \
pixbuf.h
libpixmap_la_LDFLAGS = -avoid-version -module
+
+dist-hook:
+ cp -pr examples $(distdir); \
+ find $(distdir)/examples -name 'CVS' -print | xargs rm -rf
diff --git a/modules/engines/pixbuf/pixbuf-draw.c b/modules/engines/pixbuf/pixbuf-draw.c
index ab192a446..2fe5bc641 100644
--- a/modules/engines/pixbuf/pixbuf-draw.c
+++ b/modules/engines/pixbuf/pixbuf-draw.c
@@ -659,9 +659,10 @@ draw_box (GtkStyle *style,
match_data.state = state;
if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, TRUE,
- x, y, width, height))
+ x, y, width, height)) {
parent_class->draw_box (style, window, state, shadow, area, widget, detail,
x, y, width, height);
+ }
}
static void
diff --git a/modules/engines/pixbuf/pixbuf-rc-style.c b/modules/engines/pixbuf/pixbuf-rc-style.c
index 6fbb92fb1..210b0f525 100644
--- a/modules/engines/pixbuf/pixbuf-rc-style.c
+++ b/modules/engines/pixbuf/pixbuf-rc-style.c
@@ -664,6 +664,20 @@ theme_parse_image(GtkSettings *settings,
token = g_scanner_get_next_token(scanner);
+ if (data->background && !data->background->filename)
+ {
+ g_scanner_warn (scanner, "Background image options specified without filename");
+ theme_pixbuf_destroy (data->background);
+ data->background = NULL;
+ }
+
+ if (data->overlay && !data->overlay->filename)
+ {
+ g_scanner_warn (scanner, "Overlay image options specified without filename");
+ theme_pixbuf_destroy (data->overlay);
+ data->overlay = NULL;
+ }
+
if (token != G_TOKEN_RIGHT_CURLY)
{
/* error - cleanup for exit */
diff --git a/modules/engines/pixbuf/pixbuf-render.c b/modules/engines/pixbuf/pixbuf-render.c
index 08201f330..d34632b23 100644
--- a/modules/engines/pixbuf/pixbuf-render.c
+++ b/modules/engines/pixbuf/pixbuf-render.c
@@ -180,6 +180,9 @@ pixbuf_render (GdkPixbuf *src,
rect.width = dest_width;
rect.height = dest_height;
+ if (hints & THEME_MISSING)
+ return;
+
/* FIXME: Because we use the mask to shape windows, we don't use
* clip_rect to clip what we draw to the mask, only to clip
* what we actually draw. But this leads to the horrible ineffiency
@@ -290,8 +293,8 @@ theme_pixbuf_new (void)
void
theme_pixbuf_destroy (ThemePixbuf *theme_pb)
{
- if (theme_pb->pixbuf)
- g_cache_remove (pixbuf_cache, theme_pb->pixbuf);
+ theme_pixbuf_set_filename (theme_pb, NULL);
+ g_free (theme_pb);
}
void
@@ -307,7 +310,10 @@ theme_pixbuf_set_filename (ThemePixbuf *theme_pb,
if (theme_pb->filename)
g_free (theme_pb->filename);
- theme_pb->filename = g_strdup (filename);
+ if (filename)
+ theme_pb->filename = g_strdup (filename);
+ else
+ theme_pb->filename = NULL;
}
static guint
@@ -318,7 +324,7 @@ compute_hint (GdkPixbuf *pixbuf,
gint y1)
{
int i, j;
- int hints = THEME_CONSTANT_ROWS | THEME_CONSTANT_COLS;
+ int hints = THEME_CONSTANT_ROWS | THEME_CONSTANT_COLS | THEME_MISSING;
int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
guchar *data = gdk_pixbuf_get_pixels (pixbuf);
@@ -340,13 +346,21 @@ compute_hint (GdkPixbuf *pixbuf,
for (j = x0 + 1; j < x1 ; j++)
{
+ if (n_channels != 4 || p[4] != 0)
+ {
+ hints &= ~THEME_MISSING;
+ if (!(hints & THEME_CONSTANT_ROWS))
+ goto cols;
+ }
+
if (r != *(p++) ||
g != *(p++) ||
b != *(p++) ||
- (n_channels == 4 && a != *(p++)))
+ (n_channels != 4 && a != *(p++)))
{
hints &= ~THEME_CONSTANT_ROWS;
- goto cols;
+ if (!(hints & THEME_MISSING))
+ goto cols;
}
}
}
diff --git a/modules/engines/pixbuf/pixbuf.h b/modules/engines/pixbuf/pixbuf.h
index 34dfeb61c..2638fc87b 100644
--- a/modules/engines/pixbuf/pixbuf.h
+++ b/modules/engines/pixbuf/pixbuf.h
@@ -121,7 +121,8 @@ typedef enum {
typedef enum {
THEME_CONSTANT_ROWS = 1 << 0,
- THEME_CONSTANT_COLS = 1 << 1
+ THEME_CONSTANT_COLS = 1 << 1,
+ THEME_MISSING = 1 << 2
} ThemeRenderHints;
struct _ThemePixbuf