forked from AuroraMiddleware/gtk
Use a GtkAlignment rather than a GtkDrawingArea to draw the swatch in to
2005-05-11 Owen Taylor <otaylor@redhat.com> * gtk/gtkcolorbutton.c: Use a GtkAlignment rather than a GtkDrawingArea to draw the swatch in to avoid having an extraneous window. * gtk/gtkcolorsel.c (color_sample_draw_sample): Actually se tthe color when !has_opacity. 2005-05-10 Owen Taylor <otaylor@redhat.com> * gdk/gdkcairo.[ch] gdk/gdkcolor.[ch] gdk/Makefile.am: Add source files for Cairo convenience functionality. * gdk/gdkcairo.h (gdk_cairo_rectangle, gdk_cairo_region): Add a convenience functions to add GdkRectangle, GdkRegion to a cairo path. * gdk/gdkwindow.c gdk/gdkgc.c gtk/gtkcolorsel.c gtk/gtkiconview.c gtk/gtkstyle.c: Use gdk_cairo_rectangle/region(). * gdk/gdkcairo.[ch] gdk/gdkdrawable.h gdk/gdkdraw.c: Rename gdk_drawable_create_cairo_context() to gdk_cairo_create(). * gdk/gdkcairo.c gdk/gdkpixbuf.h gdk/gdkpixbuf-render.c: Rename gdk_pixbuf_set_as_cairo_source() to gdk_cairo_set_source_pixbuf(). * gdk/gdkdraw.c gdk/gdkpango.c gtk/gtkcolorsel.c gtk/gtkhruler.c gtk/gtkhsv.c gtk/gtkiconview.c gtk/gtkstyle.c gtk/gtkvruler.c: Adjust for renames. * gdk/gdk.symbols: Update. * gtk/gtkwidget.c (gtk_widget_queue_shallow_draw): Fix coordinate system problem that was causing the wrong portions to be invalidated. * gtk/gtkcellrenderer.c (gtk_cell_renderer_render) gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render) gtk/gtkcellrendererprogress.c (gtk_cell_renderer_progress_render) gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render) gtk/gtkcellview.c (gtk_cell_view_expose) gtk/gtkdnd.c (gtk_drag_highlight_expose) gtk/gtkentry.c (gtk_entry_draw_text) gtk/gtktextview.c (text_window_invalidate_rect): Some cairoization. * gtk/gtkcalendar.[ch]: Beat into something roughly resembling GTK+ style ... use instance-private data and standard names for private structure, etc. Move function docs inline. * gtk/gtkcalendar.[ch]: Switch to drawing everything in expose. Switch drawing to Cairo. * gtk/gtkcalendar.c (gtk_calendar_freeze): Deprecate gtk_calendar_freeze/thaw
This commit is contained in:
parent
846972ba14
commit
dda40ca71a
55
ChangeLog
55
ChangeLog
@ -1,3 +1,58 @@
|
||||
2005-05-11 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcolorbutton.c: Use a GtkAlignment rather than a GtkDrawingArea
|
||||
to draw the swatch in to avoid having an extraneous window.
|
||||
|
||||
* gtk/gtkcolorsel.c (color_sample_draw_sample): Actually se tthe
|
||||
color when !has_opacity.
|
||||
|
||||
2005-05-10 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkcairo.[ch] gdk/gdkcolor.[ch] gdk/Makefile.am: Add source
|
||||
files for Cairo convenience functionality.
|
||||
|
||||
* gdk/gdkcairo.h (gdk_cairo_rectangle, gdk_cairo_region): Add a
|
||||
convenience functions to add GdkRectangle, GdkRegion to a cairo path.
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdkgc.c gtk/gtkcolorsel.c gtk/gtkiconview.c
|
||||
gtk/gtkstyle.c: Use gdk_cairo_rectangle/region().
|
||||
|
||||
* gdk/gdkcairo.[ch] gdk/gdkdrawable.h gdk/gdkdraw.c: Rename
|
||||
gdk_drawable_create_cairo_context() to gdk_cairo_create().
|
||||
|
||||
* gdk/gdkcairo.c gdk/gdkpixbuf.h gdk/gdkpixbuf-render.c:
|
||||
Rename gdk_pixbuf_set_as_cairo_source() to
|
||||
gdk_cairo_set_source_pixbuf().
|
||||
|
||||
* gdk/gdkdraw.c gdk/gdkpango.c gtk/gtkcolorsel.c gtk/gtkhruler.c
|
||||
gtk/gtkhsv.c gtk/gtkiconview.c gtk/gtkstyle.c gtk/gtkvruler.c:
|
||||
Adjust for renames.
|
||||
|
||||
* gdk/gdk.symbols: Update.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_queue_shallow_draw): Fix
|
||||
coordinate system problem that was causing the wrong portions
|
||||
to be invalidated.
|
||||
|
||||
* gtk/gtkcellrenderer.c (gtk_cell_renderer_render)
|
||||
gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render)
|
||||
gtk/gtkcellrendererprogress.c (gtk_cell_renderer_progress_render)
|
||||
gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render)
|
||||
gtk/gtkcellview.c (gtk_cell_view_expose)
|
||||
gtk/gtkdnd.c (gtk_drag_highlight_expose)
|
||||
gtk/gtkentry.c (gtk_entry_draw_text)
|
||||
gtk/gtktextview.c (text_window_invalidate_rect): Some cairoization.
|
||||
|
||||
* gtk/gtkcalendar.[ch]: Beat into something roughly resembling
|
||||
GTK+ style ... use instance-private data and standard names for
|
||||
private structure, etc. Move function docs inline.
|
||||
|
||||
* gtk/gtkcalendar.[ch]: Switch to drawing everything in
|
||||
expose. Switch drawing to Cairo.
|
||||
|
||||
* gtk/gtkcalendar.c (gtk_calendar_freeze): Deprecate
|
||||
gtk_calendar_freeze/thaw
|
||||
|
||||
2005-05-10 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting): Check
|
||||
|
@ -1,3 +1,58 @@
|
||||
2005-05-11 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcolorbutton.c: Use a GtkAlignment rather than a GtkDrawingArea
|
||||
to draw the swatch in to avoid having an extraneous window.
|
||||
|
||||
* gtk/gtkcolorsel.c (color_sample_draw_sample): Actually se tthe
|
||||
color when !has_opacity.
|
||||
|
||||
2005-05-10 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkcairo.[ch] gdk/gdkcolor.[ch] gdk/Makefile.am: Add source
|
||||
files for Cairo convenience functionality.
|
||||
|
||||
* gdk/gdkcairo.h (gdk_cairo_rectangle, gdk_cairo_region): Add a
|
||||
convenience functions to add GdkRectangle, GdkRegion to a cairo path.
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdkgc.c gtk/gtkcolorsel.c gtk/gtkiconview.c
|
||||
gtk/gtkstyle.c: Use gdk_cairo_rectangle/region().
|
||||
|
||||
* gdk/gdkcairo.[ch] gdk/gdkdrawable.h gdk/gdkdraw.c: Rename
|
||||
gdk_drawable_create_cairo_context() to gdk_cairo_create().
|
||||
|
||||
* gdk/gdkcairo.c gdk/gdkpixbuf.h gdk/gdkpixbuf-render.c:
|
||||
Rename gdk_pixbuf_set_as_cairo_source() to
|
||||
gdk_cairo_set_source_pixbuf().
|
||||
|
||||
* gdk/gdkdraw.c gdk/gdkpango.c gtk/gtkcolorsel.c gtk/gtkhruler.c
|
||||
gtk/gtkhsv.c gtk/gtkiconview.c gtk/gtkstyle.c gtk/gtkvruler.c:
|
||||
Adjust for renames.
|
||||
|
||||
* gdk/gdk.symbols: Update.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_queue_shallow_draw): Fix
|
||||
coordinate system problem that was causing the wrong portions
|
||||
to be invalidated.
|
||||
|
||||
* gtk/gtkcellrenderer.c (gtk_cell_renderer_render)
|
||||
gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render)
|
||||
gtk/gtkcellrendererprogress.c (gtk_cell_renderer_progress_render)
|
||||
gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render)
|
||||
gtk/gtkcellview.c (gtk_cell_view_expose)
|
||||
gtk/gtkdnd.c (gtk_drag_highlight_expose)
|
||||
gtk/gtkentry.c (gtk_entry_draw_text)
|
||||
gtk/gtktextview.c (text_window_invalidate_rect): Some cairoization.
|
||||
|
||||
* gtk/gtkcalendar.[ch]: Beat into something roughly resembling
|
||||
GTK+ style ... use instance-private data and standard names for
|
||||
private structure, etc. Move function docs inline.
|
||||
|
||||
* gtk/gtkcalendar.[ch]: Switch to drawing everything in
|
||||
expose. Switch drawing to Cairo.
|
||||
|
||||
* gtk/gtkcalendar.c (gtk_calendar_freeze): Deprecate
|
||||
gtk_calendar_freeze/thaw
|
||||
|
||||
2005-05-10 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting): Check
|
||||
|
@ -1,3 +1,58 @@
|
||||
2005-05-11 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkcolorbutton.c: Use a GtkAlignment rather than a GtkDrawingArea
|
||||
to draw the swatch in to avoid having an extraneous window.
|
||||
|
||||
* gtk/gtkcolorsel.c (color_sample_draw_sample): Actually se tthe
|
||||
color when !has_opacity.
|
||||
|
||||
2005-05-10 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/gdkcairo.[ch] gdk/gdkcolor.[ch] gdk/Makefile.am: Add source
|
||||
files for Cairo convenience functionality.
|
||||
|
||||
* gdk/gdkcairo.h (gdk_cairo_rectangle, gdk_cairo_region): Add a
|
||||
convenience functions to add GdkRectangle, GdkRegion to a cairo path.
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdkgc.c gtk/gtkcolorsel.c gtk/gtkiconview.c
|
||||
gtk/gtkstyle.c: Use gdk_cairo_rectangle/region().
|
||||
|
||||
* gdk/gdkcairo.[ch] gdk/gdkdrawable.h gdk/gdkdraw.c: Rename
|
||||
gdk_drawable_create_cairo_context() to gdk_cairo_create().
|
||||
|
||||
* gdk/gdkcairo.c gdk/gdkpixbuf.h gdk/gdkpixbuf-render.c:
|
||||
Rename gdk_pixbuf_set_as_cairo_source() to
|
||||
gdk_cairo_set_source_pixbuf().
|
||||
|
||||
* gdk/gdkdraw.c gdk/gdkpango.c gtk/gtkcolorsel.c gtk/gtkhruler.c
|
||||
gtk/gtkhsv.c gtk/gtkiconview.c gtk/gtkstyle.c gtk/gtkvruler.c:
|
||||
Adjust for renames.
|
||||
|
||||
* gdk/gdk.symbols: Update.
|
||||
|
||||
* gtk/gtkwidget.c (gtk_widget_queue_shallow_draw): Fix
|
||||
coordinate system problem that was causing the wrong portions
|
||||
to be invalidated.
|
||||
|
||||
* gtk/gtkcellrenderer.c (gtk_cell_renderer_render)
|
||||
gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_render)
|
||||
gtk/gtkcellrendererprogress.c (gtk_cell_renderer_progress_render)
|
||||
gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render)
|
||||
gtk/gtkcellview.c (gtk_cell_view_expose)
|
||||
gtk/gtkdnd.c (gtk_drag_highlight_expose)
|
||||
gtk/gtkentry.c (gtk_entry_draw_text)
|
||||
gtk/gtktextview.c (text_window_invalidate_rect): Some cairoization.
|
||||
|
||||
* gtk/gtkcalendar.[ch]: Beat into something roughly resembling
|
||||
GTK+ style ... use instance-private data and standard names for
|
||||
private structure, etc. Move function docs inline.
|
||||
|
||||
* gtk/gtkcalendar.[ch]: Switch to drawing everything in
|
||||
expose. Switch drawing to Cairo.
|
||||
|
||||
* gtk/gtkcalendar.c (gtk_calendar_freeze): Deprecate
|
||||
gtk_calendar_freeze/thaw
|
||||
|
||||
2005-05-10 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting): Check
|
||||
|
@ -27,11 +27,6 @@ gtk_calendar_set_display_options().
|
||||
The selected date can be retrieved from a #GtkCalendar using
|
||||
gtk_calendar_get_date().
|
||||
</para>
|
||||
<para>
|
||||
If performing many 'mark' operations, the calendar can be frozen to prevent
|
||||
flicker, using gtk_calendar_freeze(), and 'thawed' again using
|
||||
gtk_calendar_thaw().
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
@ -165,59 +160,52 @@ These options can be used to influence the display and behaviour of a #GtkCalend
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_new ##### -->
|
||||
<para>
|
||||
Creates a new calendar, with the current date being selected.
|
||||
</para>
|
||||
|
||||
@Returns: a #GtkCalendar.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_select_month ##### -->
|
||||
<para>
|
||||
Shifts the calendar to a different month.
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@month: a month number between 0 and 11.
|
||||
@year: the year the month is in.
|
||||
@Returns: %TRUE.
|
||||
@calendar:
|
||||
@month:
|
||||
@year:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_select_day ##### -->
|
||||
<para>
|
||||
Selects a day from the current month.
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@day: the day number between 1 and 31, or 0 to unselect
|
||||
the currently selected day.
|
||||
@calendar:
|
||||
@day:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_mark_day ##### -->
|
||||
<para>
|
||||
Places a visual marker on a particular day.
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@day: the day number to mark between 1 and 31.
|
||||
@Returns: %TRUE.
|
||||
@calendar:
|
||||
@day:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_unmark_day ##### -->
|
||||
<para>
|
||||
Removes the visual marker from a particular day.
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@day: the day number to unmark between 1 and 31.
|
||||
@Returns: %TRUE.
|
||||
@calendar:
|
||||
@day:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_clear_marks ##### -->
|
||||
<para>
|
||||
Remove all visual markers.
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@calendar:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_get_display_options ##### -->
|
||||
@ -240,39 +228,34 @@ Remove all visual markers.
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_display_options ##### -->
|
||||
<para>
|
||||
Sets display options (whether to display the heading and the month headings).
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@flags: the display options to set.
|
||||
@Deprecated: Use gtk_calendar_set_display_options() instead
|
||||
@calendar:
|
||||
@flags:
|
||||
@Deprecated:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_get_date ##### -->
|
||||
<para>
|
||||
Obtains the selected date from a #GtkCalendar.
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@year: location to store the year number.
|
||||
@month: location to store the month number (between 0 and 11).
|
||||
@day: location to store the day number (between 1 and 31).
|
||||
@calendar:
|
||||
@year:
|
||||
@month:
|
||||
@day:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_freeze ##### -->
|
||||
<para>
|
||||
Locks the display of the calendar until it is thawed with gtk_calendar_thaw().
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@calendar:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_calendar_thaw ##### -->
|
||||
<para>
|
||||
Defrosts a calendar; all the changes made since the last
|
||||
gtk_calendar_freeze() are displayed.
|
||||
</para>
|
||||
|
||||
@calendar: a #GtkCalendar.
|
||||
@calendar:
|
||||
|
||||
|
||||
|
@ -50,6 +50,7 @@ LDADD = \
|
||||
#
|
||||
gdk_public_h_sources = \
|
||||
gdk.h \
|
||||
gdkcairo.h \
|
||||
gdkcolor.h \
|
||||
gdkcursor.h \
|
||||
gdkdisplay.h \
|
||||
@ -85,6 +86,7 @@ gdk_headers = \
|
||||
|
||||
gdk_c_sources = \
|
||||
gdk.c \
|
||||
gdkcairo.c \
|
||||
gdkcolor.c \
|
||||
gdkcursor.c \
|
||||
gdkdisplay.c \
|
||||
@ -240,7 +242,7 @@ stamp-gdkenumtypes.h: @REBUILD@ $(gdk_public_h_sources) Makefile
|
||||
gdkenumtypes.c: @REBUILD@ $(gdk_public_h_sources) Makefile
|
||||
( cd $(srcdir) && glib-mkenums \
|
||||
--fhead "#define GDK_ENABLE_BROKEN\n#include \"gdk.h\"\n#include \"gdkalias.h\"\n" \
|
||||
--fprod "\n/* enumerations from \"@filename@\" */" \
|
||||
--fprod "\n/* enumerations from \"@filename@\" */" \
|
||||
--ftail "\n#define __GDK_ENUM_TYPES_C__\n#include \"gdkaliasdef.c\"\n" \
|
||||
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
|
||||
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
|
||||
|
@ -27,6 +27,7 @@
|
||||
#ifndef __GDK_H__
|
||||
#define __GDK_H__
|
||||
|
||||
#include <gdk/gdkcairo.h>
|
||||
#include <gdk/gdkcolor.h>
|
||||
#include <gdk/gdkcursor.h>
|
||||
#include <gdk/gdkdisplay.h>
|
||||
|
@ -288,6 +288,16 @@ gdk_fontset_load_for_display
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_CAIRO_H__)
|
||||
#if IN_FILE(__GDK_CAIRO_C__)
|
||||
gdk_cairo_create
|
||||
gdk_cairo_set_source_color
|
||||
gdk_cairo_set_source_pixbuf
|
||||
gdk_cairo_rectangle
|
||||
gdk_cairo_region
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_COLOR_H__)
|
||||
#if IN_FILE(__GDK_COLOR_C__)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
@ -301,7 +311,6 @@ gdk_color_equal
|
||||
gdk_color_free
|
||||
gdk_color_get_type G_GNUC_CONST
|
||||
gdk_color_hash
|
||||
gdk_cairo_set_source_color
|
||||
gdk_colormap_alloc_color
|
||||
gdk_colormap_get_system
|
||||
gdk_colormap_get_visual
|
||||
@ -510,7 +519,6 @@ gdk_drag_get_protocol
|
||||
|
||||
#if IN_HEADER(__GDK_DRAWABLE_H__)
|
||||
#if IN_FILE(__GDK_DRAW_C__)
|
||||
gdk_drawable_create_cairo_context
|
||||
gdk_drawable_copy_to_image
|
||||
gdk_drawable_get_clip_region
|
||||
gdk_drawable_get_colormap
|
||||
@ -853,7 +861,6 @@ gdk_pixbuf_get_from_image
|
||||
gdk_pixbuf_render_pixmap_and_mask
|
||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap
|
||||
gdk_pixbuf_render_threshold_alpha
|
||||
gdk_pixbuf_set_as_cairo_source
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
gdk_pixbuf_render_to_drawable
|
||||
gdk_pixbuf_render_to_drawable_alpha
|
||||
|
221
gdk/gdkcairo.c
Normal file
221
gdk/gdkcairo.c
Normal file
@ -0,0 +1,221 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2005 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "gdkcairo.h"
|
||||
#include "gdkdrawable.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkregion-generic.h"
|
||||
#include "gdkalias.h"
|
||||
|
||||
/**
|
||||
* gdk_cairo_create:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Creates a Cairo context for drawing to @drawable.
|
||||
*
|
||||
* Return value: A newly created Cairo context. Free with
|
||||
* cairo_destroy() when you are done drawing.
|
||||
*
|
||||
* Since: 2.10
|
||||
**/
|
||||
cairo_t *
|
||||
gdk_cairo_create (GdkDrawable *drawable)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
surface = _gdk_drawable_ref_cairo_surface (drawable);
|
||||
cr = cairo_create (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return cr;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_set_source_color:
|
||||
* @cr: a #cairo_t
|
||||
* @color: a #GdkColor
|
||||
*
|
||||
* Sets the specified #GdkColor as the source color of @cr.
|
||||
*
|
||||
* Since: 2.8
|
||||
**/
|
||||
void
|
||||
gdk_cairo_set_source_color (cairo_t *cr,
|
||||
GdkColor *color)
|
||||
{
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
cairo_set_source_rgb (cr,
|
||||
color->red / 65535.,
|
||||
color->green / 65535.,
|
||||
color->blue / 65535.);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_rectangle:
|
||||
* @cr: a #cairo_t
|
||||
* @rectangle: a #GdkRectangle
|
||||
*
|
||||
* Adds the given rectangle to the current path of @cr.
|
||||
**/
|
||||
void
|
||||
gdk_cairo_rectangle (cairo_t *cr,
|
||||
GdkRectangle *rectangle)
|
||||
{
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (rectangle != NULL);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
rectangle->x, rectangle->y,
|
||||
rectangle->width, rectangle->height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_region:
|
||||
* @cr: a #cairo_t
|
||||
* @region: a #GdkRegion
|
||||
*
|
||||
* Adds the given region to the current path of @cr.
|
||||
**/
|
||||
void
|
||||
gdk_cairo_region (cairo_t *cr,
|
||||
GdkRegion *region)
|
||||
{
|
||||
GdkRegionBox *boxes;
|
||||
gint n_boxes, i;
|
||||
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (region != NULL);
|
||||
|
||||
boxes = region->rects;
|
||||
n_boxes = region->numRects;
|
||||
|
||||
for (i = 0; i < n_boxes; i++)
|
||||
cairo_rectangle (cr,
|
||||
boxes[i].x1,
|
||||
boxes[i].y1,
|
||||
boxes[i].x2 - boxes[i].x1,
|
||||
boxes[i].y2 - boxes[i].y1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_set_source_pixbuf:
|
||||
* @cr: a #Cairo context
|
||||
* @pixbuf: a #GdkPixbuf
|
||||
* @pixbuf_x: X coordinate of location to place upper left corner of @pixbuf
|
||||
* @pixbuf_y: Y coordinate of location to place upper left corner of @pixbuf
|
||||
*
|
||||
* Sets the given pixbuf as the source pattern for the Cairo context.
|
||||
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
|
||||
* so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y
|
||||
**/
|
||||
void
|
||||
gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
GdkPixbuf *pixbuf,
|
||||
double pixbuf_x,
|
||||
double pixbuf_y)
|
||||
{
|
||||
gint width = gdk_pixbuf_get_width (pixbuf);
|
||||
gint height = gdk_pixbuf_get_height (pixbuf);
|
||||
guchar *gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
int gdk_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
|
||||
guchar *cairo_pixels;
|
||||
cairo_format_t format;
|
||||
cairo_surface_t *surface;
|
||||
static const cairo_user_data_key_t key;
|
||||
int j;
|
||||
|
||||
if (n_channels == 3)
|
||||
format = CAIRO_FORMAT_RGB24;
|
||||
else
|
||||
format = CAIRO_FORMAT_ARGB32;
|
||||
|
||||
cairo_pixels = g_malloc (4 * width * height);
|
||||
surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels,
|
||||
format,
|
||||
width, height, 4 * width);
|
||||
cairo_surface_set_user_data (surface, &key,
|
||||
cairo_pixels, (cairo_destroy_func_t)g_free);
|
||||
|
||||
for (j = height; j; j--)
|
||||
{
|
||||
guchar *p = gdk_pixels;
|
||||
guchar *q = cairo_pixels;
|
||||
|
||||
if (n_channels == 3)
|
||||
{
|
||||
guchar *end = p + 3 * width;
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
#if G_BYTE_ORDER == GDK_LSB_FIRST
|
||||
q[0] = p[2];
|
||||
q[1] = p[1];
|
||||
q[2] = p[2];
|
||||
#else
|
||||
q[0] = p[0];
|
||||
q[1] = p[1];
|
||||
q[2] = p[2];
|
||||
#endif
|
||||
p += 3;
|
||||
q += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
guchar *end = p + 4 * width;
|
||||
guint t1,t2,t3;
|
||||
|
||||
#define MULT(d,c,a,t) G_STMT_START { t = c * a; d = ((t >> 8) + t) >> 8; } G_STMT_END
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
MULT(q[0], p[2], p[3], t1);
|
||||
MULT(q[1], p[1], p[3], t2);
|
||||
MULT(q[2], p[0], p[3], t3);
|
||||
q[3] = p[3];
|
||||
#else
|
||||
q[0] = p[3];
|
||||
MULT(q[1], p[0], p[3], t1);
|
||||
MULT(q[2], p[1], p[3], t2);
|
||||
MULT(q[3], p[2], p[3], t3);
|
||||
#endif
|
||||
|
||||
p += 4;
|
||||
q += 4;
|
||||
}
|
||||
|
||||
#undef MULT
|
||||
}
|
||||
|
||||
gdk_pixels += gdk_rowstride;
|
||||
cairo_pixels += 4 * width;
|
||||
}
|
||||
|
||||
cairo_set_source_surface (cr, surface, pixbuf_x, pixbuf_y);
|
||||
}
|
||||
|
||||
#define __GDK_CAIRO_C__
|
||||
#include "gdkaliasdef.c"
|
45
gdk/gdkcairo.h
Normal file
45
gdk/gdkcairo.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2005 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_CAIRO_H__
|
||||
#define __GDK_CAIRO_H__
|
||||
|
||||
#include <gdk/gdkcolor.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
cairo_t *gdk_cairo_create (GdkDrawable *drawable);
|
||||
|
||||
void gdk_cairo_set_source_color (cairo_t *cr,
|
||||
GdkColor *color);
|
||||
void gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
GdkPixbuf *pixbuf,
|
||||
double pixbuf_x,
|
||||
double pixbuf_y);
|
||||
|
||||
void gdk_cairo_rectangle (cairo_t *cr,
|
||||
GdkRectangle *rectangle);
|
||||
void gdk_cairo_region (cairo_t *cr,
|
||||
GdkRegion *region);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_CAIRO_H__ */
|
@ -371,25 +371,5 @@ gdk_colormap_get_system (void)
|
||||
return gdk_screen_get_system_colormap (gdk_screen_get_default ());
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_set_source_color:
|
||||
* @cr: a #cairo_t
|
||||
* @color: a #GdkColor
|
||||
*
|
||||
* Convenience function to set the specified GdkColor as the
|
||||
* source color of the given Cairo context.
|
||||
*
|
||||
* Since: 2.8
|
||||
**/
|
||||
void
|
||||
gdk_cairo_set_source_color (cairo_t *cr,
|
||||
GdkColor *color)
|
||||
{
|
||||
cairo_set_source_rgb (cr,
|
||||
color->red / 65535.,
|
||||
color->green / 65535.,
|
||||
color->blue / 65535.);
|
||||
}
|
||||
|
||||
#define __GDK_COLOR_C__
|
||||
#include "gdkaliasdef.c"
|
||||
|
@ -111,9 +111,6 @@ gboolean gdk_color_equal (const GdkColor *colora,
|
||||
|
||||
GType gdk_color_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gdk_cairo_set_source_color (cairo_t *cr,
|
||||
GdkColor *color);
|
||||
|
||||
/* The following functions are deprecated */
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
void gdk_colors_store (GdkColormap *colormap,
|
||||
|
@ -879,7 +879,7 @@ real_draw_glyphs (GdkDrawable *drawable,
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (drawable);
|
||||
cr = gdk_cairo_create (drawable);
|
||||
_gdk_gc_update_context (gc, cr, NULL, NULL);
|
||||
|
||||
if (matrix)
|
||||
@ -1003,7 +1003,7 @@ gdk_draw_trapezoids (GdkDrawable *drawable,
|
||||
g_return_if_fail (GDK_IS_GC (gc));
|
||||
g_return_if_fail (n_trapezoids == 0 || trapezoids != NULL);
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (drawable);
|
||||
cr = gdk_cairo_create (drawable);
|
||||
_gdk_gc_update_context (gc, cr, NULL, NULL);
|
||||
|
||||
for (i = 0; i < n_trapezoids; i++)
|
||||
@ -1285,32 +1285,6 @@ _gdk_drawable_ref_cairo_surface (GdkDrawable *drawable)
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->ref_cairo_surface (drawable);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_create_cairo_context:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Creates a Cairo context for drawing to @drawable.
|
||||
*
|
||||
* Return value: A newly created Cairo context. Free with
|
||||
* cairo_destroy() when you are done drawing.
|
||||
*
|
||||
* Since: 2.10
|
||||
**/
|
||||
cairo_t *
|
||||
gdk_drawable_create_cairo_context (GdkDrawable *drawable)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
surface = _gdk_drawable_ref_cairo_surface (drawable);
|
||||
cr = cairo_create (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return cr;
|
||||
}
|
||||
|
||||
static void
|
||||
composite (guchar *src_buf,
|
||||
gint src_rowstride,
|
||||
|
@ -391,8 +391,6 @@ GdkImage *gdk_drawable_copy_to_image (GdkDrawable *drawable,
|
||||
GdkRegion *gdk_drawable_get_clip_region (GdkDrawable *drawable);
|
||||
GdkRegion *gdk_drawable_get_visible_region (GdkDrawable *drawable);
|
||||
|
||||
cairo_t *gdk_drawable_create_cairo_context (GdkDrawable *drawable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
14
gdk/gdkgc.c
14
gdk/gdkgc.c
@ -27,10 +27,10 @@
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gdkcairo.h"
|
||||
#include "gdkgc.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkpixmap.h"
|
||||
#include "gdkregion-generic.h"
|
||||
#include "gdkrgb.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkalias.h"
|
||||
@ -1225,21 +1225,13 @@ _gdk_gc_update_context (GdkGC *gc,
|
||||
cairo_reset_clip (cr);
|
||||
if (priv->clip_region)
|
||||
{
|
||||
GdkRegionBox *boxes = priv->clip_region->rects;
|
||||
gint n_boxes = priv->clip_region->numRects;
|
||||
int i;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_identity_matrix (cr);
|
||||
cairo_translate (cr, gc->clip_x_origin, gc->clip_y_origin);
|
||||
|
||||
cairo_new_path (cr);
|
||||
for (i=0; i < n_boxes; i++)
|
||||
cairo_rectangle (cr,
|
||||
boxes[i].x1 + gc->clip_x_origin,
|
||||
boxes[i].y1 + gc->clip_y_origin,
|
||||
boxes[i].x2 - boxes[i].x1,
|
||||
boxes[i].y2 - boxes[i].y1);
|
||||
gdk_cairo_region (cr, priv->clip_region);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
|
@ -141,7 +141,7 @@ get_cairo_context (GdkPangoRenderer *gdk_renderer,
|
||||
{
|
||||
const PangoMatrix *matrix;
|
||||
|
||||
priv->cr = gdk_drawable_create_cairo_context (priv->drawable);
|
||||
priv->cr = gdk_cairo_create (priv->drawable);
|
||||
|
||||
matrix = pango_renderer_get_matrix (renderer);
|
||||
if (matrix)
|
||||
|
@ -329,105 +329,6 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_set_as_cairo_source:
|
||||
* @pixbuf: a #GdkPixbuf
|
||||
* @cr: a #Cairo context
|
||||
* @pixbuf_x: X coordinate of location to place upper left corner of @pixbuf
|
||||
* @pixbuf_y: Y coordinate of location to place upper left corner of @pixbuf
|
||||
*
|
||||
* Sets the given pixbuf as the source pattern for the Cairo context.
|
||||
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
|
||||
* so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_set_as_cairo_source (GdkPixbuf *pixbuf,
|
||||
cairo_t *cr,
|
||||
double pixbuf_x,
|
||||
double pixbuf_y)
|
||||
{
|
||||
gint width = gdk_pixbuf_get_width (pixbuf);
|
||||
gint height = gdk_pixbuf_get_height (pixbuf);
|
||||
guchar *gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
int gdk_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
int n_channels = gdk_pixbuf_get_n_channels (pixbuf);
|
||||
guchar *cairo_pixels;
|
||||
cairo_format_t format;
|
||||
cairo_surface_t *surface;
|
||||
static const cairo_user_data_key_t key;
|
||||
int j;
|
||||
|
||||
if (n_channels == 3)
|
||||
format = CAIRO_FORMAT_RGB24;
|
||||
else
|
||||
format = CAIRO_FORMAT_ARGB32;
|
||||
|
||||
cairo_pixels = g_malloc (4 * width * height);
|
||||
surface = cairo_image_surface_create_for_data ((unsigned char *)cairo_pixels,
|
||||
format,
|
||||
width, height, 4 * width);
|
||||
cairo_surface_set_user_data (surface, &key,
|
||||
cairo_pixels, (cairo_destroy_func_t)g_free);
|
||||
|
||||
for (j = height; j; j--)
|
||||
{
|
||||
guchar *p = gdk_pixels;
|
||||
guchar *q = cairo_pixels;
|
||||
|
||||
if (n_channels == 3)
|
||||
{
|
||||
guchar *end = p + 3 * width;
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
#if G_BYTE_ORDER == GDK_LSB_FIRST
|
||||
q[0] = p[2];
|
||||
q[1] = p[1];
|
||||
q[2] = p[2];
|
||||
#else
|
||||
q[0] = p[0];
|
||||
q[1] = p[1];
|
||||
q[2] = p[2];
|
||||
#endif
|
||||
p += 3;
|
||||
q += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
guchar *end = p + 4 * width;
|
||||
guint t1,t2,t3;
|
||||
|
||||
#define MULT(d,c,a,t) G_STMT_START { t = c * a; d = ((t >> 8) + t) >> 8; } G_STMT_END
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
MULT(q[0], p[2], p[3], t1);
|
||||
MULT(q[1], p[1], p[3], t2);
|
||||
MULT(q[2], p[0], p[3], t3);
|
||||
q[3] = p[3];
|
||||
#else
|
||||
q[0] = p[3];
|
||||
MULT(q[1], p[0], p[3], t1);
|
||||
MULT(q[2], p[1], p[3], t2);
|
||||
MULT(q[3], p[2], p[3], t3);
|
||||
#endif
|
||||
|
||||
p += 4;
|
||||
q += 4;
|
||||
}
|
||||
|
||||
#undef MULT
|
||||
}
|
||||
|
||||
gdk_pixels += gdk_rowstride;
|
||||
cairo_pixels += 4 * width;
|
||||
}
|
||||
|
||||
cairo_set_source_surface (cr, surface, pixbuf_x, pixbuf_y);
|
||||
}
|
||||
|
||||
#define __GDK_PIXBUF_RENDER_C__
|
||||
#include "gdkaliasdef.c"
|
||||
|
||||
|
@ -80,11 +80,6 @@ GdkPixbuf *gdk_pixbuf_get_from_image (GdkPixbuf *dest,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
void gdk_pixbuf_set_as_cairo_source (GdkPixbuf *pixbuf,
|
||||
cairo_t *cr,
|
||||
double pixbuf_x,
|
||||
double pixbuf_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_PIXBUF_H__ */
|
||||
|
@ -1763,23 +1763,6 @@ gdk_window_set_bg_pattern (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
region_path (cairo_t *cr,
|
||||
GdkRegion *region)
|
||||
{
|
||||
GdkRectangle *rectangles;
|
||||
int n_rectangles, i;
|
||||
|
||||
gdk_region_get_rectangles (region, &rectangles, &n_rectangles);
|
||||
for (i = 0; i < n_rectangles; i++)
|
||||
{
|
||||
cairo_rectangle (cr,
|
||||
rectangles[i].x, rectangles[i].y,
|
||||
rectangles[i].width, rectangles[i].height);
|
||||
}
|
||||
g_free (rectangles);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_clear_backing_rect (GdkWindow *window,
|
||||
gint x,
|
||||
@ -1801,7 +1784,7 @@ gdk_window_clear_backing_rect (GdkWindow *window,
|
||||
cairo_rectangle (cr, x, y, width, height);
|
||||
cairo_clip (cr);
|
||||
|
||||
region_path (cr, paint->region);
|
||||
gdk_cairo_region (cr, paint->region);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
@ -402,11 +402,12 @@ gtk_button_set_use_underline
|
||||
|
||||
#if IN_HEADER(__GTK_CALENDAR_H__)
|
||||
#if IN_FILE(__GTK_CALENDAR_C__)
|
||||
gtk_calendar_clear_marks
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
gtk_calendar_display_options
|
||||
#endif
|
||||
gtk_calendar_freeze
|
||||
gtk_calendar_thaw
|
||||
#endif
|
||||
gtk_calendar_clear_marks
|
||||
gtk_calendar_get_date
|
||||
gtk_calendar_get_display_options
|
||||
gtk_calendar_get_type G_GNUC_CONST
|
||||
@ -415,7 +416,6 @@ gtk_calendar_new
|
||||
gtk_calendar_select_day
|
||||
gtk_calendar_select_month
|
||||
gtk_calendar_set_display_options
|
||||
gtk_calendar_thaw
|
||||
gtk_calendar_unmark_day
|
||||
#endif
|
||||
#endif
|
||||
|
4617
gtk/gtkcalendar.c
4617
gtk/gtkcalendar.c
File diff suppressed because it is too large
Load Diff
@ -49,6 +49,8 @@ G_BEGIN_DECLS
|
||||
typedef struct _GtkCalendar GtkCalendar;
|
||||
typedef struct _GtkCalendarClass GtkCalendarClass;
|
||||
|
||||
typedef struct _GtkCalendarPrivate GtkCalendarPrivate;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_CALENDAR_SHOW_HEADING = 1 << 0,
|
||||
@ -77,8 +79,8 @@ struct _GtkCalendar
|
||||
GtkCalendarDisplayOptions display_flags;
|
||||
GdkColor marked_date_color[31];
|
||||
|
||||
GdkGC *gc;
|
||||
GdkGC *xor_gc;
|
||||
GdkGC *gc; /* unused */
|
||||
GdkGC *xor_gc; /* unused */
|
||||
|
||||
gint focus_row;
|
||||
gint focus_col;
|
||||
@ -86,7 +88,7 @@ struct _GtkCalendar
|
||||
gint highlight_row;
|
||||
gint highlight_col;
|
||||
|
||||
gpointer private_data;
|
||||
GtkCalendarPrivate *priv;
|
||||
gchar grow_space [32];
|
||||
|
||||
/* Padding for future expansion */
|
||||
@ -141,9 +143,10 @@ void gtk_calendar_get_date (GtkCalendar *calendar,
|
||||
guint *year,
|
||||
guint *month,
|
||||
guint *day);
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
void gtk_calendar_freeze (GtkCalendar *calendar);
|
||||
void gtk_calendar_thaw (GtkCalendar *calendar);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -580,19 +580,13 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
|
||||
|
||||
if (cell->cell_background_set && !selected)
|
||||
{
|
||||
GdkColor color;
|
||||
GdkGC *gc;
|
||||
cairo_t *cr = gdk_cairo_create (window);
|
||||
|
||||
color.red = priv->cell_background.red;
|
||||
color.green = priv->cell_background.green;
|
||||
color.blue = priv->cell_background.blue;
|
||||
gdk_cairo_rectangle (cr, background_area);
|
||||
gdk_cairo_set_source_color (cr, &priv->cell_background);
|
||||
cairo_fill (cr);
|
||||
|
||||
gc = gdk_gc_new (window);
|
||||
gdk_gc_set_rgb_fg_color (gc, &color);
|
||||
gdk_draw_rectangle (window, gc, TRUE,
|
||||
background_area->x, background_area->y,
|
||||
background_area->width, background_area->height);
|
||||
g_object_unref (gc);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
GTK_CELL_RENDERER_GET_CLASS (cell)->render (cell,
|
||||
|
@ -508,6 +508,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
||||
GdkPixbuf *colorized = NULL;
|
||||
GdkRectangle pix_rect;
|
||||
GdkRectangle draw_rect;
|
||||
cairo_t *cr;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cell);
|
||||
|
||||
@ -588,18 +589,13 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
||||
pixbuf = colorized;
|
||||
}
|
||||
|
||||
gdk_draw_pixbuf (window,
|
||||
widget->style->black_gc,
|
||||
pixbuf,
|
||||
/* pixbuf 0, 0 is at pix_rect.x, pix_rect.y */
|
||||
draw_rect.x - pix_rect.x,
|
||||
draw_rect.y - pix_rect.y,
|
||||
draw_rect.x,
|
||||
draw_rect.y,
|
||||
draw_rect.width,
|
||||
draw_rect.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
0, 0);
|
||||
cr = gdk_cairo_create (window);
|
||||
|
||||
gdk_cairo_set_source_pixbuf (cr, pixbuf, pix_rect.x, pix_rect.y);
|
||||
gdk_cairo_rectangle (cr, &draw_rect);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
if (invisible)
|
||||
g_object_unref (invisible);
|
||||
|
@ -318,16 +318,16 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
|
||||
guint flags)
|
||||
{
|
||||
GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (cell);
|
||||
GdkGC *gc;
|
||||
PangoLayout *layout;
|
||||
PangoRectangle logical_rect;
|
||||
gint x, y, w, h, perc_w, pos;
|
||||
GdkRectangle clip;
|
||||
gboolean is_rtl;
|
||||
cairo_t *cr;
|
||||
|
||||
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||
|
||||
gc = gdk_gc_new (window);
|
||||
cr = gdk_cairo_create (window);
|
||||
|
||||
x = cell_area->x + cell->xpad;
|
||||
y = cell_area->y + cell->ypad;
|
||||
@ -335,19 +335,24 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
|
||||
w = cell_area->width - cell->xpad * 2;
|
||||
h = cell_area->height - cell->ypad * 2;
|
||||
|
||||
gdk_gc_set_rgb_fg_color (gc, &widget->style->fg[GTK_STATE_NORMAL]);
|
||||
gdk_draw_rectangle (window, gc, TRUE, x, y, w, h);
|
||||
cairo_rectangle (cr, x, y, w, h);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_STATE_NORMAL]);
|
||||
cairo_fill (cr);
|
||||
|
||||
x += widget->style->xthickness;
|
||||
y += widget->style->ythickness;
|
||||
w -= widget->style->xthickness * 2;
|
||||
h -= widget->style->ythickness * 2;
|
||||
gdk_gc_set_rgb_fg_color (gc, &widget->style->bg[GTK_STATE_NORMAL]);
|
||||
gdk_draw_rectangle (window, gc, TRUE, x, y, w, h);
|
||||
|
||||
gdk_gc_set_rgb_fg_color (gc, &widget->style->bg[GTK_STATE_SELECTED]);
|
||||
cairo_rectangle (cr, x, y, w, h);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->bg[GTK_STATE_NORMAL]);
|
||||
cairo_fill (cr);
|
||||
|
||||
perc_w = w * MAX (0, cellprogress->priv->value) / 100;
|
||||
gdk_draw_rectangle (window, gc, TRUE, is_rtl ? (x + w - perc_w) : x, y, perc_w, h);
|
||||
|
||||
cairo_rectangle (cr, is_rtl ? (x + w - perc_w) : x, y, perc_w, h);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->bg[GTK_STATE_SELECTED]);
|
||||
cairo_fill (cr);
|
||||
|
||||
layout = gtk_widget_create_pango_layout (widget, cellprogress->priv->label);
|
||||
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
||||
@ -375,7 +380,7 @@ gtk_cell_renderer_progress_render (GtkCellRenderer *cell,
|
||||
layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
g_object_unref (gc);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
#define __GTK_CELL_RENDERER_PROGRESS_C__
|
||||
|
@ -1626,29 +1626,22 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
|
||||
if (celltext->background_set &&
|
||||
(flags & GTK_CELL_RENDERER_SELECTED) == 0)
|
||||
{
|
||||
GdkColor color;
|
||||
GdkGC *gc;
|
||||
|
||||
color.red = celltext->background.red;
|
||||
color.green = celltext->background.green;
|
||||
color.blue = celltext->background.blue;
|
||||
|
||||
gc = gdk_gc_new (window);
|
||||
|
||||
gdk_gc_set_rgb_fg_color (gc, &color);
|
||||
cairo_t *cr = gdk_cairo_create (window);
|
||||
|
||||
if (expose_area)
|
||||
gdk_gc_set_clip_rectangle (gc, expose_area);
|
||||
gdk_draw_rectangle (window,
|
||||
gc,
|
||||
TRUE,
|
||||
background_area->x,
|
||||
background_area->y,
|
||||
background_area->width,
|
||||
background_area->height);
|
||||
if (expose_area)
|
||||
gdk_gc_set_clip_rectangle (gc, NULL);
|
||||
g_object_unref (gc);
|
||||
{
|
||||
gdk_cairo_rectangle (cr, expose_area);
|
||||
cairo_clip (cr);
|
||||
}
|
||||
|
||||
gdk_cairo_rectangle (cr, background_area);
|
||||
cairo_set_source_rgb (cr,
|
||||
celltext->background.red / 65535.,
|
||||
celltext->background.green / 65535.,
|
||||
celltext->background.blue / 65535.);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
if (priv->ellipsize_set)
|
||||
|
@ -429,23 +429,16 @@ gtk_cell_view_expose (GtkWidget *widget,
|
||||
/* "blank" background */
|
||||
if (cellview->priv->background_set)
|
||||
{
|
||||
GdkGC *gc;
|
||||
cairo_t *cr = gdk_cairo_create (GTK_WIDGET (cellview)->window);
|
||||
|
||||
gc = gdk_gc_new (GTK_WIDGET (cellview)->window);
|
||||
gdk_gc_set_rgb_fg_color (gc, &cellview->priv->background);
|
||||
gdk_cairo_rectangle (cr, &widget->allocation);
|
||||
cairo_set_source_rgb (cr,
|
||||
cellview->priv->background.red / 65535.,
|
||||
cellview->priv->background.green / 65535.,
|
||||
cellview->priv->background.blue / 65535.);
|
||||
cairo_fill (cr);
|
||||
|
||||
gdk_draw_rectangle (GTK_WIDGET (cellview)->window,
|
||||
gc,
|
||||
TRUE,
|
||||
|
||||
/*0, 0,*/
|
||||
widget->allocation.x,
|
||||
widget->allocation.y,
|
||||
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
g_object_unref (gc);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
/* set cell data (if available) */
|
||||
|
@ -59,7 +59,7 @@ struct _GtkColorButtonPrivate
|
||||
GdkPixbuf *pixbuf; /* Pixbuf for rendering sample */
|
||||
GdkGC *gc; /* GC for drawing */
|
||||
|
||||
GtkWidget *drawing_area;/* Drawing area for color sample */
|
||||
GtkWidget *draw_area; /* Widget where we draw the color sample */
|
||||
GtkWidget *cs_dialog; /* Color selection dialog */
|
||||
|
||||
gchar *title; /* Title for the color selection window */
|
||||
@ -285,8 +285,8 @@ render (GtkColorButton *color_button)
|
||||
guint8 insensitive_g = 0;
|
||||
guint8 insensitive_b = 0;
|
||||
|
||||
width = color_button->priv->drawing_area->allocation.width;
|
||||
height = color_button->priv->drawing_area->allocation.height;
|
||||
width = color_button->priv->draw_area->allocation.width;
|
||||
height = color_button->priv->draw_area->allocation.height;
|
||||
if (color_button->priv->pixbuf == NULL ||
|
||||
gdk_pixbuf_get_width (color_button->priv->pixbuf) != width ||
|
||||
gdk_pixbuf_get_height (color_button->priv->pixbuf) != height)
|
||||
@ -378,8 +378,8 @@ expose_event (GtkWidget *widget,
|
||||
{
|
||||
GtkColorButton *color_button = GTK_COLOR_BUTTON (data);
|
||||
|
||||
gint width = color_button->priv->drawing_area->allocation.width;
|
||||
gint height = color_button->priv->drawing_area->allocation.height;
|
||||
gint width = color_button->priv->draw_area->allocation.width;
|
||||
gint height = color_button->priv->draw_area->allocation.height;
|
||||
|
||||
if (color_button->priv->pixbuf == NULL ||
|
||||
width != gdk_pixbuf_get_width (color_button->priv->pixbuf) ||
|
||||
@ -389,15 +389,15 @@ expose_event (GtkWidget *widget,
|
||||
gdk_draw_pixbuf (widget->window,
|
||||
color_button->priv->gc,
|
||||
color_button->priv->pixbuf,
|
||||
event->area.x,
|
||||
event->area.y,
|
||||
event->area.x - widget->allocation.x,
|
||||
event->area.y - widget->allocation.y,
|
||||
event->area.x,
|
||||
event->area.y,
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
event->area.x,
|
||||
event->area.y);
|
||||
event->area.x - widget->allocation.x,
|
||||
event->area.y - widget->allocation.y);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
g_object_unref (color_button->priv->pixbuf);
|
||||
color_button->priv->pixbuf = NULL;
|
||||
|
||||
gtk_widget_queue_draw (color_button->priv->drawing_area);
|
||||
gtk_widget_queue_draw (color_button->priv->draw_area);
|
||||
|
||||
g_signal_emit (color_button, color_button_signals[COLOR_SET], 0);
|
||||
|
||||
@ -562,15 +562,16 @@ gtk_color_button_init (GtkColorButton *color_button)
|
||||
gtk_container_add (GTK_CONTAINER (alignment), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
color_button->priv->drawing_area = gtk_drawing_area_new ();
|
||||
/* Just some widget we can hook to expose-event on */
|
||||
color_button->priv->draw_area = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
|
||||
layout = gtk_widget_create_pango_layout (GTK_WIDGET (color_button), "Black");
|
||||
pango_layout_get_pixel_extents (layout, NULL, &rect);
|
||||
gtk_widget_set_size_request (color_button->priv->drawing_area, rect.width - 2, rect.height - 2);
|
||||
g_signal_connect (color_button->priv->drawing_area, "expose_event",
|
||||
gtk_widget_set_size_request (color_button->priv->draw_area, rect.width - 2, rect.height - 2);
|
||||
g_signal_connect (color_button->priv->draw_area, "expose-event",
|
||||
G_CALLBACK (expose_event), color_button);
|
||||
gtk_container_add (GTK_CONTAINER (frame), color_button->priv->drawing_area);
|
||||
gtk_widget_show (color_button->priv->drawing_area);
|
||||
gtk_container_add (GTK_CONTAINER (frame), color_button->priv->draw_area);
|
||||
gtk_widget_show (color_button->priv->draw_area);
|
||||
|
||||
color_button->priv->title = g_strdup (_("Pick a Color")); /* default title */
|
||||
|
||||
@ -685,7 +686,7 @@ dialog_ok_clicked (GtkWidget *widget,
|
||||
|
||||
gtk_widget_hide (color_button->priv->cs_dialog);
|
||||
|
||||
gtk_widget_queue_draw (color_button->priv->drawing_area);
|
||||
gtk_widget_queue_draw (color_button->priv->draw_area);
|
||||
|
||||
g_signal_emit (color_button, color_button_signals[COLOR_SET], 0);
|
||||
|
||||
@ -790,7 +791,7 @@ gtk_color_button_set_color (GtkColorButton *color_button,
|
||||
g_object_unref (color_button->priv->pixbuf);
|
||||
color_button->priv->pixbuf = NULL;
|
||||
|
||||
gtk_widget_queue_draw (color_button->priv->drawing_area);
|
||||
gtk_widget_queue_draw (color_button->priv->draw_area);
|
||||
|
||||
g_object_notify (G_OBJECT (color_button), "color");
|
||||
}
|
||||
@ -817,7 +818,7 @@ gtk_color_button_set_alpha (GtkColorButton *color_button,
|
||||
g_object_unref (color_button->priv->pixbuf);
|
||||
color_button->priv->pixbuf = NULL;
|
||||
|
||||
gtk_widget_queue_draw (color_button->priv->drawing_area);
|
||||
gtk_widget_queue_draw (color_button->priv->draw_area);
|
||||
|
||||
g_object_notify (G_OBJECT (color_button), "alpha");
|
||||
}
|
||||
@ -882,7 +883,7 @@ gtk_color_button_set_use_alpha (GtkColorButton *color_button,
|
||||
color_button->priv->use_alpha = use_alpha;
|
||||
|
||||
render (color_button);
|
||||
gtk_widget_queue_draw (color_button->priv->drawing_area);
|
||||
gtk_widget_queue_draw (color_button->priv->draw_area);
|
||||
|
||||
g_object_notify (G_OBJECT (color_button), "use-alpha");
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ color_sample_draw_sample (GtkColorSelection *colorsel, int which)
|
||||
goff = priv->old_sample->allocation.width % 32;
|
||||
}
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (da->window);
|
||||
cr = gdk_cairo_create (da->window);
|
||||
|
||||
wid = da->allocation.width;
|
||||
heig = da->allocation.height;
|
||||
@ -427,23 +427,21 @@ color_sample_draw_sample (GtkColorSelection *colorsel, int which)
|
||||
|
||||
if (which == 0)
|
||||
{
|
||||
if (priv->has_opacity)
|
||||
cairo_set_source_rgba (cr,
|
||||
priv->old_color[COLORSEL_RED],
|
||||
priv->old_color[COLORSEL_GREEN],
|
||||
priv->old_color[COLORSEL_BLUE],
|
||||
priv->has_opacity ?
|
||||
priv->old_color[COLORSEL_OPACITY] : 1.0);
|
||||
cairo_set_source_rgba (cr,
|
||||
priv->old_color[COLORSEL_RED],
|
||||
priv->old_color[COLORSEL_GREEN],
|
||||
priv->old_color[COLORSEL_BLUE],
|
||||
priv->has_opacity ?
|
||||
priv->old_color[COLORSEL_OPACITY] : 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->has_opacity)
|
||||
cairo_set_source_rgba (cr,
|
||||
priv->color[COLORSEL_RED],
|
||||
priv->color[COLORSEL_GREEN],
|
||||
priv->color[COLORSEL_BLUE],
|
||||
priv->has_opacity ?
|
||||
priv->color[COLORSEL_OPACITY] : 1.0);
|
||||
cairo_set_source_rgba (cr,
|
||||
priv->color[COLORSEL_RED],
|
||||
priv->color[COLORSEL_GREEN],
|
||||
priv->color[COLORSEL_BLUE],
|
||||
priv->has_opacity ?
|
||||
priv->color[COLORSEL_OPACITY] : 1.0);
|
||||
}
|
||||
|
||||
cairo_rectangle (cr, 0, 0, wid, heig);
|
||||
@ -615,11 +613,10 @@ palette_paint (GtkWidget *drawing_area,
|
||||
if (drawing_area->window == NULL)
|
||||
return;
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (drawing_area->window);
|
||||
cr = gdk_cairo_create (drawing_area->window);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &drawing_area->style->bg[GTK_STATE_NORMAL]);
|
||||
cairo_rectangle (cr,
|
||||
area->x, area->y, area->width, area->height);
|
||||
gdk_cairo_rectangle (cr, area);
|
||||
cairo_fill (cr);
|
||||
|
||||
if (GTK_WIDGET_HAS_FOCUS (drawing_area))
|
||||
|
14
gtk/gtkdnd.c
14
gtk/gtkdnd.c
@ -774,6 +774,8 @@ gtk_drag_highlight_expose (GtkWidget *widget,
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
if (GTK_WIDGET_NO_WINDOW (widget))
|
||||
{
|
||||
x = widget->allocation.x;
|
||||
@ -793,10 +795,14 @@ gtk_drag_highlight_expose (GtkWidget *widget,
|
||||
NULL, widget, "dnd",
|
||||
x, y, width, height);
|
||||
|
||||
gdk_draw_rectangle (widget->window,
|
||||
widget->style->black_gc,
|
||||
FALSE,
|
||||
x, y, width - 1, height - 1);
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_rectangle (cr,
|
||||
x + 0.5, y + 0.5,
|
||||
width - 1, height - 1);
|
||||
cairo_stroke (cr);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -3091,6 +3091,7 @@ gtk_entry_draw_text (GtkEntry *entry)
|
||||
if (GTK_WIDGET_DRAWABLE (entry))
|
||||
{
|
||||
PangoLayout *layout = gtk_entry_ensure_layout (entry, TRUE);
|
||||
cairo_t *cr;
|
||||
gint x, y;
|
||||
gint start_pos, end_pos;
|
||||
|
||||
@ -3098,57 +3099,53 @@ gtk_entry_draw_text (GtkEntry *entry)
|
||||
|
||||
get_layout_position (entry, &x, &y);
|
||||
|
||||
gdk_draw_layout (entry->text_area, widget->style->text_gc [widget->state],
|
||||
x, y,
|
||||
layout);
|
||||
cr = gdk_cairo_create (entry->text_area);
|
||||
|
||||
cairo_move_to (cr, x, y);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->text [widget->state]);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos))
|
||||
{
|
||||
gint *ranges;
|
||||
gint n_ranges, i;
|
||||
PangoRectangle logical_rect;
|
||||
GdkGC *selection_gc, *text_gc;
|
||||
GdkRegion *clip_region;
|
||||
GdkColor *selection_color, *text_color;
|
||||
|
||||
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
||||
gtk_entry_get_pixel_ranges (entry, &ranges, &n_ranges);
|
||||
|
||||
if (GTK_WIDGET_HAS_FOCUS (entry))
|
||||
{
|
||||
selection_gc = widget->style->base_gc [GTK_STATE_SELECTED];
|
||||
text_gc = widget->style->text_gc [GTK_STATE_SELECTED];
|
||||
selection_color = &widget->style->base [GTK_STATE_SELECTED];
|
||||
text_color = &widget->style->text [GTK_STATE_SELECTED];
|
||||
}
|
||||
else
|
||||
{
|
||||
selection_gc = widget->style->base_gc [GTK_STATE_ACTIVE];
|
||||
text_gc = widget->style->text_gc [GTK_STATE_ACTIVE];
|
||||
selection_color = &widget->style->base [GTK_STATE_ACTIVE];
|
||||
text_color = &widget->style->text [GTK_STATE_ACTIVE];
|
||||
}
|
||||
|
||||
clip_region = gdk_region_new ();
|
||||
for (i = 0; i < n_ranges; ++i)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
cairo_rectangle (cr,
|
||||
INNER_BORDER - entry->scroll_offset + ranges[2 * i],
|
||||
y,
|
||||
ranges[2 * i + 1],
|
||||
logical_rect.height);
|
||||
|
||||
rect.x = INNER_BORDER - entry->scroll_offset + ranges[2 * i];
|
||||
rect.y = y;
|
||||
rect.width = ranges[2 * i + 1];
|
||||
rect.height = logical_rect.height;
|
||||
cairo_clip (cr);
|
||||
|
||||
gdk_draw_rectangle (entry->text_area, selection_gc, TRUE,
|
||||
rect.x, rect.y, rect.width, rect.height);
|
||||
gdk_cairo_set_source_color (cr, selection_color);
|
||||
cairo_paint (cr);
|
||||
|
||||
gdk_region_union_with_rect (clip_region, &rect);
|
||||
}
|
||||
cairo_move_to (cr, x, y);
|
||||
gdk_cairo_set_source_color (cr, text_color);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
gdk_gc_set_clip_region (text_gc, clip_region);
|
||||
gdk_draw_layout (entry->text_area, text_gc,
|
||||
x, y,
|
||||
layout);
|
||||
gdk_gc_set_clip_region (text_gc, NULL);
|
||||
|
||||
gdk_region_destroy (clip_region);
|
||||
g_free (ranges);
|
||||
}
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ gtk_hruler_draw_ticks (GtkRuler *ruler)
|
||||
0, 0,
|
||||
widget->allocation.width, widget->allocation.height);
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (ruler->backing_store);
|
||||
cr = gdk_cairo_create (ruler->backing_store);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->fg[widget->state]);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
@ -296,7 +296,7 @@ gtk_hruler_draw_pos (GtkRuler *ruler)
|
||||
|
||||
if ((bs_width > 0) && (bs_height > 0))
|
||||
{
|
||||
cairo_t *cr = gdk_drawable_create_cairo_context (widget->window);
|
||||
cairo_t *cr = gdk_cairo_create (widget->window);
|
||||
|
||||
/* If a backing store exists, restore the ruler */
|
||||
if (ruler->backing_store)
|
||||
|
@ -1298,7 +1298,7 @@ gtk_hsv_expose (GtkWidget *widget,
|
||||
if (!gdk_rectangle_intersect (&event->area, &rect, &dest))
|
||||
return FALSE;
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (widget->window);
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
|
||||
cairo_translate (cr, widget->allocation.x, widget->allocation.y);
|
||||
paint (hsv, cr,
|
||||
|
@ -1250,7 +1250,7 @@ gtk_icon_view_expose (GtkWidget *widget,
|
||||
if (expose->window != icon_view->priv->bin_window)
|
||||
return FALSE;
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (icon_view->priv->bin_window);
|
||||
cr = gdk_cairo_create (icon_view->priv->bin_window);
|
||||
cairo_set_line_width (cr, 1.);
|
||||
|
||||
gtk_icon_view_get_drag_dest_item (icon_view, &path, &dest_pos);
|
||||
@ -2899,7 +2899,7 @@ gtk_icon_view_paint_rubberband (GtkIconView *icon_view,
|
||||
fill_color_alpha / 255.);
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
|
||||
gdk_cairo_rectangle (cr, &rect);
|
||||
cairo_clip (cr);
|
||||
cairo_paint (cr);
|
||||
|
||||
@ -6460,15 +6460,12 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
|
||||
item->height + 2,
|
||||
-1);
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (drawable);
|
||||
cr = gdk_cairo_create (drawable);
|
||||
cairo_set_line_width (cr, 1.);
|
||||
|
||||
gdk_draw_rectangle (drawable,
|
||||
widget->style->base_gc [GTK_WIDGET_STATE (widget)],
|
||||
TRUE,
|
||||
0, 0,
|
||||
item->width + 2,
|
||||
item->height + 2);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->base_gc);
|
||||
cairo_rectangle (cr, 0, 0, item->width + 2, item->height + 2);
|
||||
cairo_fill (cr);
|
||||
|
||||
area.x = 0;
|
||||
area.y = 0;
|
||||
@ -6476,15 +6473,11 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
|
||||
area.height = item->height;
|
||||
|
||||
gtk_icon_view_paint_item (icon_view, cr, item, &area,
|
||||
drawable, 1, 1, FALSE);
|
||||
drawable, 1, 1, FALSE);
|
||||
|
||||
|
||||
gdk_draw_rectangle (drawable,
|
||||
widget->style->black_gc,
|
||||
FALSE,
|
||||
0, 0,
|
||||
item->width + 1,
|
||||
item->height + 1);
|
||||
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
|
||||
cairo_rectangle (cr, 0.5, 0.5, item->width + 1, item->height + 1);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
|
@ -2900,14 +2900,13 @@ draw_arrow (GdkWindow *window,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
cairo_t *cr = gdk_drawable_create_cairo_context (window);
|
||||
cairo_t *cr = gdk_cairo_create (window);
|
||||
gdk_cairo_set_source_color (cr, color);
|
||||
|
||||
if (area)
|
||||
{
|
||||
cairo_rectangle (cr, area->x, area->y, area->width, area->height);
|
||||
gdk_cairo_rectangle (cr, area);
|
||||
cairo_clip (cr);
|
||||
cairo_new_path (cr);
|
||||
}
|
||||
|
||||
if (arrow_type == GTK_ARROW_DOWN)
|
||||
@ -3611,7 +3610,7 @@ gtk_default_draw_check (GtkStyle *style,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
cairo_t *cr = gdk_drawable_create_cairo_context (window);
|
||||
cairo_t *cr = gdk_cairo_create (window);
|
||||
enum { BUTTON, MENU, CELL } type = BUTTON;
|
||||
int exterior_size;
|
||||
int interior_size;
|
||||
@ -3627,9 +3626,8 @@ gtk_default_draw_check (GtkStyle *style,
|
||||
|
||||
if (area)
|
||||
{
|
||||
cairo_rectangle (cr, area->x, area->y, area->width, area->height);
|
||||
gdk_cairo_rectangle (cr, area);
|
||||
cairo_clip (cr);
|
||||
cairo_new_path (cr);
|
||||
}
|
||||
|
||||
exterior_size = MIN (width, height);
|
||||
@ -3737,7 +3735,7 @@ gtk_default_draw_option (GtkStyle *style,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
cairo_t *cr = gdk_drawable_create_cairo_context (window);
|
||||
cairo_t *cr = gdk_cairo_create (window);
|
||||
enum { BUTTON, MENU, CELL } type = BUTTON;
|
||||
int exterior_size;
|
||||
|
||||
@ -3751,9 +3749,8 @@ gtk_default_draw_option (GtkStyle *style,
|
||||
|
||||
if (area)
|
||||
{
|
||||
cairo_rectangle (cr, area->x, area->y, area->width, area->height);
|
||||
gdk_cairo_rectangle (cr, area);
|
||||
cairo_clip (cr);
|
||||
cairo_new_path (cr);
|
||||
}
|
||||
|
||||
exterior_size = MIN (width, height);
|
||||
@ -4543,7 +4540,7 @@ gtk_default_draw_focus (GtkStyle *style,
|
||||
|
||||
sanitize_size (window, &width, &height);
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (window);
|
||||
cr = gdk_cairo_create (window);
|
||||
|
||||
if (detail && !strcmp (detail, "colorwheel_light"))
|
||||
cairo_set_source_rgb (cr, 0., 0., 0.);
|
||||
@ -4583,10 +4580,8 @@ gtk_default_draw_focus (GtkStyle *style,
|
||||
|
||||
if (area)
|
||||
{
|
||||
cairo_rectangle (cr,
|
||||
area->x, area->y, area->width, area->height);
|
||||
gdk_cairo_rectangle (cr, area);
|
||||
cairo_clip (cr);
|
||||
cairo_new_path (cr);
|
||||
}
|
||||
|
||||
cairo_rectangle (cr,
|
||||
@ -4793,13 +4788,12 @@ gtk_default_draw_expander (GtkStyle *style,
|
||||
double x_double, y_double;
|
||||
gint degrees = 0;
|
||||
|
||||
cairo_t *cr = gdk_drawable_create_cairo_context (window);
|
||||
cairo_t *cr = gdk_cairo_create (window);
|
||||
|
||||
if (area)
|
||||
{
|
||||
cairo_rectangle (cr, area->x, area->y, area->width, area->height);
|
||||
gdk_cairo_rectangle (cr, area);
|
||||
cairo_clip (cr);
|
||||
cairo_new_path (cr);
|
||||
}
|
||||
|
||||
if (widget &&
|
||||
|
@ -7329,13 +7329,11 @@ text_window_invalidate_rect (GtkTextWindow *win,
|
||||
|
||||
#if 0
|
||||
{
|
||||
GdkColor color = { 0, 65535, 0, 0 };
|
||||
GdkGC *gc = gdk_gc_new (win->bin_window);
|
||||
gdk_gc_set_rgb_fg_color (gc, &color);
|
||||
gdk_draw_rectangle (win->bin_window,
|
||||
gc, TRUE, window_rect.x, window_rect.y,
|
||||
window_rect.width, window_rect.height);
|
||||
g_object_unref (gc);
|
||||
cairo_t *cr = gdk_cairo_create (win->bin_window);
|
||||
gdk_cairo_rectangle (cr, &window_rect);
|
||||
cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); /* red */
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ gtk_vruler_draw_ticks (GtkRuler *ruler)
|
||||
0, 0,
|
||||
widget->allocation.width, widget->allocation.height);
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (ruler->backing_store);
|
||||
cr = gdk_cairo_create (ruler->backing_store);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->fg[widget->state]);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
@ -303,7 +303,7 @@ gtk_vruler_draw_pos (GtkRuler *ruler)
|
||||
|
||||
if ((bs_width > 0) && (bs_height > 0))
|
||||
{
|
||||
cairo_t *cr = gdk_drawable_create_cairo_context (widget->window);
|
||||
cairo_t *cr = gdk_cairo_create (widget->window);
|
||||
|
||||
/* If a backing store exists, restore the ruler */
|
||||
if (ruler->backing_store)
|
||||
|
@ -2744,7 +2744,25 @@ gtk_widget_queue_shallow_draw (GtkWidget *widget)
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
if (!GTK_WIDGET_REALIZED (widget))
|
||||
return;
|
||||
|
||||
gtk_widget_get_draw_rectangle (widget, &rect);
|
||||
|
||||
/* get_draw_rectangle() gives us window coordinates, we
|
||||
* need to convert to the coordinates that widget->allocation
|
||||
* is in.
|
||||
*/
|
||||
if (!GTK_WIDGET_NO_WINDOW (widget) && widget->parent)
|
||||
{
|
||||
int wx, wy;
|
||||
|
||||
gdk_window_get_position (widget->window, &wx, &wy);
|
||||
|
||||
rect.x += wx;
|
||||
rect.y += wy;
|
||||
}
|
||||
|
||||
region = gdk_region_rectangle (&rect);
|
||||
gtk_widget_invalidate_widget_windows (widget, region);
|
||||
gdk_region_destroy (region);
|
||||
|
@ -197,7 +197,7 @@ on_expose_event (GtkWidget *widget,
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = gdk_drawable_create_cairo_context (widget->window);
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
|
||||
draw (cr, widget->allocation.width, widget->allocation.height);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user