Commit 2737c67c authored by Benjamin Otte's avatar Benjamin Otte

css: Round shadow extents properly

Otherwise drawing will be clipped.

Testcase included
parent 67456304
......@@ -21,6 +21,8 @@
#include "gtkcssshadowsvalueprivate.h"
#include <math.h>
#include "gtkcairoblurprivate.h"
#include "gtkcssshadowvalueprivate.h"
......@@ -337,10 +339,10 @@ _gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
&radius, &spread);
clip_radius = _gtk_cairo_blur_compute_pixels (radius);
b.top = MAX (0, clip_radius + spread - voffset);
b.right = MAX (0, clip_radius + spread + hoffset);
b.bottom = MAX (0, clip_radius + spread + voffset);
b.left = MAX (0, clip_radius + spread - hoffset);
b.top = MAX (0, ceil (clip_radius + spread - voffset));
b.right = MAX (0, ceil (clip_radius + spread + hoffset));
b.bottom = MAX (0, ceil (clip_radius + spread + voffset));
b.left = MAX (0, ceil (clip_radius + spread - hoffset));
border->top = MAX (border->top, b.top);
border->right = MAX (border->right, b.right);
......
......@@ -337,6 +337,9 @@ testdata = \
separator-size.ui \
set-default-direction.ui \
set-default-direction.ref.ui \
shadow-clip-rounding.css \
shadow-clip-rounding.ref.ui \
shadow-clip-rounding.ui \
shorthand-entry-border.css \
shorthand-entry-border.ref.ui \
shorthand-entry-border.ui \
......
@import "reset-to-defaults.css";
.test {
box-shadow: 0 0.99999px red;
}
.reference {
box-shadow: 0 1px red;
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="width_request">100</property>
<property name="height_request">100</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="label" translatable="yes">X</property>
<style>
<class name="reference"/>
</style>
</object>
</child>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window1">
<property name="width_request">100</property>
<property name="height_request">100</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="label" translatable="yes">X</property>
<style>
<class name="test"/>
</style>
</object>
</child>
</object>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment