Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f46aa66c
Commit
f46aa66c
authored
Jul 15, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Fix transform matrix usage for pixel snapping.
parent
4ccdc0c0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
13 deletions
+30
-13
layout.c
dlls/dwrite/layout.c
+7
-6
layout.c
dlls/dwrite/tests/layout.c
+23
-7
No files found.
dlls/dwrite/layout.c
View file @
f46aa66c
...
...
@@ -2735,17 +2735,18 @@ static inline FLOAT renderer_apply_snapping(FLOAT coord, BOOL skiptransform, FLO
if
(
!
skiptransform
)
{
/* apply transform */
vec
[
0
]
=
0
.
0
;
vec
[
1
]
=
coord
;
vec
[
1
]
=
coord
*
ppdip
;
vec2
[
0
]
=
m
->
m11
*
vec
[
0
]
+
m
->
m
12
*
vec
[
1
]
+
m
->
dx
;
vec2
[
1
]
=
m
->
m
21
*
vec
[
0
]
+
m
->
m22
*
vec
[
1
]
+
m
->
dy
;
vec2
[
0
]
=
m
->
m11
*
vec
[
0
]
+
m
->
m
21
*
vec
[
1
]
+
m
->
dx
;
vec2
[
1
]
=
m
->
m
12
*
vec
[
0
]
+
m
->
m22
*
vec
[
1
]
+
m
->
dy
;
/* snap */
vec2
[
0
]
=
floorf
(
vec2
[
0
]
*
ppdip
+
0
.
5
f
)
/
ppdip
;
vec2
[
1
]
=
floorf
(
vec2
[
1
]
*
ppdip
+
0
.
5
f
)
/
ppdip
;
vec2
[
0
]
=
floorf
(
vec2
[
0
]
+
0
.
5
f
)
;
vec2
[
1
]
=
floorf
(
vec2
[
1
]
+
0
.
5
f
)
;
/* apply inverted transform, we don't care about X component at this point */
vec
[
1
]
=
(
-
m
->
m21
*
vec2
[
0
]
+
m
->
m11
*
vec2
[
1
]
-
(
m
->
m11
*
m
->
dy
-
m
->
m12
*
m
->
dx
))
/
det
;
vec
[
1
]
=
(
-
m
->
m12
*
vec2
[
0
]
+
m
->
m11
*
vec2
[
1
]
-
(
m
->
m11
*
m
->
dy
-
m
->
m12
*
m
->
dx
))
/
det
;
vec
[
1
]
/=
ppdip
;
}
else
vec
[
1
]
=
floorf
(
coord
*
ppdip
+
0
.
5
f
)
/
ppdip
;
...
...
dlls/dwrite/tests/layout.c
View file @
f46aa66c
...
...
@@ -22,6 +22,7 @@
#include <assert.h>
#include <math.h>
#include <limits.h>
#include "windows.h"
#include "dwrite.h"
...
...
@@ -3271,17 +3272,18 @@ static FLOAT snap_coord(const DWRITE_MATRIX *m, FLOAT ppdip, FLOAT coord)
if
(
transform
)
{
/* apply transform */
vec
[
0
]
=
0
.
0
;
vec
[
1
]
=
coord
;
vec
[
1
]
=
coord
*
ppdip
;
vec2
[
0
]
=
m
->
m11
*
vec
[
0
]
+
m
->
m
12
*
vec
[
1
]
+
m
->
dx
;
vec2
[
1
]
=
m
->
m
21
*
vec
[
0
]
+
m
->
m22
*
vec
[
1
]
+
m
->
dy
;
vec2
[
0
]
=
m
->
m11
*
vec
[
0
]
+
m
->
m
21
*
vec
[
1
]
+
m
->
dx
;
vec2
[
1
]
=
m
->
m
12
*
vec
[
0
]
+
m
->
m22
*
vec
[
1
]
+
m
->
dy
;
/* snap */
vec2
[
0
]
=
floorf
(
vec2
[
0
]
*
ppdip
+
0
.
5
f
)
/
ppdip
;
vec2
[
1
]
=
floorf
(
vec2
[
1
]
*
ppdip
+
0
.
5
f
)
/
ppdip
;
vec2
[
0
]
=
floorf
(
vec2
[
0
]
+
0
.
5
f
)
;
vec2
[
1
]
=
floorf
(
vec2
[
1
]
+
0
.
5
f
)
;
/* apply inverted transform */
vec
[
1
]
=
(
-
m
->
m21
*
vec2
[
0
]
+
m
->
m11
*
vec2
[
1
]
-
(
m
->
m11
*
m
->
dy
-
m
->
m12
*
m
->
dx
))
/
det
;
vec
[
1
]
=
(
-
m
->
m12
*
vec2
[
0
]
+
m
->
m11
*
vec2
[
1
]
-
(
m
->
m11
*
m
->
dy
-
m
->
m12
*
m
->
dx
))
/
det
;
vec
[
1
]
/=
ppdip
;
}
else
vec
[
1
]
=
floorf
(
coord
*
ppdip
+
0
.
5
f
)
/
ppdip
;
...
...
@@ -3290,7 +3292,15 @@ static FLOAT snap_coord(const DWRITE_MATRIX *m, FLOAT ppdip, FLOAT coord)
static
inline
BOOL
float_eq
(
FLOAT
left
,
FLOAT
right
)
{
return
fabsf
(
left
-
right
)
<
1e-6
f
;
int
x
=
*
(
int
*
)
&
left
;
int
y
=
*
(
int
*
)
&
right
;
if
(
x
<
0
)
x
=
INT_MIN
-
x
;
if
(
y
<
0
)
y
=
INT_MIN
-
y
;
return
abs
(
x
-
y
)
<=
16
;
}
struct
snapping_test
{
...
...
@@ -3319,8 +3329,14 @@ static struct snapping_test snapping_tests[] = {
{
{
0
.
0
,
1
.
0
,
-
1
.
0
,
0
.
0
,
0
.
2
,
0
.
6
},
1
.
0
},
/* 90 degrees rotation */
{
{
-
1
.
0
,
0
.
0
,
0
.
0
,
-
1
.
0
,
0
.
2
,
0
.
6
},
1
.
0
},
/* 180 degrees rotation */
{
{
0
.
0
,
-
1
.
0
,
1
.
0
,
0
.
0
,
0
.
2
,
0
.
6
},
1
.
0
},
/* 270 degrees rotation */
{
{
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
-
0
.
1
,
0
.
2
},
1
.
0
},
{
{
0
.
0
,
1
.
0
,
-
1
.
0
,
0
.
0
,
-
0
.
2
,
-
0
.
3
},
1
.
0
},
/* 90 degrees rotation */
{
{
-
1
.
0
,
0
.
0
,
0
.
0
,
-
1
.
0
,
-
0
.
3
,
-
1
.
6
},
1
.
0
},
/* 180 degrees rotation */
{
{
0
.
0
,
-
1
.
0
,
1
.
0
,
0
.
0
,
-
0
.
7
,
0
.
6
},
10
.
0
},
/* 270 degrees rotation */
{
{
0
.
0
,
2
.
0
,
1
.
0
,
0
.
0
,
0
.
2
,
0
.
6
},
1
.
0
},
{
{
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
},
1
.
0
},
{
{
3
.
0
,
0
.
0
,
0
.
0
,
5
.
0
,
0
.
2
,
-
0
.
3
},
10
.
0
},
{
{
0
.
0
,
-
3
.
0
,
5
.
0
,
0
.
0
,
-
0
.
1
,
0
.
7
},
10
.
0
},
};
static
DWRITE_MATRIX
compattransforms
[]
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment