GskTransform: Ignore identity transforms

We often end up with e.g. a scale of 1 or a translation by 0/0. Ignore
those transforms since they don't do anything.
This commit is contained in:
Timm Bäder 2019-06-03 16:20:12 +02:00
parent efe9bba343
commit 05ca772631
3 changed files with 2971 additions and 2988 deletions

View File

@ -644,7 +644,10 @@ gsk_transform_translate_3d (GskTransform *next,
const graphene_point3d_t *point)
{
GskTranslateTransform *result;
if (graphene_point3d_equal (point, graphene_point3d_zero ()))
return gsk_transform_ref (next);
if (gsk_transform_has_class (next, &GSK_TRANSLATE_TRANSFORM_CLASS))
{
GskTranslateTransform *t = (GskTranslateTransform *) next;
@ -797,6 +800,9 @@ gsk_transform_rotate (GskTransform *next,
{
GskRotateTransform *result;
if (angle == 0.0f)
return gsk_transform_ref (next);
if (gsk_transform_has_class (next, &GSK_ROTATE_TRANSFORM_CLASS))
{
GskTransform *r = gsk_transform_rotate (gsk_transform_ref (next->next),
@ -921,10 +927,13 @@ gsk_transform_rotate_3d (GskTransform *next,
const graphene_vec3_t *axis)
{
GskRotate3dTransform *result;
if (graphene_vec3_get_x (axis) == 0.0 && graphene_vec3_get_y (axis) == 0.0)
return gsk_transform_rotate (next, angle);
if (angle == 0.0f)
return gsk_transform_ref (next);
result = gsk_transform_alloc (&GSK_ROTATE3D_TRANSFORM_CLASS,
GSK_TRANSFORM_CATEGORY_3D,
next);
@ -1110,7 +1119,10 @@ gsk_transform_scale_3d (GskTransform *next,
float factor_z)
{
GskScaleTransform *result;
if (factor_x == 1 && factor_y == 1 && factor_z == 1)
return gsk_transform_ref (next);
if (gsk_transform_has_class (next, &GSK_SCALE_TRANSFORM_CLASS))
{
GskScaleTransform *scale = (GskScaleTransform *) next;

View File

@ -1,25 +1,85 @@
transform {
child: container {
color {
bounds: 0 0 404 204;
color: rgb(246,245,244);
}
container {
container {
transform {
child: container {
color {
bounds: 0 0 404 204;
color: rgb(246,245,244);
}
container {
container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(225,222,219);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 26 26 / 13;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 26 26 / 13;
}
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(225,222,219);
child: linear-gradient {
bounds: 0 0 24 24;
end: 12 24;
start: 12 0;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
clip: -1 -1 50 26 / 13;
clip: -1 -1 26 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 24 24 / 12;
}
container {
}
border {
colors: rgb(191,184,177);
outline: -1 -1 26 26 / 13;
}
}
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 145 18;
}
transform: translate(56, 0);
}
}
transform {
child: container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(53,132,228);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(24,95,180);
outline: -1 -1 50 26 / 13;
}
transform {
child: container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
@ -48,294 +108,213 @@ transform {
}
}
border {
colors: rgb(191,184,177);
colors: rgb(24,95,180);
outline: -1 -1 26 26 / 13;
}
}
transform: translate(24, 0);
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 145 18;
}
transform: translate(56, 0);
}
transform: translate(1, 1);
}
transform {
child: container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(53,132,228);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(24,95,180);
outline: -1 -1 50 26 / 13;
}
transform {
child: container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 26 26 / 13;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 26 26 / 13;
}
rounded-clip {
child: cross-fade {
end: linear-gradient {
bounds: 0 0 24 24;
end: 12 24;
start: 12 0;
stops: 0.1 rgb(255,255,255), 0.9 rgb(255,255,255);
}
progress: 0.756154;
start: cross-fade {
end: linear-gradient {
bounds: 0 0 24 24;
end: 12 24;
start: 12 0;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
progress: 0.788575;
start: color {
bounds: 0 0 24 24;
color: rgb(246,245,244);
}
}
}
clip: -1 -1 26 26 / 13;
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 24 24 / 12;
}
}
border {
colors: rgb(24,95,180);
outline: -1 -1 26 26 / 13;
}
}
transform: translate(24, 0);
}
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Enabled";
offset: 147 18;
}
transform: translate(56, 0);
}
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Enabled";
offset: 147 18;
}
transform: translate(0, 38);
}
transform {
child: container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(250,249,248);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
container {
rounded-clip {
child: color {
bounds: 0 0 24 24;
color: rgb(250,249,248);
}
clip: -1 -1 26 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 26 26 / 13;
}
}
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 145 18;
}
transform: translate(56, 0);
}
}
transform: translate(0, 76);
}
transform {
child: container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(250,249,248);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
transform {
child: container {
rounded-clip {
child: color {
bounds: 0 0 24 24;
color: rgb(250,249,248);
}
clip: -1 -1 26 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 26 26 / 13;
}
}
transform: translate(24, 0);
}
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Enabled";
offset: 147 18;
}
transform: translate(56, 0);
}
}
transform: translate(0, 114);
}
transform {
child: container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(225,222,219);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 26 26 / 13;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 26 26 / 13;
}
rounded-clip {
child: linear-gradient {
bounds: 0 0 24 24;
end: 12 24;
start: 12 0;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
clip: -1 -1 26 26 / 13;
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 24 24 / 12;
}
}
border {
colors: rgb(191,184,177);
outline: -1 -1 26 26 / 13;
}
}
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 123 18;
}
transform: translate(78, 0);
}
transform {
child: transform {
child: container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 16 16 / 3;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 16 16 / 3;
}
linear-gradient {
bounds: 0 0 14 14;
end: 7 14;
start: 7 0;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 14 14 / 2;
}
}
border {
colors: rgb(191,184,177);
outline: -1 -1 16 16 / 3;
}
}
transform: translate(1, 6);
}
transform: translate(388, 0);
}
}
transform: translate(0, 152);
transform: translate(56, 0);
}
}
transform: translate(0, 38);
}
transform {
child: container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(250,249,248);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
container {
rounded-clip {
child: color {
bounds: 0 0 24 24;
color: rgb(250,249,248);
}
clip: -1 -1 26 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 26 26 / 13;
}
}
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 145 18;
}
transform: translate(56, 0);
}
}
transform: translate(0, 76);
}
transform {
child: container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(250,249,248);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
transform {
child: container {
rounded-clip {
child: color {
bounds: 0 0 24 24;
color: rgb(250,249,248);
}
clip: -1 -1 26 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 26 26 / 13;
}
}
transform: translate(24, 0);
}
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Enabled";
offset: 147 18;
}
transform: translate(56, 0);
}
}
transform: translate(0, 114);
}
transform {
child: container {
transform {
child: container {
rounded-clip {
child: color {
bounds: -1 -1 50 26;
color: rgb(225,222,219);
}
clip: -1 -1 50 26 / 13;
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 26 26 / 13;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 26 26 / 13;
}
rounded-clip {
child: linear-gradient {
bounds: 0 0 24 24;
end: 12 24;
start: 12 0;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
clip: -1 -1 26 26 / 13;
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 24 24 / 12;
}
}
border {
colors: rgb(191,184,177);
outline: -1 -1 26 26 / 13;
}
}
}
transform: translate(1, 1);
}
transform {
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 123 18;
}
transform: translate(78, 0);
}
transform {
child: transform {
child: container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 16 16 / 3;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 16 16 / 3;
}
linear-gradient {
bounds: 0 0 14 14;
end: 7 14;
start: 7 0;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 14 14 / 2;
}
}
border {
colors: rgb(191,184,177);
outline: -1 -1 16 16 / 3;
}
}
transform: translate(1, 6);
}
transform: translate(388, 0);
}
}
transform: translate(0, 152);
}
transform: translate(0, 0);
}

File diff suppressed because one or more lines are too long