Commit Graph

24 Commits

Author SHA1 Message Date
Benjamin Otte
fce45757cb borderimage: Change memory management
Making it a on-stack object simplifies things a lot.
2012-01-09 18:37:58 +01:00
Benjamin Otte
9b47a6a4e3 border-image: Remove pack/unpack functions
They are not used anymore. Also, it's no longer necessary to register
GtkBorderImage as a custom GType.
2012-01-09 18:37:58 +01:00
Benjamin Otte
84bc280440 borderimage: Add _gtk_border_image_new_for_context()
and use it.
2012-01-09 18:37:57 +01:00
Benjamin Otte
cee05fbeb8 borderimage: Remove unused enums 2012-01-09 18:37:57 +01:00
Benjamin Otte
37b11b6c8a borderimage: Convert to using GtkCssImage 2012-01-09 18:37:57 +01:00
Benjamin Otte
32c8bbb575 styleproperty: Remove context arg from _gtk_style_context_query() 2012-01-09 18:37:56 +01:00
Alexander Larsson
d85aabe1e3 Rename GTK_CSS_REPEAT_STYLE_NONE to GTK_CSS_REPEAT_STYLE_STRETCH
This is a private type, and the CSS default value is "stretch", which
is how we were parsing and printing NONE anyway.

With this fix we can use the enum stuff for printing/parsing
2011-11-25 15:36:08 +01:00
Alexander Larsson
c09148ca09 Add GtkStylePropertyContext and use it in when getting style properties
At the toplevel we have _gtk_theming_engine_get, which lets us pass
in a property context with (atm) the size to get the property for.
Then there is a lot of plumbing to push this down into the lower
layers of the style property code until finally hitting
the property resolvers.

I need this because I will be adding a property resolver for win32
theme parts, and they render differently depending on the size
(i.e. they don't scale linearly). The idea is that the code
to get the background properties will pass in the final size
and we will resolve the theme part specification to that particular
size.

If the old non-context calls are used we just hardcode a size
of 100x100.
2011-11-17 12:27:22 +01:00
Alexander Larsson
e953465e33 Save a generic boxes source in GtkImageBorder
We used to special handle gradient, but we want to be able to store
other sources (that will eventually resolve to cairo patterns).
For instance, this is needed to handle win32 theme part sources.
2011-11-17 12:27:21 +01:00
Marc-André Lureau
ee7ac4fa44 Rename s/GtkCssRepeatStyle/GtkCssBorderRepeatStyle/g
https://bugzilla.gnome.org/show_bug.cgi?id=663522
2011-11-08 11:10:41 -05:00
Chun-wei Fan
ad73ed298d Include C89 fallback code
gtk/gtkborderimage.c, gtk/gtklabel.c and gtk/gtkstyleproperty.c call
round() and/or rint(), which was only available in C99 compilers.

This adds the inclusion of the fallback implementation (gtk/fallback-c89.c)
to define these functions if they are not initially made available by the
compiler.

Also remove the rint() implementation in gtk/gtklabel.c as it is now in
the fallback implmentation.
2011-08-20 11:17:44 +08:00
Xan Lopez
8eb48a876b border-image: Fix leakage 2011-06-15 13:46:16 +02:00
Cosimo Cecchi
9e5d6544ba border-image: unpack the GtkGradient if there's one
So that it will eventually be resolved by the style property lookup
machinery.
2011-06-09 23:07:50 -04:00
Cosimo Cecchi
3d1407a01a border-image: add support for border-image-width too
It's useful to set a slice size != border-width, as backgrounds are
clipped to border-width too.

As slices can be half-transparent and overlap the background,
this would not fill the border box properly if we only use a single
property for specifying the width.

Also, this brings us even closer to CSS3.
2011-06-09 20:01:57 -04:00
Cosimo Cecchi
c935439a72 border-image: fix a horizontal/vertical index typo 2011-06-09 17:06:00 -04:00
Cosimo Cecchi
42d7487a6e border-image: don't try to unpack values from a NULL border-image
NULL is a valid value for border-image, so if it's NULL when unpacking,
don't try to access the struct fields, but just init the GValues for the
unpacked parameters.
2011-06-09 15:06:18 -04:00
Benjamin Otte
3ef4a3d46f border-image: Redo border-image rendering
The new code is smaller, less crashy and correct(er), but arguably more
complex. I'd have liked to make it simpler, but this border image
algorithm is complex...
2011-06-09 05:51:54 +02:00
Benjamin Otte
9606633d94 border-image-repeat: Fix order of hrepeat and vrepeat 2011-06-09 05:51:54 +02:00
Benjamin Otte
4f8283055e border-image: Don't use NEAREST filtering
use EXTEND_PAD instead to avoid borders.
2011-06-09 05:51:54 +02:00
Benjamin Otte
c0a6b1fb90 borderimage: No need to resolve
border-image is a shorthand, so it's unpacked unresolved and repacked
resolved.
2011-06-09 05:51:54 +02:00
Cosimo Cecchi
4e95e6ae21 border-image: move private types to gtkcsstypes.c 2011-06-09 05:51:54 +02:00
Cosimo Cecchi
052d6ef6da border-image: don't cache the cairo_surface_t in GtkBorderImage
It's not useful to cache these surfaces here, as the GtkBorderImage will
be always generated on the fly, being a shorthand property.

This also allows to get rid of the intermediate image surfaces for
rendering the slices; we now use cairo_surface_create_for_rectangle()
to proxy the slices from the source surface to the rendered area, which
should also yield better performance.
2011-06-09 05:51:54 +02:00
Cosimo Cecchi
4cfccde6da border-image: ensure image->resolved is set when resolving the gradient
https://bugzilla.gnome.org/show_bug.cgi?id=651194
2011-06-09 05:51:54 +02:00
Cosimo Cecchi
9976530fe0 border-image: change Gtk9Slice to GtkBorderImage
It's a similar private type, which is much more powerful, and respects
the CSS rendering specification for border-image.

https://bugzilla.gnome.org/show_bug.cgi?id=651194
2011-06-09 05:51:53 +02:00