Commit Graph

42 Commits

Author SHA1 Message Date
Alexander Larsson
8524e0c150 gdk: Add gdk_cairo_surface_create_from_pixbuf 2013-07-03 14:34:13 +02:00
Matthias Clasen
894b1ae76a Avoid integer overflow
Use g_malloc_n in gdk_cairo_set_source_pixbuf when allocating
a large block of memory, to avoid integer overflow.

Pointed out by Bert Massop in
https://bugzilla.gnome.org/show_bug.cgi?id=703220
2013-06-29 22:06:54 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Javier Jardón
a3abc18858 Deprecate all the public API that is using GdkColor struct 2011-12-22 02:59:39 +00:00
Michel Dänzer
ab34c79896 Fix gdk_cairo_region_create_from_surface on big endian
gdk_cairo_region_create_from_surface doesn't work correctly on PPC.
This is most prominently seen with the GTK window resize grip, the
shape of which is mirrored every eight pixels horizontally.

At the same time, use an A1 surface for the resize grip shape to
eliminates an A8->A1 surface conversion.
2011-11-19 12:23:27 -05:00
Matthias Clasen
8291530abf More GDK documentation tweaks 2011-02-09 02:44:19 -05:00
Benjamin Berg
e8c103f652 Use cairo gobject support instead of a new boxed type. 2010-12-04 15:38:20 +01:00
Carlos Garnacho
02a30118c6 Add a boxed type for cairo_pattern_t. 2010-12-04 15:38:11 +01:00
Matthias Clasen
17e2c5391c Fix up parameter mismatches in the docs
And other minor gdk doc fixes.
2010-12-03 09:07:06 -05:00
Benjamin Otte
b9fc6a0c03 gdk: Remove remaining includes of gdkdrawable.h 2010-12-02 20:21:04 +01:00
Benjamin Otte
072498ae87 gdk: Make _gdk_window_ref_cairo_surface() protected and use it
... instead of _gdk_drawable_ref_cairo_surface() where appropriate.
Also, don't implement the drawable->create_cairo_surface vfunc anymore.

This is in preparation for the split of GdkWindow from GdkDrawable.
2010-12-02 20:21:02 +01:00
Benjamin Otte
97e6e9d212 API: Make gdk_cairo_create() take a GdkWindow
This is not strictly an API change as GdkDrawable is typedeffed to
GdkWindow, but it changes the header, so I'm marking it as such.
gdk_cairo_create() can only be used with windows these days, so it makes
sense to pass a window. With that, we can alseo remove the
set_cairo_clip() vfunc from GdkDrawable and implement it inside
gdkwindow.c.
2010-12-02 20:17:28 +01:00
Benjamin Otte
65dde2f92f API: Remove gdk_cairo_reset_clip()
You should not ever ever ever call cairo_reset_clip(). If you do, your
code is broken and you deserve everything you get.
And we should definitely not support this insanity.
2010-12-02 20:17:28 +01:00
Carlos Garnacho
5a5f8081f0 Add GdkRGBA struct to supersede GdkColor
GdkRGBA is a boxed struct similar to GdkColor, with the difference
that it stores alpha information as well, and colors are stored in
[0..1] doubles, in the cairo spirit.

gdk_cairo_set_source_rgba() has been also added to allow easier handling
of this new type.
2010-10-22 20:14:56 +02:00
Matthias Clasen
bda1f35585 Inclusion cleanups in sources
Try to do inclusions in the same sequence, more or less.
2010-10-14 22:09:36 -04:00
Matthias Clasen
0a8abdcdf6 docs: Update cairo-related docs 2010-10-12 11:29:55 -04:00
Xan Lopez
3f3d33ee6c Plug leak in gdkcairo.c
1,968 (1,236 direct, 732 indirect) bytes in 1 blocks are definitely lost in loss record 11,816 of 11,947
   at 0x4025BDC: malloc (vg_replace_malloc.c:195)
   by 0x6950676: _context_get (cairo.c:250)
   by 0x6950940: cairo_create (cairo.c:370)
   by 0x685CD1E: _gdk_cairo_surface_extents (gdkcairo.c:381)
   by 0x685CEDA: gdk_cairo_region_create_from_surface (gdkcairo.c:433)

Signed-off-by: Benjamin Otte <otte@redhat.com>
2010-10-11 02:33:09 +02:00
Javier Jardón
9009683247 docs: Region returned by gdk_cairo_region_create_from_surface() should be freed 2010-10-11 02:17:08 +02:00
Javier Jardón
4e71a4df7b docs: Move documentation to inline comments: cairo_interaction 2010-10-04 03:04:09 +02:00
Benjamin Otte
7203b72193 gdk: Fix gdk_cairo_region_create_from_surface() with device offsets 2010-09-30 16:24:41 +02:00
Matthias Clasen
2b3574dda1 Improve some docs 2010-09-27 20:59:08 -04:00
Benjamin Otte
d4f08efd57 API: add gdk_cairo_get_clip_rectangle() convenience API 2010-09-26 15:11:34 +02:00
Benjamin Otte
6607f2b794 API: Rename gdk_set_source_pixmap() to gdk_set_source_window()
That's what it's used for now.
2010-09-26 15:11:30 +02:00
Benjamin Otte
96b387599d API: Add gdk_cairo_region_create_from_surface()
The function converts the given surface into an alpha bitmap mask. This
is mostly useful for setting shape regions.

Also adds a new internal function _gdk_cairo_surface_extents() that
computes a surface's extents.
2010-09-26 15:02:59 +02:00
Javier Jardón
404e7d0e00 gdk/: fully remove gdkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:21:31 +02:00
Benjamin Otte
300e6b84cd s/GdkRegion/cairo_region_t/ in all of gtk
https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +02:00
Benjamin Otte
78018767ba Implement GdkRegion in terms of cairo_region_t
Only changes in headers: GdkRegion and GdkRectangle are typedeffed to
cairo_region_t and cairo_rectangle_int_t respectively. The region type
was opaque anyway so it doesn't matter and the rectangle types are
identical.

https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +02:00
Alexander Larsson
45956aea21 Add gdk_cairo_reset_clip
This is required to get back the original drawable clip due to
non-native windows on a cairo_t.
2009-09-01 17:06:41 +02:00
Alexander Larsson
eabac453e6 Initial client-side-windows work
The history before this was kind of twisted as several different
approaches were tested, so that was all squashed into this initial
commit to hide the uninteresting changes and files that were later
removed.
2009-04-02 10:14:01 +02:00
Matthias Clasen
e326046d5a Add a note that cairo contexts cannot be cached for handling expose
* gdk/gdkcairo.c (gdk_cairo_create): Add a note that cairo
        contexts cannot be cached for handling expose events.
        Proposed by Behdad Esfahbod.


svn path=/trunk/; revision=20800
2008-07-07 00:28:37 +00:00
Cody Russell
57223c9a05 Revert name change
svn path=/trunk/; revision=20724
2008-07-01 22:57:50 +00:00
Cody Russell
fce9c8b7d4 Practically everything changed.
2008-06-30  Cody Russell  <bratsche@gnome.org>

        * Practically everything changed.

        Change	all references	of GIMP	Toolkit	(and variations	of it)
        to GTK+	Toolkit, showing no mercy at all to our	beloved
	ancestry. (#540529)


svn path=/trunk/; revision=20709
2008-06-30 23:01:56 +00:00
Matthias Clasen
9ec6a65901 Bug 513811 – Use cairo_format_stride_for_width()
* gtk/gtkhsv.c (paint_ring, paint_triangle):
        * gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Use
        cairo_format_stride_for_width, proposed by Behdad Esfahbod.

        * configure.in: Bump cairo requirement to 1.6.0

        * INSTALL.in: Update required versions


svn path=/trunk/; revision=20170
2008-05-26 04:25:25 +00:00
Michael Natterer
92f86e0496 gdk/gdk.h gdk/gdkcairo.h gdk/gdkcolor.h gdk/gdkgc.h gdk/gdkinternals.h
2008-01-14  Michael Natterer  <mitch@imendio.com>

	* gdk/gdk.h
	* gdk/gdkcairo.h
	* gdk/gdkcolor.h
	* gdk/gdkgc.h
	* gdk/gdkinternals.h
	* gdk/gdkregion.h
	* gdk/gdkwindow.h: made GdkRectangle*, GdkRegion* and GdkColor*
	parameters const.

	* gdk/gdkcairo.c
	* gdk/gdkgc.c
	* gdk/gdkwindow.c
	* gdk/gdkrectangle.c
	* gdk/gdkpolyreg-generic.c
	* gdk/gdkregion-generic.c
	* gdk/directfb/gdkcolor-directfb.c
	* gdk/directfb/gdkgc-directfb.c
	* gdk/directfb/gdkgeometry-directfb.c
	* gdk/directfb/gdkwindow-directfb.c
	* gdk/quartz/gdkcolor-quartz.c
	* gdk/quartz/gdkgc-quartz.c
	* gdk/quartz/gdkgeometry-quartz.c
	* gdk/quartz/gdkwindow-quartz.c
	* gdk/win32/gdkcolor-win32.c
	* gdk/win32/gdkgc-win32.c
	* gdk/win32/gdkgeometry-win32.c
	* gdk/win32/gdkprivate-win32.h
	* gdk/win32/gdkwindow-win32.c
	* gdk/x11/gdkcolor-x11.c
	* gdk/x11/gdkgc-x11.c
	* gdk/x11/gdkgeometry-x11.c
	* gdk/x11/gdkmain-x11.c
	* gdk/x11/gdkprivate-x11.h
	* gdk/x11/gdkwindow-x11.c: changed accordingly.

	* gdk/gdkpolyreg-generic.c: uncruftify to have proper function
	headers.


svn path=/trunk/; revision=19365
2008-01-14 14:02:12 +00:00
Alp Toker
5ffdc33df0 Fix doc typos.
2007-06-01  Alp Toker  <alp.toker@collabora.co.uk>

	* gdk/gdkcairo.c (gdk_cairo_set_source_pixmap): Fix doc typos.


svn path=/trunk/; revision=17999
2007-06-01 05:10:50 +00:00
Dom Lachowicz
67ac65e146 Bug #330022 Wrong pixel values are computed when color = 0xFF and alpha =
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Bug #330022
	Wrong pixel values are computed when color = 0xFF and alpha = 0xFF
2006-02-05 20:34:43 +00:00
Matthias Clasen
b19cda7c37 Add gdk_cairo_set_source_pixmap. (#318805, Alexander Larsson)
2005-12-30  Matthias Clasen  <mclasen@redhat.com>

	* gdk/gdk.symbols:
	* gdk/gdkcairo.h:
	* gdk/gdkcairo.c: Add gdk_cairo_set_source_pixmap.  (#318805,
	Alexander Larsson)
2005-12-30 07:16:35 +00:00
Owen Taylor
3c4ffb12ab Fix the big endian case for 3-channel source. (Reported by David Zeuthen)
2005-06-23  Owen Taylor  <otaylor@redhat.com>

        * gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix the
        big endian case for 3-channel source. (Reported by
        David Zeuthen)
2005-06-23 13:49:06 +00:00
Owen Taylor
c96795ffb3 Fix #if G_BYTE_ORDER == GDK_LSB_FIRST.
2005-06-17  Owen Taylor  <otaylor@redhat.com>

        * gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
        #if G_BYTE_ORDER == GDK_LSB_FIRST.
2005-06-17 14:17:43 +00:00
Matthias Clasen
28bebc863a Small doc additions.
2005-06-12  Matthias Clasen  <mclasen@redhat.com>

	* gdk/gdkcairo.c: Small doc additions.
2005-06-12 05:20:04 +00:00
Kjartan Maraas
3003d2edc4 Destroy the cairo surface when done with it. Plugs a fairly large leak in
2005-06-10  Kjartan Maraas  <kmaraas@gnome.org>

	* gdk/gdkcairo.c: (gdk_cairo_set_source_pixbuf): Destroy the
	cairo surface when done with it. Plugs a fairly large leak in
	some cases.
	==6014== 1999824 (115640 direct, 1884184 indirect) bytes in
	826 blocks are definitely lost in loss record 25239 of 25250
	Like this from nautilus.
2005-06-10 19:53:47 +00:00
Owen Taylor
dda40ca71a 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
2005-05-11 19:16:19 +00:00