Skip to content

Commit

Permalink
Bug #8226: Fixed SetPictureTransform()'s handling of the argument mat…
Browse files Browse the repository at this point in the history
…rix.

It now recognizes scaled variants of the identity matrix, too.
(cherry picked from fc30370 commit)
  • Loading branch information
tilman2 committed Oct 6, 2006
1 parent 8a27eed commit dce3f2a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions render/picture.c
Expand Up @@ -1459,18 +1459,24 @@ SetPictureClipRegion (PicturePtr pPicture,
return result;
}

static Bool
transformIsIdentity(PictTransform *t)
{
return ((t->matrix[0][0] == t->matrix[1][1]) &&
(t->matrix[0][0] == t->matrix[2][2]) &&
(t->matrix[0][1] == 0) &&
(t->matrix[0][2] == 0) &&
(t->matrix[1][0] == 0) &&
(t->matrix[1][2] == 0) &&
(t->matrix[2][0] == 0) &&
(t->matrix[2][1] == 0));
}

int
SetPictureTransform (PicturePtr pPicture,
PictTransform *transform)
{
static const PictTransform identity = { {
{ xFixed1, 0x00000, 0x00000 },
{ 0x00000, xFixed1, 0x00000 },
{ 0x00000, 0x00000, xFixed1 },
} };

if (transform && memcmp (transform, &identity, sizeof (PictTransform)) == 0)
if (transform && transformIsIdentity (transform))
transform = 0;

if (transform)
Expand Down

0 comments on commit dce3f2a

Please sign in to comment.