[nautilus] [eel] port eel-gdk-extensions to cairo drawing
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] [eel] port eel-gdk-extensions to cairo drawing
- Date: Fri, 13 Aug 2010 17:00:01 +0000 (UTC)
commit 917a27a6f69509720fadd0d50e40dbc87ae9f5d2
Author: Benjamin Otte <otte redhat com>
Date: Fri Aug 13 17:34:47 2010 +0200
[eel] port eel-gdk-extensions to cairo drawing
eel/eel-gdk-extensions.c | 89 +++++++--------------------------------------
eel/eel-gdk-extensions.h | 5 ---
2 files changed, 14 insertions(+), 80 deletions(-)
---
diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c
index 21b1351..1b0afb5 100644
--- a/eel/eel-gdk-extensions.c
+++ b/eel/eel-gdk-extensions.c
@@ -519,56 +519,6 @@ eel_gdk_color_is_dark (GdkColor *color)
}
/**
- * eel_stipple_bitmap_for_screen:
- *
- * Get pointer to 50% stippled bitmap suitable for use
- * on @screen. This is a global object; do not free.
- */
-GdkBitmap *
-eel_stipple_bitmap_for_screen (GdkScreen *screen)
-{
- static char stipple_bits[] = { 0x02, 0x01 };
- static GPtrArray *stipples = NULL;
- int screen_num, n_screens, i;
-
- if (stipples == NULL) {
- n_screens = gdk_display_get_n_screens (
- gdk_screen_get_display (screen));
- stipples = g_ptr_array_sized_new (n_screens);
-
- for (i = 0; i < n_screens; i++) {
- g_ptr_array_index (stipples, i) = NULL;
- }
- }
-
- screen_num = gdk_screen_get_number (screen);
-
- if (g_ptr_array_index (stipples, screen_num) == NULL) {
- g_ptr_array_index (stipples, screen_num) =
- gdk_bitmap_create_from_data (
- gdk_screen_get_root_window (screen),
- stipple_bits, 2, 2);
- }
-
- return g_ptr_array_index (stipples, screen_num);
-}
-
-/**
- * eel_stipple_bitmap:
- *
- * Get pointer to 50% stippled bitmap suitable for use
- * on the default screen. This is a global object; do
- * not free.
- *
- * This method is not multiscreen safe. Do not use it.
- */
-GdkBitmap *
-eel_stipple_bitmap (void)
-{
- return eel_stipple_bitmap_for_screen (gdk_screen_get_default ());
-}
-
-/**
* eel_gdk_window_bring_to_front:
*
* Raise window and give it focus.
@@ -652,28 +602,14 @@ eel_gdk_window_set_wm_hints_input (GdkWindow *window, gboolean status)
void
eel_gdk_window_set_invisible_cursor (GdkWindow *window)
{
- GdkBitmap *empty_bitmap;
GdkCursor *cursor;
- GdkColor useless;
- char invisible_cursor_bits[] = { 0x0 };
- useless.red = useless.green = useless.blue = 0;
- useless.pixel = 0;
-
- empty_bitmap = gdk_bitmap_create_from_data (window,
- invisible_cursor_bits,
- 1, 1);
-
- cursor = gdk_cursor_new_from_pixmap (empty_bitmap,
- empty_bitmap,
- &useless,
- &useless, 0, 0);
+ cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (window),
+ GDK_BLANK_CURSOR);
gdk_window_set_cursor (window, cursor);
gdk_cursor_unref (cursor);
-
- g_object_unref (empty_bitmap);
}
EelGdkGeometryFlags
@@ -717,22 +653,25 @@ eel_gdk_parse_geometry (const char *string, int *x_return, int *y_return,
void
eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable,
- GdkGC *gc,
GdkColor *text_color,
GdkColor *shadow_color,
int x,
int y,
PangoLayout *layout)
{
- gdk_draw_layout_with_colors (drawable, gc,
- x+1, y+1,
- layout,
- shadow_color, NULL);
+ cairo_t *cr;
+
+ cr = gdk_cairo_create (drawable);
+
+ gdk_cairo_set_source_color (cr, shadow_color);
+ cairo_move_to (cr, x+1, y+1);
+ pango_cairo_show_layout (cr, layout);
+
+ gdk_cairo_set_source_color (cr, text_color);
+ cairo_move_to (cr, x, y);
+ pango_cairo_show_layout (cr, layout);
- gdk_draw_layout_with_colors (drawable, gc,
- x, y,
- layout,
- text_color, NULL);
+ cairo_destroy (cr);
}
#if ! defined (EEL_OMIT_SELF_CHECK)
diff --git a/eel/eel-gdk-extensions.h b/eel/eel-gdk-extensions.h
index 9df8d04..459cd5a 100644
--- a/eel/eel-gdk-extensions.h
+++ b/eel/eel-gdk-extensions.h
@@ -119,10 +119,6 @@ char * eel_gdk_rgb_to_color_spec (guint32
gboolean eel_gdk_color_is_dark (GdkColor *color);
-/* A routine to get a 50% gray stippled bitmap for use in some types of highlighting. */
-GdkBitmap * eel_stipple_bitmap_for_screen (GdkScreen *screen);
-GdkBitmap * eel_stipple_bitmap (void);
-
/* Misc GdkRectangle helper functions */
gboolean eel_gdk_rectangle_contains_rectangle (GdkRectangle outer,
@@ -154,7 +150,6 @@ EelGdkGeometryFlags eel_gdk_parse_geometry (const char
guint *width_return,
guint *height_return);
void eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable,
- GdkGC *gc,
GdkColor *text_color,
GdkColor *shadow_color,
int x,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]