summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-background.c
diff options
context:
space:
mode:
authorMike Engber <engber@src.gnome.org>2001-01-08 22:42:04 +0000
committerMike Engber <engber@src.gnome.org>2001-01-08 22:42:04 +0000
commitcb4e04ca3e4afa653615f65706b56b060538a10d (patch)
treee61fe9fd9dfa5f5dbaed5254bf4302b3d405df17 /libnautilus-private/nautilus-background.c
parentd226c4acdc62cb4ba084c4e095caddef20894739 (diff)
downloadnautilus-cb4e04ca3e4afa653615f65706b56b060538a10d.tar.gz
Draw sidebar gradients dithered to avoid striation - bug 5458.
* libnautilus-extensions/nautilus-background.c: (nautilus_background_draw), (nautilus_background_is_too_complex_for_gtk_style), (nautilus_background_is_dark): * src/nautilus-sidebar.c: (background_settings_changed_callback), (nautilus_sidebar_update_appearance): Draw sidebar gradients dithered to avoid striation - bug 5458.
Diffstat (limited to 'libnautilus-private/nautilus-background.c')
-rw-r--r--libnautilus-private/nautilus-background.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/libnautilus-private/nautilus-background.c b/libnautilus-private/nautilus-background.c
index a69836078..b7cfb52ff 100644
--- a/libnautilus-private/nautilus-background.c
+++ b/libnautilus-private/nautilus-background.c
@@ -755,6 +755,19 @@ nautilus_background_draw (NautilusBackground *background,
g_return_if_fail (NAUTILUS_IS_BACKGROUND (background));
+ /* Combine mode is currently used only by the sidebar. It allocates a pixbuf
+ * on every draw, so further spread of its use should not be encouraged.
+ *
+ * Combine mode allows the sidebar, regardless of aa mode, to alpha composite
+ * an image over a color (an effect utilized by the sidebar in some themes)
+ * and avoid striations in gradients by using dithering.
+ *
+ * FIXME bugzila.eazel.com 5516:
+ * The whole combine mode concept could be elimintated by some minor refactoring that
+ * would basically move the code below to a place used only by nautilus_background_draw_flat_box.
+ * Also, the various pieces of code that manage the combine setting could be elimintated
+ * from nautilus-sidebar and nautilus-directory-background.
+ */
if (background->details->combine_mode) {
GdkPixbuf *pixbuf;
GnomeCanvasBuf buffer;
@@ -773,7 +786,7 @@ nautilus_background_draw (NautilusBackground *background,
0, 0,
0, 0,
drawable_width, drawable_height,
- GDK_RGB_DITHER_NONE, 0, 0);
+ GDK_RGB_DITHER_MAX, 0, 0);
/* free things up and we're done */
gdk_pixbuf_unref (pixbuf);
@@ -1419,7 +1432,7 @@ nautilus_background_is_too_complex_for_gtk_style (NautilusBackground *background
if (background->details->image_uri != NULL) {
return TRUE;
}
- if (nautilus_gradient_is_gradient (background->details->color)) {
+ if (!background->details->is_solid_color) {
return TRUE;
}
@@ -1439,8 +1452,9 @@ nautilus_background_is_dark (NautilusBackground *background)
if (background->details->image != NULL) {
nautilus_gdk_pixbuf_average_value (background->details->image, &color);
-
- } else if (nautilus_gradient_is_gradient (background->details->color)) {
+ } else if (background->details->is_solid_color) {
+ nautilus_gdk_color_parse_with_white_default (background->details->color, &color);
+ } else {
start_color_spec = nautilus_gradient_get_start_color_spec (background->details->color);
end_color_spec = nautilus_gradient_get_end_color_spec (background->details->color);
@@ -1453,8 +1467,6 @@ nautilus_background_is_dark (NautilusBackground *background)
g_free (end_color_spec);
return (intensity + intensity2) < 320;
- } else {
- nautilus_gdk_color_parse_with_white_default (background->details->color, &color);
}
intensity = (((color.red >> 8) * 77) + ((color.green >> 8) * 150) + ((color.blue >> 8) * 28)) >> 8;