forked from AuroraMiddleware/gtk
Add gdk_draw_rectangle_alpha_libgtk_only which uses XRenderFillRectangle
2004-07-27 Anders Carlsson <andersca@gnome.org> * demos/gtk-demo/iconview.c: (do_iconview): * gdk/gdkdrawable.h: * gdk/linux-fb/gdkdrawable-fb2.c: (gdk_draw_rectangle_alpha_libgtk_only): * gdk/win32/gdkdrawable-win32.c: (gdk_draw_rectangle_alpha_libgtk_only): * gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image), (get_impl_drawable), (gdk_x11_draw_pixbuf), (gdk_draw_rectangle_alpha_libgtk_only): Add gdk_draw_rectangle_alpha_libgtk_only which uses XRenderFillRectangle on X11. It's stubbed out on the Win32 and fb backends. * gtk/gtkiconview.c: (gtk_icon_view_paint_rubberband): Use gdk_draw_rectangle_alpha_libgtk_only here.
This commit is contained in:
parent
c5541ca6c8
commit
564ab37a07
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
2004-07-27 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* demos/gtk-demo/iconview.c: (do_iconview):
|
||||
* gdk/gdkdrawable.h:
|
||||
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
* gdk/win32/gdkdrawable-win32.c:
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
* gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image),
|
||||
(get_impl_drawable), (gdk_x11_draw_pixbuf),
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
Add gdk_draw_rectangle_alpha_libgtk_only which uses
|
||||
XRenderFillRectangle on X11. It's stubbed out on the
|
||||
Win32 and fb backends.
|
||||
|
||||
* gtk/gtkiconview.c:
|
||||
(gtk_icon_view_paint_rubberband):
|
||||
Use gdk_draw_rectangle_alpha_libgtk_only here.
|
||||
|
||||
2004-07-27 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* gtk/gtkaboutdialog.c: (gtk_about_dialog_init),
|
||||
|
@ -1,3 +1,22 @@
|
||||
2004-07-27 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* demos/gtk-demo/iconview.c: (do_iconview):
|
||||
* gdk/gdkdrawable.h:
|
||||
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
* gdk/win32/gdkdrawable-win32.c:
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
* gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image),
|
||||
(get_impl_drawable), (gdk_x11_draw_pixbuf),
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
Add gdk_draw_rectangle_alpha_libgtk_only which uses
|
||||
XRenderFillRectangle on X11. It's stubbed out on the
|
||||
Win32 and fb backends.
|
||||
|
||||
* gtk/gtkiconview.c:
|
||||
(gtk_icon_view_paint_rubberband):
|
||||
Use gdk_draw_rectangle_alpha_libgtk_only here.
|
||||
|
||||
2004-07-27 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* gtk/gtkaboutdialog.c: (gtk_about_dialog_init),
|
||||
|
@ -1,3 +1,22 @@
|
||||
2004-07-27 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* demos/gtk-demo/iconview.c: (do_iconview):
|
||||
* gdk/gdkdrawable.h:
|
||||
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
* gdk/win32/gdkdrawable-win32.c:
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
* gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image),
|
||||
(get_impl_drawable), (gdk_x11_draw_pixbuf),
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
Add gdk_draw_rectangle_alpha_libgtk_only which uses
|
||||
XRenderFillRectangle on X11. It's stubbed out on the
|
||||
Win32 and fb backends.
|
||||
|
||||
* gtk/gtkiconview.c:
|
||||
(gtk_icon_view_paint_rubberband):
|
||||
Use gdk_draw_rectangle_alpha_libgtk_only here.
|
||||
|
||||
2004-07-27 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* gtk/gtkaboutdialog.c: (gtk_about_dialog_init),
|
||||
|
@ -1,3 +1,22 @@
|
||||
2004-07-27 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* demos/gtk-demo/iconview.c: (do_iconview):
|
||||
* gdk/gdkdrawable.h:
|
||||
* gdk/linux-fb/gdkdrawable-fb2.c:
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
* gdk/win32/gdkdrawable-win32.c:
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
* gdk/x11/gdkdrawable-x11.c: (gdk_x11_draw_image),
|
||||
(get_impl_drawable), (gdk_x11_draw_pixbuf),
|
||||
(gdk_draw_rectangle_alpha_libgtk_only):
|
||||
Add gdk_draw_rectangle_alpha_libgtk_only which uses
|
||||
XRenderFillRectangle on X11. It's stubbed out on the
|
||||
Win32 and fb backends.
|
||||
|
||||
* gtk/gtkiconview.c:
|
||||
(gtk_icon_view_paint_rubberband):
|
||||
Use gdk_draw_rectangle_alpha_libgtk_only here.
|
||||
|
||||
2004-07-27 Anders Carlsson <andersca@gnome.org>
|
||||
|
||||
* gtk/gtkaboutdialog.c: (gtk_about_dialog_init),
|
||||
|
@ -320,6 +320,8 @@ do_iconview (GtkWidget *do_widget)
|
||||
fill_store (store);
|
||||
|
||||
icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (store));
|
||||
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view),
|
||||
GTK_SELECTION_MULTIPLE);
|
||||
g_object_unref (store);
|
||||
|
||||
/* Connect to the "clicked" signal of the "Up" tool button */
|
||||
|
@ -360,6 +360,15 @@ GdkImage *gdk_drawable_copy_to_image (GdkDrawable *drawable,
|
||||
GdkRegion *gdk_drawable_get_clip_region (GdkDrawable *drawable);
|
||||
GdkRegion *gdk_drawable_get_visible_region (GdkDrawable *drawable);
|
||||
|
||||
|
||||
gboolean gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkColor *color,
|
||||
guint16 alpha);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
@ -1643,3 +1643,15 @@ gdk_shadow_fb_draw_lines (GdkDrawable *drawable,
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkColor *color,
|
||||
guint16 alpha)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1822,3 +1822,15 @@ gdk_win32_drawable_get_handle (GdkDrawable *drawable)
|
||||
{
|
||||
return GDK_DRAWABLE_HANDLE (drawable);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkColor *color,
|
||||
guint16 alpha)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -846,7 +846,7 @@ static GdkDrawable * get_impl_drawable (GdkDrawable *drawable)
|
||||
GdkDrawable *impl;
|
||||
|
||||
if (GDK_IS_WINDOW (drawable))
|
||||
impl = ((GdkPixmapObject *)drawable)->impl;
|
||||
impl = ((GdkWindowObject *)drawable)->impl;
|
||||
else if (GDK_IS_PIXMAP (drawable))
|
||||
impl = ((GdkPixmapObject *)drawable)->impl;
|
||||
else
|
||||
@ -1456,3 +1456,68 @@ gdk_x11_draw_pixbuf (GdkDrawable *drawable,
|
||||
rowstride,
|
||||
dest_x, dest_y, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_rectangle_alpha_libgtk_only:
|
||||
* @drawable: The #GdkDrawable to draw on
|
||||
* @x: the x coordinate of the left edge of the rectangle.
|
||||
* @y: the y coordinate of the top edge of the rectangle.
|
||||
* @width: the width of the rectangle.
|
||||
* @height: the height of the rectangle.
|
||||
* @color: The color
|
||||
* @alpha: The alpha value.
|
||||
*
|
||||
* Tries to draw a filled alpha blended rectangle using the window
|
||||
* system's native routines. This is not public API and must not be
|
||||
* used by applications.
|
||||
*
|
||||
* Return value: TRUE if the rectangle could be drawn, FALSE
|
||||
* otherwise.
|
||||
**/
|
||||
gboolean
|
||||
gdk_draw_rectangle_alpha_libgtk_only (GdkDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkColor *color,
|
||||
guint16 alpha)
|
||||
{
|
||||
Display *xdisplay;
|
||||
XRenderColor render_color;
|
||||
Picture pict;
|
||||
int x_offset, y_offset;
|
||||
GdkDrawable *real_drawable, *impl;
|
||||
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
|
||||
if (!GDK_IS_WINDOW (drawable))
|
||||
return FALSE;
|
||||
|
||||
if (!_gdk_x11_have_render (gdk_drawable_get_display (drawable)))
|
||||
return FALSE;
|
||||
|
||||
gdk_window_get_internal_paint_info (GDK_WINDOW (drawable),
|
||||
&real_drawable,
|
||||
&x_offset, &y_offset);
|
||||
|
||||
impl = ((GdkWindowObject *)real_drawable)->impl;
|
||||
|
||||
pict = gdk_x11_drawable_get_picture (impl);
|
||||
|
||||
if (pict == None)
|
||||
return FALSE;
|
||||
|
||||
xdisplay = GDK_DISPLAY_XDISPLAY (gdk_drawable_get_display (drawable));
|
||||
|
||||
render_color.alpha = alpha;
|
||||
render_color.red = color->red * render_color.alpha / 0xffff;
|
||||
render_color.green = color->green * render_color.alpha / 0xffff;
|
||||
render_color.blue = color->blue * render_color.alpha / 0xffff;
|
||||
|
||||
XRenderFillRectangle (xdisplay,
|
||||
PictOpOver, pict, &render_color,
|
||||
x - x_offset, y - y_offset,
|
||||
width, height);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -173,7 +173,6 @@ static gboolean gtk_icon_view_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
static gboolean gtk_icon_view_button_release (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
|
||||
/* GtkIconView signals */
|
||||
static void gtk_icon_view_set_adjustments (GtkIconView *icon_view,
|
||||
GtkAdjustment *hadj,
|
||||
@ -736,8 +735,6 @@ gtk_icon_view_realize (GtkWidget *widget)
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
gdk_window_set_background (icon_view->priv->bin_window, &widget->style->base[widget->state]);
|
||||
gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1067,7 +1064,6 @@ gtk_icon_view_button_release (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_icon_view_update_rubberband (gpointer data)
|
||||
{
|
||||
@ -1888,6 +1884,11 @@ gtk_icon_view_paint_rubberband (GtkIconView *icon_view,
|
||||
|
||||
fill_color = gtk_gdk_color_to_rgb (fill_color_gdk) << 8 | fill_color_alpha;
|
||||
|
||||
if (!gdk_draw_rectangle_alpha_libgtk_only (icon_view->priv->bin_window,
|
||||
rect.x, rect.y, rect.width, rect.height,
|
||||
fill_color_gdk,
|
||||
fill_color_alpha << 8 | fill_color_alpha))
|
||||
{
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, rect.width, rect.height);
|
||||
gdk_pixbuf_fill (pixbuf, fill_color);
|
||||
|
||||
@ -1898,6 +1899,8 @@ gtk_icon_view_paint_rubberband (GtkIconView *icon_view,
|
||||
GDK_RGB_DITHER_NONE,
|
||||
0, 0);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
gc = gdk_gc_new (icon_view->priv->bin_window);
|
||||
gdk_gc_set_rgb_fg_color (gc, fill_color_gdk);
|
||||
gdk_gc_set_clip_rectangle (gc, &rect);
|
||||
|
Loading…
Reference in New Issue
Block a user