After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 328853 - Not all GdkGC value setters are implemented.
Not all GdkGC value setters are implemented.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: Richard Hult
gtk-bugs
: 350826 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-01-27 15:36 UTC by Thomas Broyer
Modified: 2006-09-21 17:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Implements almost all GdkGC value setters + _gdk_window_gc_copy (10.78 KB, patch)
2006-01-27 15:40 UTC, Thomas Broyer
none Details | Review
Updated patch, now with gdk_quartz_update_context_from_gc (28.91 KB, patch)
2006-01-30 09:03 UTC, Thomas Broyer
none Details | Review

Description Thomas Broyer 2006-01-27 15:36:41 UTC
GdkGC only handles the clip mask setter.
Comment 1 Thomas Broyer 2006-01-27 15:40:35 UTC
Created attachment 58217 [details] [review]
Implements almost all GdkGC value setters + _gdk_window_gc_copy

Implements almost all GdkGC value setters and getters + _gdk_window_gc_copy(GdkGC*, GdkGC*)

Not yet implemented: font, function, subwindow mode and graphics exposures.

This patch does not update _gdk_update_context_from_gc, this one should probably take an additional parameter serving as a mask for values to set (merely stroke and/or fill attributes).
Comment 2 Thomas Broyer 2006-01-30 09:03:53 UTC
Created attachment 58379 [details] [review]
Updated patch, now with gdk_quartz_update_context_from_gc

2006-01-30  Thomas Broyer <t.broyer@gmail.com>

	* gdk/quartz/gdkquartz.h: Added some public Quartz-specific
	  functions (FIXME: need documentation)

	* gdk/quartz/gdkprivate-quartz.h: Added fields to GdkGCQuartz
	and reflected some method changes (see other changed files)

	* gdk/quartz/gdkdrawable-quartz.h (_gdk_quartz_drawable_get_context,
	_gdk_quartz_drawable_release_context): made public in gdkquartz.h

	* gdk/quartz/gdkgc-quartz.c: Implemented more value setters.

	(gdk_update_context_from_gc): made public in gdkquartz.h and
	added a mask parameter to filter out values to be reflected
	from the GdkGC onto the CGContext.

	* gdk/quartz/gdkcolor-quartz.c:
	(_gdk_quartz_set_context_fill_color_from_pixel,
	(_gdk_quartz_set_context_stroke_color_from_pixel): Removed.

	(_gdk_quartz_get_rgba_from_pixel): Added.

	* gdk/quartz/GdkQuartzView.c (drawRect): replaced
	_gdk_quartz_set_context_{stroke,fill}_color_from_pixel with
	_gdk_quartz_get_rgba_from_pixel and CGContextSetRGB{Stroke,Fill}Color.

	* gdk/quartz/gdkdrawable-quartz.c: removed
	_gdk_quartz_set_context_{stroke,fill}_color_from_pixel as this is
	done in gdk_quartz_update_context_from_gc, used now with the
	appropriate mask argument. Some methods rewritten to use "batch"
	Quartz functions (e.g. CGContextStrokeLineSegments) instead of paths.

	(gdk_quartz_draw_points): rewritten and improved
Comment 3 Thomas Broyer 2006-01-30 09:06:55 UTC
Oops, forgot to say that I still don't have a dev environment yet, so the code has not be tested nor even compiled; sorry for the inconvenience...
Comment 4 Anders Carlsson 2006-03-06 08:43:15 UTC
I wonder if we can make gdk_quartz_update_context_from_gc actually set both the fill and the stroke color. I have yet to come across a case where a gdk function needs them to be different. What do you think?
Comment 5 Michael Natterer 2006-08-15 15:49:51 UTC
*** Bug 350826 has been marked as a duplicate of this bug. ***
Comment 6 Michael Natterer 2006-08-15 15:51:58 UTC
I'm about to manually apply this patch and adding some missing properties
like the drawing function (see #350826).
Comment 7 Michael Natterer 2006-09-21 17:06:23 UTC
Fixed in CVS:

2006-09-21  Michael Natterer  <mitch@imendio.com>

       Implement lots of value setters for GdkGC, based on a heavily
       modified patch from Thomas Broyer (bug #328853):

	* gdk/quartz/gdkcolor-quartz.c: removed functions which set colors
	on the CGContext. Instead, added gdk_quartz_get_rgba_from_pixel()
	which simply returns RGBA values from a GdkColor's pixel value.
	See gdk_quartz_update_context_from_gc() below.

	* gdk/quartz/gdkprivate-quartz.h (struct GdkGCQuartz): added lots
	of members for the newly suppored GC values. Added enum
	GdkQuartzContextValuesMask which is used for setting up the
	CGContext for filling and/or stroking.

	* gdk/quartz/gdkgc-quartz.c (gdk_quartz_gc_get_values)
	(gdk_quartz_gc_set_values)
	(_gdk_windowing_gc_copy): support a lot more GC values.

	(gdk_quartz_update_context_from_gc): added
	GdkQuartzContextValuesMask parameter and set filling/stroking
	parameters accordingly. This function also gained full control
	over the FG and BG colors (they can't be set separately any more).

	The stipple mask part of the patch doesn't work but seems to take
	the right approach and doesn't make things worse, so I applied it.

	Did *not* apply the clipping part of the patch since I don't
	understand it (I don't understand the version in CVS either, but
	it at least works :-)

	* gdk/quartz/gdkdrawable-quartz.c: pass the right masks to
	gdk_quartz_update_context_from_gc() and removed separate color
	setting calls. Some minor fixes.

	* gdk/quartz/gdkwindow-quartz.c
	(gdk_window_impl_quartz_begin_paint_region): set the CGContext's
	fill color manually. We don't have/need a GC here.