summaryrefslogtreecommitdiff
path: root/gtk/gtkcairoblur.c
Commit message (Collapse)AuthorAgeFilesLines
* Make the blur code compile with clangMatthias Clasen2015-03-221-10/+23
| | | | | | | | clang complains that the expression involving sqrt() is not constant, and thus refuses to accept it as a case label. So, use precomputed values instead. https://bugzilla.gnome.org/show_bug.cgi?id=746468
* shadow-box: Blur only horizontally/vertically for the non-corner partsAlexander Larsson2015-03-211-14/+25
| | | | | | | | 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/+3
| | | | | | | | | | | | 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
* gtkcairoblur: Unroll inner loop for common radius valuesAlexander Larsson2015-03-211-11/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This unrolls the inner blur loop for radius 1-10, allowing the compiler to use a divide-by-constant operation instead of a generic division. Here is the blur-performance output before: Radius 1: 124.95 msec, 32.01 kpixels/msec: Radius 2: 117.27 msec, 34.11 kpixels/msec: Radius 3: 123.57 msec, 32.37 kpixels/msec: Radius 4: 118.17 msec, 33.85 kpixels/msec: Radius 5: 119.32 msec, 33.52 kpixels/msec: Radius 6: 124.17 msec, 32.21 kpixels/msec: Radius 7: 121.04 msec, 33.05 kpixels/msec: Radius 8: 130.64 msec, 30.62 kpixels/msec: Radius 9: 119.47 msec, 33.48 kpixels/msec: Radius 10: 117.95 msec, 33.91 kpixels/msec: Radius 11: 122.38 msec, 32.68 kpixels/msec: Radius 12: 121.92 msec, 32.81 kpixels/msec: Radius 13: 125.45 msec, 31.89 kpixels/msec: Radius 14: 121.63 msec, 32.89 kpixels/msec: Radius 15: 120.18 msec, 33.28 kpixels/msec: And after: Radius 1: 42.26 msec, 94.65 kpixels/msec: Radius 2: 59.15 msec, 67.62 kpixels/msec: Radius 3: 60.29 msec, 66.35 kpixels/msec: Radius 4: 64.53 msec, 61.99 kpixels/msec: Radius 5: 60.07 msec, 66.59 kpixels/msec: Radius 6: 62.43 msec, 64.07 kpixels/msec: Radius 7: 60.36 msec, 66.27 kpixels/msec: Radius 8: 59.59 msec, 67.13 kpixels/msec: Radius 9: 76.17 msec, 52.51 kpixels/msec: Radius 10: 79.41 msec, 50.37 kpixels/msec: Radius 11: 118.92 msec, 33.64 kpixels/msec: Radius 12: 121.31 msec, 32.97 kpixels/msec: Radius 13: 118.30 msec, 33.81 kpixels/msec: Radius 14: 116.82 msec, 34.24 kpixels/msec: Radius 15: 116.99 msec, 34.19 kpixels/msec: I.e. almost double performance for the unrolled radius values. https://bugzilla.gnome.org/show_bug.cgi?id=746468
* gtkcairoblur: Minor restructureAlexander Larsson2015-03-211-17/+13
| | | | | | | This just moves get_box_filter_size to the top and makes it a macro (so it can be used as a constant later). https://bugzilla.gnome.org/show_bug.cgi?id=746468
* blur: Simplify return_if_fail()Benjamin Otte2015-02-051-4/+1
|
* cairoblur: Fix the blur again once moreJasper St. Pierre2014-10-271-5/+20
| | | | | | | | The differences between the mutter and GTK+ code are subtle, but it turns out that _gtk_cairo_blur_compute_pixels actually returns the shadow *spread*. Since we use a triple box blur, the constant was multiplied by 1.5 to approximate three chained box blurs. Split this out and use the correct value for the lobe width.
* cairoblur: Fix the blur codeJasper St. Pierre2014-10-271-2/+3
| | | | | | | | We weren't passing in the right "d" value, which was causing the blur to behave incorrectly, especially in the case of 1px blurs, which would cause no blurs at all. The blur should now match the web.
* gtkcairoblur: Relicense under LGPLJasper St. Pierre2014-08-311-12/+11
| | | | | | Both Owen Taylor and I, the originators of this code, allow the code herein be relicensed to the LGPL, which is what GTK+ ships with. This prevents GTK+ from being GPL-only.
* Small comment fixupsMatthias Clasen2014-08-031-9/+8
| | | | | | One factual pointed out in the review in https://bugzilla.gnome.org/show_bug.cgi?id=734053, plus some formatting nit picks.
* gtkcairoblur: Replace our exponential blur with the box blur from mutterJasper St. Pierre2014-08-031-150/+149
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=734053
* gtkcairoblur: Blur a CAIRO_A8 surface instead of a full CAIRO_ARGB32Jasper St. Pierre2014-07-291-58/+9
| | | | This is considerably faster to draw and paint.
* docs: use proper quotations instead of '*'William Jon McCann2014-02-071-2/+2
|
* css: Fix computation of pixels occupied by blur radiusBenjamin Otte2014-02-031-0/+26
| | | | | | | | | 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
* blur: Do the same thing for rows and colsBenjamin Otte2012-09-201-1/+1
|
* blur: Use rowstrideBenjamin Otte2012-09-201-5/+12
|
* blur: Simplify codeBenjamin Otte2012-09-201-20/+7
| | | | It's always the same code, so there's no need for switch statements.
* blur: Fix pixel sizesBenjamin Otte2012-09-201-6/+3
| | | | | | The code accesses pixels in a chunks of 4 bytes, so we must only support formats where the size of a single pixel is 4 bytes. Fix RGB24 to be 4 bytes (the alpha channel is ignored) and disallow A8.
* blur: Take the radius as a double parameterBenjamin Otte2012-09-201-10/+5
| | | | It's only ever used like that
* Add code for blurring (original code from Unico, copyright fine for Gtk+)Andrea Cimitan2012-09-201-0/+267