summaryrefslogtreecommitdiff
path: root/gtk/gtkcssshadowvalue.c
Commit message (Collapse)AuthorAgeFilesLines
* shadowsvalue: Don't draw invisible box shadowsTimm Bäder2016-05-051-0/+12
|
* cssshadowsvalue: Avoid allocating new value if not neededBenjamin Otte2016-05-051-0/+15
|
* cssshadowvalue: Fix copy/paste issueBenjamin Otte2016-03-201-2/+2
| | | | http://www.viva64.com/en/b/0383/
* css: Add gtk_css_number_value_can_parse()Benjamin Otte2016-02-131-3/+3
| | | | | | Use it instead of _gtk_css_parser_has_number(). We need that once we introduce calc() support.
* css shadows: Cache blured masks for the corners of outset shadowsAlexander Larsson2015-09-151-2/+117
| | | | | | | | | | A lot of time was spend rendering the shadows on windows with CSD, in particular the corner pieces, since they are the largest parts. This patch catches this particular case and caches the pre-rendered blur masks. This makes the shadow code go from 25% to 8% of the time when resizing gtk3-demo.
* css shadows: Break out side & corner shadows into helper functionsAlexander Larsson2015-09-151-80/+115
| | | | This changes nothing, but makes the code a bit easier to read
* css: Fix compiler warningsMatthias Clasen2015-06-021-4/+4
| | | | Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
* box-shadow: For top/bottom and left/right parts, repeat a single lineAlexander Larsson2015-03-211-2/+27
| | | | | | | | Since these part really are the same in all of the x or y direction and we don't blur in that direction we can just blur one line and repeat it during drawing. https://bugzilla.gnome.org/show_bug.cgi?id=746468
* shadow-box: Blur only horizontally/vertically for the non-corner partsAlexander Larsson2015-03-211-18/+31
| | | | | | | | There is no need to e.g. blur in the x-direction for the top part of a box shadow. Also, there is no need to extend the mask in the non-blurred direction. https://bugzilla.gnome.org/show_bug.cgi?id=746468
* shadow-box: Bail out blur early if radius is 1pxAlexander Larsson2015-03-211-1/+4
| | | | | | | | | | | | For radius 1px the current implementation rounds down to a 1 px box filter which is a no-op. Rather than creating useless shadow masks in this case we bail out blurring early. Another alternative would be to make radius 1px round up to a 2 px box filter, but that would change the rendering of Adwaita which is probably not a great idea this late in the cycle. https://bugzilla.gnome.org/show_bug.cgi?id=746468
* cssvalue: Remove GtkCssDependenciesBenjamin Otte2015-03-181-22/+6
| | | | They are not used anymore.
* css: Move scale to GtkStyleProviderPrivatewip/mir2Benjamin Otte2015-02-061-8/+7
| | | | | | This way, we can remove it as a separate argument from gtk_css_value_compute() and allow computation to only depend on one thing: the style provider.
* render: Remove spinner special-casesBenjamin Otte2015-01-201-23/+0
| | | | | | | | | The spinner is a regular builtin image now. There is no need to go through the shadows code manually anymore as regular items do get shadows automatically. This also allows simplifying the actual spinner drawing code so that it actually works.
* cssstyle: Rename GtkCssComputedValues => GtkCssStyleBenjamin Otte2015-01-071-2/+2
| | | | | This is literally just renaming of the object (and the associated source files). No other changes are in there.
* css: Avoid excessive shadow renderingMatthias Clasen2014-12-021-7/+6
| | | | | | | | | The shadow rendering code had code to exit early if we determine that the shadow is entirely clipped away. Unfortunately, the check based on cairo clip extents fails for any clip regions that are more complicated than axis-aligned rectangles, and we are using a hollow rounded rectangle here. So, instead, do the check manually, using the just-introduced API in GtkRoundedBox.
* configure.ac: Depend on cairo 1.14.0Javier Jardón2014-11-101-3/+1
| | | | This is needed for cairo_set_device_scale()
* shadows: Respect scaled factors for cached surfaceBenjamin Otte2014-10-101-3/+9
|
* cssshadowvalue: Add a cache for blurred Pango layoutsJasper St. Pierre2014-10-061-12/+110
| | | | | | | | | | | | | | | Drawing text with Pango is quite expensive, and drawing text and also blurring it is *really* expensive. To prevent us from drawing a lot of text and then blurring it a lot is *really* expensive. We now cache the blurred pixels for the last layout and shadow we made, which means we can repeatedly draw labels with a blurred text-shadow extremely fast. To detect whether the shadow is up-to-date, we track the serial of the PangoLayout alongside the radius of the box shadow. We don't support inset shadows nor spread on text-shadow, so we don't need to track these.
* themingengine: Move actual render functions to gtkrender.cBenjamin Otte2014-10-031-3/+2
| | | | | | GtkThemingEngine just always calls gtk_do_render_foo(engine->priv->context, ...) now. Other than that, the code is unchanged.
* cssshadowvalue: Move the check for blurring into its own functionJasper St. Pierre2014-10-031-6/+16
| | | | This makes it easier to update the check later.
* cssshadowvalue: Rename shadow_key to original_cr_keyJasper St. Pierre2014-10-031-3/+3
| | | | | | shadow_key is a poor name for this, and we're going to add more user data keys, so rename it to something more indicative of what it's used for.
* gtkcssshadowvalue: Use cairo_surface_create_similar_imageJasper St. Pierre2014-09-021-3/+4
| | | | | | Calling this on an Xlib surface allows us to keep this in SHM memory, giving it a potential speedup so we don't have to copy it to SHM memory for the Composite when we mask later.
* cssshadowvalue: Fix whitespaceJasper St. Pierre2014-08-311-4/+4
|
* Move gtkthemingengine to deprecated directoryMatthias Clasen2014-08-291-1/+2
| | | | This is the place for wholly-deprecated sources.
* gtkcssshadowvalue: Don't double-apply the alpha to shadowsJasper St. Pierre2014-08-021-7/+5
| | | | | | | | | | | | | | | | | | It turns out that when we were painting the shadows, we painted the them with the base color once, which contained the alpha, and then blurred it and used it as a mask for the fill, which has the fill again. To fix this, always paint the base surface with full alpha. The existing code applies the blur conditionally sometimes in weird ways, so the code shuffling fix may not look correct, but be assured it is. If the blur happens, the new cr we return has the *default* color applied, which is fully opaque black, which works perfectly against the A8 surface. The fallback spinner code needs some modification, since it is intentionally using the alpha to paint the lobes which are "in the past". Since we shouldn't be hitting this fallback path very often, we use a temporary group and paint it with paint_with_alpha, even though it is slow.
* gtkcairoblur: Blur a CAIRO_A8 surface instead of a full CAIRO_ARGB32Jasper St. Pierre2014-07-291-1/+1
| | | | This is considerably faster to draw and paint.
* gtkcssshadowvalue: Use the blur surface as a mask, instead of painting itJasper St. Pierre2014-07-291-2/+2
| | | | | This will make it easier to use an A8 for our blurred surface instead of a ARGB32, which makes things a lot easier and faster.
* css: Fix uninitializaed variableBenjamin Otte2014-06-101-0/+2
|
* css: Parse text-shadow values properlyBenjamin Otte2014-06-101-4/+6
| | | | | | We used to accept the same syntax for text-shadow and icon-shadow as we accept for box-shadow. However, box-shadow does accept a spread and the inset keyword while the others should not.
* css: Fix computation of pixels occupied by blur radiusBenjamin Otte2014-02-031-6/+2
| | | | | | | | | These computations were done randomly in lots of places and more often than not, they were also wrong. This function was copied (with docs) from Firefox: http://lxr.mozilla.org/mozilla-central/source/gfx/2d/Blur.cpp https://bugzilla.gnome.org/show_bug.cgi?id=723159
* css shadow: Fix memory leakPavel Vasin2013-08-311-0/+2
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=706493
* css: Add a scale argument to css-value compute vfuncAlexander Larsson2013-07-031-5/+6
| | | | | | | | We need to be able to compute different GtkCssImage values depending on the scale, and we need this at compute time so that we don't need to read any images other than the scale in used (to e.g. calculate the image size). GtkStyleProviderPrivate is shared for all style contexts, so its not right.
* css shadow: Add extra slop to the blur clippingAlexander Larsson2013-05-061-31/+38
| | | | | | | Turns out our blurring function isn't very nice, it has a lot of energy past the blur radius, so clipping at exactly the blur radius causes ugly gradient stops. This just adds 4 extra pixels of slop, which makes this better in most cases.
* css shadows: Split up rendering of shadowsAlexander Larsson2013-05-061-4/+151
| | | | | | | We split up the rendering of blurred shadows into 9 parts, the corners, the sides and the rest. This lets us only blur the "blurry" part, and it lets us completely skip blurry parts that are fully clipped.
* css shadows: Exit early if clip is emptyAlexander Larsson2013-05-061-0/+18
|
* GtkCssShadowValue: Break out the shadow rendering codeAlexander Larsson2013-05-061-11/+22
| | | | | This makes it easier to call it multiple times which we want to do later.
* css: Clip outset box-shadow to outside of boxAlexander Larsson2013-05-061-6/+21
| | | | | | | | | | As per css3-background 7.2. Drop Shadows: the ‘box-shadow’ property: An outer box-shadow casts a shadow as if the border-box of the element were opaque. The shadow is drawn outside the border edge only: it is clipped inside the border-box of the element. Also verified vs firefox behaviour.
* cssshadow: add a method to get the size of a shadows valueCosimo Cecchi2013-04-221-0/+20
| | | | The method returns the size of each side of a GtkCssShadowsValue.
* cds: enable outset shadowsChris Cummins2013-04-091-4/+19
| | | | | | | | | | Adds conditional code paths to GdkCssShadowValue for painting outset shadows, and allows shadows to be applied in two passes (first outset then inset). This can be used to draw csd shadows in outer window borders. https://bugzilla.gnome.org/show_bug.cgi?id=695998 Signed-off-by: Rob Bradford <rob@linux.intel.com>
* cssvalue: Convert shadows to GtkCssColorValueBenjamin Otte2012-11-081-5/+3
|
* cssshadow: plug a cairo_surface_t leakCosimo Cecchi2012-10-161-0/+1
| | | | | | | We were never destroying the cairo surface we use for blurring, which would lead to a huge leak. https://bugzilla.gnome.org/show_bug.cgi?id=686209
* css: Huge refactoring to avoid computing wrong valuesBenjamin Otte2012-09-281-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Here's the shortest description of the bug I can come up with: When computing values, we have 3 kinds of dependencies: (1) other properties ("currentColor" or em values) (2) inherited properties ("inherit") (3) generic things from the theme (@keyframes or @define-color) Previously, we passed the GtkStyleContext as an argument, because it provided these 3 things using: (1) _gtk_style_context_peek_property() (2) _gtk_style_context_peek_property(gtk_style_context_get_parent()) (3) context->priv->cascade However, this makes it impossible to lookup values other than the ones accessible via _gtk_style_context_peek_property(). And this is exactly what we are doing in gtk_style_context_update_cache(). So when the cache updates encountered case (1), they were looking up the values from the wrong style data. So this large patch essentially does nothing but replace the context argument in all compute functions with new arguments for the 3 cases above: (1) values (2) parent_values (3) provider We apparently have a lot of computing code.
* Revert "blur: Use recording surface for capturing things to blur"Benjamin Otte2012-09-211-33/+12
| | | | | | | | This reverts commit f2cb8f12705ab3a36767df3430f8868ed7b29536. The patch actually didn't work for at least text. I currently have no clue why, but I suspect it requires investigating Cairo code and recording surfaces, and I'll not do that right now.
* blur: Use recording surface for capturing things to blurBenjamin Otte2012-09-201-12/+33
| | | | | This gets around clipping issues quite nicely and provides us with a (mostly theoretical) performance boost.
* shadow: add blur to icon-shadow (spinner)Andrea Cimitan2012-09-201-0/+4
|
* shadow: add blur to icon-shadow (icon)Andrea Cimitan2012-09-201-0/+5
|
* shadow: add blur to box-shadowAndrea Cimitan2012-09-201-4/+12
|
* shadow: add blur to text-shadowAndrea Cimitan2012-09-201-0/+5
|
* shadow: add code to render blurred shadowsCosimo Cecchi2012-09-201-0/+63
| | | | | | | | | | | | | | | Split out the blurred shadow rendering in three steps: - creation of a surface of the appropriate size - we use the clip rectangle as a good measurement for the size, since we won't render out of it anyway - painting the unblurred shape on the surface - this is responsibility of the single shadow implementations - blur the surface and compose the result back on the original cairo_t This means we can share code between the implementations for the first and third steps; it also makes the code independent of the rendered size, so we can avoid passing down a cairo_rectangle_t with e.g. the icon coordinates.
* cssvalue: Pass property ID to transition functionBenjamin Otte2012-09-031-5/+6
| | | | | | | This is to allow animating arrays properly. I'm not really thrilled about this solution (we leak propertys into the values again...), but it's the best I can come up with - I prefer it to having N different array types...