forked from AuroraMiddleware/gtk
css: Round shadow extents properly
Otherwise drawing will be clipped. Testcase included
This commit is contained in:
parent
67456304d4
commit
2737c67cce
@ -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 \
|
||||
|
9
testsuite/reftests/shadow-clip-rounding.css
Normal file
9
testsuite/reftests/shadow-clip-rounding.css
Normal file
@ -0,0 +1,9 @@
|
||||
@import "reset-to-defaults.css";
|
||||
|
||||
.test {
|
||||
box-shadow: 0 0.99999px red;
|
||||
}
|
||||
|
||||
.reference {
|
||||
box-shadow: 0 1px red;
|
||||
}
|
23
testsuite/reftests/shadow-clip-rounding.ref.ui
Normal file
23
testsuite/reftests/shadow-clip-rounding.ref.ui
Normal file
@ -0,0 +1,23 @@
|
||||
<?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>
|
23
testsuite/reftests/shadow-clip-rounding.ui
Normal file
23
testsuite/reftests/shadow-clip-rounding.ui
Normal file
@ -0,0 +1,23 @@
|
||||
<?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>
|
Loading…
Reference in New Issue
Block a user