Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
74f00fa1
Commit
74f00fa1
authored
Jan 11, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Consistently use explicit float literals.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3a653fb8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
95 deletions
+95
-95
analyzer.c
dlls/dwrite/analyzer.c
+30
-30
font.c
dlls/dwrite/font.c
+8
-8
freetype.c
dlls/dwrite/freetype.c
+2
-2
gdiinterop.c
dlls/dwrite/gdiinterop.c
+1
-1
layout.c
dlls/dwrite/layout.c
+52
-52
main.c
dlls/dwrite/main.c
+2
-2
No files found.
dlls/dwrite/analyzer.c
View file @
74f00fa1
...
...
@@ -1056,8 +1056,8 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2
a
=
0
;
advances
[
i
]
=
get_scaled_advance_width
(
a
,
emSize
,
&
metrics
);
offsets
[
i
].
advanceOffset
=
0
.
0
;
offsets
[
i
].
ascenderOffset
=
0
.
0
;
offsets
[
i
].
advanceOffset
=
0
.
0
f
;
offsets
[
i
].
ascenderOffset
=
0
.
0
f
;
}
/* FIXME: actually apply features */
...
...
@@ -1105,11 +1105,11 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite
hr
=
IDWriteFontFace1_GetGdiCompatibleGlyphAdvances
(
fontface1
,
emSize
,
ppdip
,
transform
,
use_gdi_natural
,
is_sideways
,
1
,
&
glyphs
[
i
],
&
a
);
if
(
FAILED
(
hr
))
advances
[
i
]
=
0
.
0
;
advances
[
i
]
=
0
.
0
f
;
else
advances
[
i
]
=
floorf
(
a
*
emSize
*
ppdip
/
metrics
.
designUnitsPerEm
+
0
.
5
f
)
/
ppdip
;
offsets
[
i
].
advanceOffset
=
0
.
0
;
offsets
[
i
].
ascenderOffset
=
0
.
0
;
offsets
[
i
].
advanceOffset
=
0
.
0
f
;
offsets
[
i
].
ascenderOffset
=
0
.
0
f
;
}
/* FIXME: actually apply features */
...
...
@@ -1120,7 +1120,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite
static
inline
FLOAT
get_cluster_advance
(
const
FLOAT
*
advances
,
UINT32
start
,
UINT32
end
)
{
FLOAT
advance
=
0
.
0
;
FLOAT
advance
=
0
.
0
f
;
for
(;
start
<
end
;
start
++
)
advance
+=
advances
[
start
];
return
advance
;
...
...
@@ -1130,9 +1130,9 @@ static void apply_single_glyph_spacing(FLOAT leading_spacing, FLOAT trailing_spa
FLOAT
min_advance_width
,
UINT32
g
,
FLOAT
const
*
advances
,
DWRITE_GLYPH_OFFSET
const
*
offsets
,
DWRITE_SHAPING_GLYPH_PROPERTIES
const
*
props
,
FLOAT
*
modified_advances
,
DWRITE_GLYPH_OFFSET
*
modified_offsets
)
{
BOOL
reduced
=
leading_spacing
<
0
.
0
||
trailing_spacing
<
0
.
0
;
BOOL
reduced
=
leading_spacing
<
0
.
0
f
||
trailing_spacing
<
0
.
0
f
;
FLOAT
advance
=
advances
[
g
];
FLOAT
origin
=
0
.
0
;
FLOAT
origin
=
0
.
0
f
;
if
(
props
[
g
].
isZeroWidthSpace
)
{
modified_advances
[
g
]
=
advances
[
g
];
...
...
@@ -1141,32 +1141,32 @@ static void apply_single_glyph_spacing(FLOAT leading_spacing, FLOAT trailing_spa
}
/* first apply negative spacing and check if we hit minimum width */
if
(
leading_spacing
<
0
.
0
)
{
if
(
leading_spacing
<
0
.
0
f
)
{
advance
+=
leading_spacing
;
origin
-=
leading_spacing
;
}
if
(
trailing_spacing
<
0
.
0
)
if
(
trailing_spacing
<
0
.
0
f
)
advance
+=
trailing_spacing
;
if
(
advance
<
min_advance_width
)
{
FLOAT
half
=
(
min_advance_width
-
advance
)
/
2
.
0
;
FLOAT
half
=
(
min_advance_width
-
advance
)
/
2
.
0
f
;
if
(
!
reduced
)
origin
-=
half
;
else
if
(
leading_spacing
<
0
.
0
&&
trailing_spacing
<
0
.
0
)
else
if
(
leading_spacing
<
0
.
0
f
&&
trailing_spacing
<
0
.
0
f
)
origin
-=
half
;
else
if
(
leading_spacing
<
0
.
0
)
else
if
(
leading_spacing
<
0
.
0
f
)
origin
-=
min_advance_width
-
advance
;
advance
=
min_advance_width
;
}
/* now apply positive spacing adjustments */
if
(
leading_spacing
>
0
.
0
)
{
if
(
leading_spacing
>
0
.
0
f
)
{
advance
+=
leading_spacing
;
origin
-=
leading_spacing
;
}
if
(
trailing_spacing
>
0
.
0
)
if
(
trailing_spacing
>
0
.
0
f
)
advance
+=
trailing_spacing
;
modified_advances
[
g
]
=
advance
;
...
...
@@ -1180,21 +1180,21 @@ static void apply_cluster_spacing(FLOAT leading_spacing, FLOAT trailing_spacing,
UINT32
start
,
UINT32
end
,
FLOAT
const
*
advances
,
DWRITE_GLYPH_OFFSET
const
*
offsets
,
FLOAT
*
modified_advances
,
DWRITE_GLYPH_OFFSET
*
modified_offsets
)
{
BOOL
reduced
=
leading_spacing
<
0
.
0
||
trailing_spacing
<
0
.
0
;
BOOL
reduced
=
leading_spacing
<
0
.
0
f
||
trailing_spacing
<
0
.
0
f
;
FLOAT
advance
=
get_cluster_advance
(
advances
,
start
,
end
);
FLOAT
origin
=
0
.
0
;
FLOAT
origin
=
0
.
0
f
;
UINT16
g
;
modified_advances
[
start
]
=
advances
[
start
];
modified_advances
[
end
-
1
]
=
advances
[
end
-
1
];
/* first apply negative spacing and check if we hit minimum width */
if
(
leading_spacing
<
0
.
0
)
{
if
(
leading_spacing
<
0
.
0
f
)
{
advance
+=
leading_spacing
;
modified_advances
[
start
]
+=
leading_spacing
;
origin
-=
leading_spacing
;
}
if
(
trailing_spacing
<
0
.
0
)
{
if
(
trailing_spacing
<
0
.
0
f
)
{
advance
+=
trailing_spacing
;
modified_advances
[
end
-
1
]
+=
trailing_spacing
;
}
...
...
@@ -1209,12 +1209,12 @@ static void apply_cluster_spacing(FLOAT leading_spacing, FLOAT trailing_spacing,
modified_advances
[
start
]
+=
half
;
modified_advances
[
end
-
1
]
+=
half
;
}
else
if
(
leading_spacing
<
0
.
0
&&
trailing_spacing
<
0
.
0
)
{
else
if
(
leading_spacing
<
0
.
0
f
&&
trailing_spacing
<
0
.
0
f
)
{
origin
-=
half
;
modified_advances
[
start
]
+=
half
;
modified_advances
[
end
-
1
]
+=
half
;
}
else
if
(
leading_spacing
<
0
.
0
)
{
else
if
(
leading_spacing
<
0
.
0
f
)
{
origin
-=
advance
;
modified_advances
[
start
]
+=
advance
;
}
...
...
@@ -1223,11 +1223,11 @@ static void apply_cluster_spacing(FLOAT leading_spacing, FLOAT trailing_spacing,
}
/* now apply positive spacing adjustments */
if
(
leading_spacing
>
0
.
0
)
{
if
(
leading_spacing
>
0
.
0
f
)
{
modified_advances
[
start
]
+=
leading_spacing
;
origin
-=
leading_spacing
;
}
if
(
trailing_spacing
>
0
.
0
)
if
(
trailing_spacing
>
0
.
0
f
)
modified_advances
[
end
-
1
]
+=
trailing_spacing
;
for
(
g
=
start
;
g
<
end
;
g
++
)
{
...
...
@@ -1305,13 +1305,13 @@ static HRESULT WINAPI dwritetextanalyzer1_ApplyCharacterSpacing(IDWriteTextAnaly
TRACE
(
"(%.2f %.2f %.2f %u %u %p %p %p %p %p %p)
\n
"
,
leading_spacing
,
trailing_spacing
,
min_advance_width
,
len
,
glyph_count
,
clustermap
,
advances
,
offsets
,
props
,
modified_advances
,
modified_offsets
);
if
(
min_advance_width
<
0
.
0
)
{
if
(
min_advance_width
<
0
.
0
f
)
{
memset
(
modified_advances
,
0
,
glyph_count
*
sizeof
(
*
modified_advances
));
return
E_INVALIDARG
;
}
/* minimum advance is not applied if no adjustments were made */
if
(
leading_spacing
==
0
.
0
&&
trailing_spacing
==
0
.
0
)
{
if
(
leading_spacing
==
0
.
0
f
&&
trailing_spacing
==
0
.
0
f
)
{
memmove
(
modified_advances
,
advances
,
glyph_count
*
sizeof
(
*
advances
));
memmove
(
modified_offsets
,
offsets
,
glyph_count
*
sizeof
(
*
offsets
));
return
S_OK
;
...
...
@@ -1469,10 +1469,10 @@ static HRESULT WINAPI dwritetextanalyzer2_GetGlyphOrientationTransform(IDWriteTe
DWRITE_GLYPH_ORIENTATION_ANGLE
angle
,
BOOL
is_sideways
,
FLOAT
originX
,
FLOAT
originY
,
DWRITE_MATRIX
*
m
)
{
static
const
DWRITE_MATRIX
transforms
[]
=
{
{
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
},
{
0
.
0
,
1
.
0
,
-
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
},
{
-
1
.
0
,
0
.
0
,
0
.
0
,
-
1
.
0
,
0
.
0
,
0
.
0
},
{
0
.
0
,
-
1
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
}
{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
}
};
TRACE
(
"(%d %d %.2f %.2f %p)
\n
"
,
angle
,
is_sideways
,
originX
,
originY
,
m
);
...
...
@@ -1506,7 +1506,7 @@ static HRESULT WINAPI dwritetextanalyzer2_GetGlyphOrientationTransform(IDWriteTe
/* shift components represent transform necessary to get from original point to
rotated one in new coordinate system */
if
((
originX
!=
0
.
0
||
originY
!=
0
.
0
)
&&
angle
!=
DWRITE_GLYPH_ORIENTATION_ANGLE_0_DEGREES
)
{
if
((
originX
!=
0
.
0
f
||
originY
!=
0
.
0
f
)
&&
angle
!=
DWRITE_GLYPH_ORIENTATION_ANGLE_0_DEGREES
)
{
m
->
dx
=
originX
-
(
m
->
m11
*
originX
+
m
->
m21
*
originY
);
m
->
dy
=
originY
-
(
m
->
m12
*
originX
+
m
->
m22
*
originY
);
}
...
...
dlls/dwrite/font.c
View file @
74f00fa1
...
...
@@ -608,7 +608,7 @@ HRESULT new_glyph_outline(UINT32 count, struct glyph_outline **ret)
outline
->
points
=
points
;
outline
->
tags
=
tags
;
outline
->
count
=
count
;
outline
->
advance
=
0
.
0
;
outline
->
advance
=
0
.
0
f
;
*
ret
=
outline
;
return
S_OK
;
...
...
@@ -659,7 +659,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
UINT32
count
,
BOOL
is_sideways
,
BOOL
is_rtl
,
IDWriteGeometrySink
*
sink
)
{
struct
dwrite_fontface
*
This
=
impl_from_IDWriteFontFace2
(
iface
);
FLOAT
advance
=
0
.
0
;
FLOAT
advance
=
0
.
0
f
;
HRESULT
hr
;
UINT32
g
;
...
...
@@ -676,7 +676,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
ID2D1SimplifiedGeometrySink_SetFillMode
(
sink
,
D2D1_FILL_MODE_WINDING
);
for
(
g
=
0
;
g
<
count
;
g
++
)
{
FLOAT
xoffset
=
0
.
0
,
yoffset
=
0
.
0
;
FLOAT
xoffset
=
0
.
0
f
,
yoffset
=
0
.
0
f
;
struct
glyph_outline
*
outline
;
/* FIXME: cache outlines */
...
...
@@ -692,7 +692,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
}
if
(
g
==
0
)
advance
=
is_rtl
?
-
outline
->
advance
:
0
.
0
;
advance
=
is_rtl
?
-
outline
->
advance
:
0
.
0
f
;
xoffset
+=
advance
;
translate_glyph_outline
(
outline
,
xoffset
,
yoffset
);
...
...
@@ -845,13 +845,13 @@ static HRESULT WINAPI dwritefontface1_GetGdiCompatibleMetrics(IDWriteFontFace2 *
TRACE
(
"(%p)->(%.2f %.2f %p %p)
\n
"
,
This
,
em_size
,
pixels_per_dip
,
m
,
metrics
);
if
(
em_size
<=
0
.
0
||
pixels_per_dip
<=
0
.
0
)
{
if
(
em_size
<=
0
.
0
f
||
pixels_per_dip
<=
0
.
0
f
)
{
memset
(
metrics
,
0
,
sizeof
(
*
metrics
));
return
E_INVALIDARG
;
}
em_size
*=
pixels_per_dip
;
if
(
m
&&
m
->
m22
!=
0
.
0
)
if
(
m
&&
m
->
m22
!=
0
.
0
f
)
em_size
*=
fabs
(
m
->
m22
);
scale
=
em_size
/
design
->
designUnitsPerEm
;
...
...
@@ -947,13 +947,13 @@ static HRESULT WINAPI dwritefontface1_GetGdiCompatibleGlyphAdvances(IDWriteFontF
TRACE
(
"(%p)->(%.2f %.2f %p %d %d %u %p %p)
\n
"
,
This
,
em_size
,
ppdip
,
m
,
use_gdi_natural
,
is_sideways
,
glyph_count
,
glyphs
,
advances
);
if
(
em_size
<
0
.
0
||
ppdip
<=
0
.
0
)
{
if
(
em_size
<
0
.
0
f
||
ppdip
<=
0
.
0
f
)
{
memset
(
advances
,
0
,
sizeof
(
*
advances
)
*
glyph_count
);
return
E_INVALIDARG
;
}
em_size
*=
ppdip
;
if
(
em_size
==
0
.
0
)
{
if
(
em_size
==
0
.
0
f
)
{
memset
(
advances
,
0
,
sizeof
(
*
advances
)
*
glyph_count
);
return
S_OK
;
}
...
...
dlls/dwrite/freetype.c
View file @
74f00fa1
...
...
@@ -269,8 +269,8 @@ BOOL freetype_is_monospaced(IDWriteFontFace2 *fontface)
static
inline
void
ft_vector_to_d2d_point
(
const
FT_Vector
*
v
,
D2D1_POINT_2F
*
p
)
{
p
->
x
=
v
->
x
/
64
.
0
;
p
->
y
=
v
->
y
/
64
.
0
;
p
->
x
=
v
->
x
/
64
.
0
f
;
p
->
y
=
v
->
y
/
64
.
0
f
;
}
/* Convert the quadratic Beziers to cubic Beziers. */
...
...
dlls/dwrite/gdiinterop.c
View file @
74f00fa1
...
...
@@ -461,7 +461,7 @@ static HRESULT WINAPI rendertarget_SetPixelsPerDip(IDWriteBitmapRenderTarget1 *i
TRACE
(
"(%p)->(%.2f)
\n
"
,
This
,
ppdip
);
if
(
ppdip
<=
0
.
0
)
if
(
ppdip
<=
0
.
0
f
)
return
E_INVALIDARG
;
This
->
ppdip
=
ppdip
;
...
...
dlls/dwrite/layout.c
View file @
74f00fa1
...
...
@@ -573,7 +573,7 @@ static inline void init_cluster_metrics(const struct dwrite_textlayout *layout,
/* For clusters made of control chars we report zero glyphs, and we need zero cluster
width as well; advances are already computed at this point and are not necessary zero. */
metrics
->
width
=
0
.
0
;
metrics
->
width
=
0
.
0
f
;
if
(
run
->
run
.
glyphCount
)
{
for
(
j
=
start_glyph
;
j
<
stop_glyph
;
j
++
)
metrics
->
width
+=
run
->
run
.
glyphAdvances
[
j
];
...
...
@@ -732,7 +732,7 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout)
struct
layout_cluster
*
c
=
&
layout
->
clusters
[
cluster
];
DWRITE_INLINE_OBJECT_METRICS
inlinemetrics
;
metrics
->
width
=
0
.
0
;
metrics
->
width
=
0
.
0
f
;
metrics
->
length
=
r
->
u
.
object
.
length
;
metrics
->
canWrapLineAfter
=
FALSE
;
metrics
->
isWhitespace
=
FALSE
;
...
...
@@ -956,7 +956,7 @@ static HRESULT layout_compute(struct dwrite_textlayout *layout)
static
inline
FLOAT
get_cluster_range_width
(
struct
dwrite_textlayout
*
layout
,
UINT32
start
,
UINT32
end
)
{
FLOAT
width
=
0
.
0
;
FLOAT
width
=
0
.
0
f
;
for
(;
start
<
end
;
start
++
)
width
+=
layout
->
clustermetrics
[
start
].
width
;
return
width
;
...
...
@@ -1005,8 +1005,8 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const
inlineobject
->
object
=
r
->
u
.
object
.
object
;
inlineobject
->
width
=
get_cluster_range_width
(
layout
,
first_cluster
,
first_cluster
+
cluster_count
);
inlineobject
->
origin_x
=
is_rtl
?
origin_x
-
inlineobject
->
width
:
origin_x
;
inlineobject
->
origin_y
=
0
.
0
;
/* set after line is built */
inlineobject
->
align_dx
=
0
.
0
;
inlineobject
->
origin_y
=
0
.
0
f
;
/* set after line is built */
inlineobject
->
align_dx
=
0
.
0
f
;
/* It's not clear how these two are set, possibly directionality
is derived from surrounding text (replaced text could have
...
...
@@ -1050,8 +1050,8 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const
else
run
->
origin_x
=
origin_x
;
run
->
origin_y
=
0
.
0
;
/* set after line is built */
run
->
align_dx
=
0
.
0
;
run
->
origin_y
=
0
.
0
f
;
/* set after line is built */
run
->
align_dx
=
0
.
0
f
;
run
->
line
=
line
;
if
(
r
->
u
.
regular
.
run
.
glyphCount
)
{
...
...
@@ -1169,7 +1169,7 @@ static inline struct layout_effective_inline *layout_get_next_inline_run(struct
static
FLOAT
layout_get_line_width
(
struct
dwrite_textlayout
*
layout
,
struct
layout_effective_run
*
erun
,
struct
layout_effective_inline
*
inrun
,
UINT32
line
)
{
FLOAT
width
=
0
.
0
;
FLOAT
width
=
0
.
0
f
;
while
(
erun
&&
erun
->
line
==
line
)
{
width
+=
erun
->
width
;
...
...
@@ -1235,16 +1235,16 @@ static void layout_apply_leading_alignment(struct dwrite_textlayout *layout)
inrun
=
layout_get_next_inline_run
(
layout
,
NULL
);
while
(
erun
)
{
erun
->
align_dx
=
0
.
0
;
erun
->
align_dx
=
0
.
0
f
;
erun
=
layout_get_next_erun
(
layout
,
erun
);
}
while
(
inrun
)
{
inrun
->
align_dx
=
0
.
0
;
inrun
->
align_dx
=
0
.
0
f
;
inrun
=
layout_get_next_inline_run
(
layout
,
inrun
);
}
layout
->
metrics
.
left
=
is_rtl
?
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
:
0
.
0
;
layout
->
metrics
.
left
=
is_rtl
?
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
:
0
.
0
f
;
}
static
void
layout_apply_trailing_alignment
(
struct
dwrite_textlayout
*
layout
)
...
...
@@ -1262,7 +1262,7 @@ static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout)
FLOAT
shift
=
layout
->
metrics
.
layoutWidth
-
width
;
if
(
is_rtl
)
shift
*=
-
1
.
0
;
shift
*=
-
1
.
0
f
;
while
(
erun
&&
erun
->
line
==
line
)
{
erun
->
align_dx
=
shift
;
...
...
@@ -1275,14 +1275,14 @@ static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout)
}
}
layout
->
metrics
.
left
=
is_rtl
?
0
.
0
:
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
;
layout
->
metrics
.
left
=
is_rtl
?
0
.
0
f
:
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
;
}
static
inline
FLOAT
layout_get_centered_shift
(
struct
dwrite_textlayout
*
layout
,
BOOL
skiptransform
,
FLOAT
width
,
FLOAT
det
)
{
if
(
is_layout_gdi_compatible
(
layout
))
{
struct
dwrite_vec
vec
=
{
layout
->
metrics
.
layoutWidth
-
width
,
0
.
0
};
struct
dwrite_vec
vec
=
{
layout
->
metrics
.
layoutWidth
-
width
,
0
.
0
f
};
layout_apply_snapping
(
&
vec
,
skiptransform
,
layout
->
ppdip
,
&
layout
->
transform
,
det
);
return
floorf
(
vec
.
x
/
2
.
0
f
);
}
...
...
@@ -1309,7 +1309,7 @@ static void layout_apply_centered_alignment(struct dwrite_textlayout *layout)
FLOAT
shift
=
layout_get_centered_shift
(
layout
,
skiptransform
,
width
,
det
);
if
(
is_rtl
)
shift
*=
-
1
.
0
;
shift
*=
-
1
.
0
f
;
while
(
erun
&&
erun
->
line
==
line
)
{
erun
->
align_dx
=
shift
;
...
...
@@ -1322,7 +1322,7 @@ static void layout_apply_centered_alignment(struct dwrite_textlayout *layout)
}
}
layout
->
metrics
.
left
=
(
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
)
/
2
.
0
;
layout
->
metrics
.
left
=
(
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
)
/
2
.
0
f
;
}
static
void
layout_apply_text_alignment
(
struct
dwrite_textlayout
*
layout
)
...
...
@@ -1350,7 +1350,7 @@ static void layout_apply_par_alignment(struct dwrite_textlayout *layout)
{
struct
layout_effective_inline
*
inrun
;
struct
layout_effective_run
*
erun
;
FLOAT
origin_y
=
0
.
0
;
FLOAT
origin_y
=
0
.
0
f
;
UINT32
line
;
/* alignment mode defines origin, after that all run origins are updated
...
...
@@ -1359,13 +1359,13 @@ static void layout_apply_par_alignment(struct dwrite_textlayout *layout)
switch
(
layout
->
format
.
paralign
)
{
case
DWRITE_PARAGRAPH_ALIGNMENT_NEAR
:
origin_y
=
0
.
0
;
origin_y
=
0
.
0
f
;
break
;
case
DWRITE_PARAGRAPH_ALIGNMENT_FAR
:
origin_y
=
layout
->
metrics
.
layoutHeight
-
layout
->
metrics
.
height
;
break
;
case
DWRITE_PARAGRAPH_ALIGNMENT_CENTER
:
origin_y
=
(
layout
->
metrics
.
layoutHeight
-
layout
->
metrics
.
height
)
/
2
.
0
;
origin_y
=
(
layout
->
metrics
.
layoutHeight
-
layout
->
metrics
.
height
)
/
2
.
0
f
;
break
;
default:
;
...
...
@@ -1410,13 +1410,13 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
return
hr
;
layout
->
metrics
.
lineCount
=
0
;
origin_x
=
is_rtl
?
layout
->
metrics
.
layoutWidth
:
0
.
0
;
origin_x
=
is_rtl
?
layout
->
metrics
.
layoutWidth
:
0
.
0
f
;
line
=
0
;
run
=
layout
->
clusters
[
0
].
run
;
memset
(
&
metrics
,
0
,
sizeof
(
metrics
));
s
[
0
]
=
s
[
1
]
=
layout_get_strikethrough_from_pos
(
layout
,
0
);
for
(
i
=
0
,
start
=
0
,
textpos
=
0
,
width
=
0
.
0
;
i
<
layout
->
cluster_count
;
i
++
)
{
for
(
i
=
0
,
start
=
0
,
textpos
=
0
,
width
=
0
.
0
f
;
i
<
layout
->
cluster_count
;
i
++
)
{
BOOL
overflow
;
s
[
1
]
=
layout_get_strikethrough_from_pos
(
layout
,
textpos
);
...
...
@@ -1462,7 +1462,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
trailing properties for current line */
strlength
=
metrics
.
length
;
index
=
last_cluster
;
trailingspacewidth
=
0
.
0
;
trailingspacewidth
=
0
.
0
f
;
while
(
strlength
)
{
DWRITE_CLUSTER_METRICS
*
cluster
=
&
layout
->
clustermetrics
[
index
];
...
...
@@ -1486,8 +1486,8 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
/* look for max baseline and descent for this line */
strlength
=
metrics
.
length
;
index
=
last_cluster
;
metrics
.
baseline
=
0
.
0
;
descent
=
0
.
0
;
metrics
.
baseline
=
0
.
0
f
;
descent
=
0
.
0
f
;
while
(
strlength
)
{
DWRITE_CLUSTER_METRICS
*
cluster
=
&
layout
->
clustermetrics
[
index
];
const
struct
layout_run
*
cur
=
layout
->
clusters
[
index
].
run
;
...
...
@@ -1516,7 +1516,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
width
=
layout
->
clustermetrics
[
i
].
width
;
memset
(
&
metrics
,
0
,
sizeof
(
metrics
));
origin_x
=
is_rtl
?
layout
->
metrics
.
layoutWidth
:
0
.
0
;
origin_x
=
is_rtl
?
layout
->
metrics
.
layoutWidth
:
0
.
0
f
;
start
=
i
;
}
else
{
...
...
@@ -1529,15 +1529,15 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
}
layout
->
metrics
.
left
=
is_rtl
?
layout
->
metrics
.
layoutWidth
-
layout
->
metrics
.
width
:
0
;
layout
->
metrics
.
top
=
0
.
0
;
layout
->
metrics
.
top
=
0
.
0
f
;
layout
->
metrics
.
maxBidiReorderingDepth
=
1
;
/* FIXME */
layout
->
metrics
.
height
=
0
.
0
;
layout
->
metrics
.
height
=
0
.
0
f
;
/* Now all line info is here, update effective runs positions in flow direction */
erun
=
layout_get_next_erun
(
layout
,
NULL
);
inrun
=
layout_get_next_inline_run
(
layout
,
NULL
);
origin_y
=
0
.
0
;
origin_y
=
0
.
0
f
;
for
(
line
=
0
;
line
<
layout
->
metrics
.
lineCount
;
line
++
)
{
origin_y
+=
layout
->
lines
[
line
].
baseline
;
...
...
@@ -1734,9 +1734,9 @@ static struct layout_range_header *alloc_layout_range(struct dwrite_textlayout *
range
=
heap_alloc
(
sizeof
(
*
range
));
if
(
!
range
)
return
NULL
;
range
->
leading
=
0
.
0
;
range
->
trailing
=
0
.
0
;
range
->
min_advance
=
0
.
0
;
range
->
leading
=
0
.
0
f
;
range
->
trailing
=
0
.
0
f
;
range
->
min_advance
=
0
.
0
f
;
h
=
&
range
->
h
;
break
;
}
...
...
@@ -2455,7 +2455,7 @@ static HRESULT WINAPI dwritetextlayout_SetMaxWidth(IDWriteTextLayout2 *iface, FL
TRACE
(
"(%p)->(%.2f)
\n
"
,
This
,
maxWidth
);
if
(
maxWidth
<
0
.
0
)
if
(
maxWidth
<
0
.
0
f
)
return
E_INVALIDARG
;
This
->
metrics
.
layoutWidth
=
maxWidth
;
...
...
@@ -2468,7 +2468,7 @@ static HRESULT WINAPI dwritetextlayout_SetMaxHeight(IDWriteTextLayout2 *iface, F
TRACE
(
"(%p)->(%.2f)
\n
"
,
This
,
maxHeight
);
if
(
maxHeight
<
0
.
0
)
if
(
maxHeight
<
0
.
0
f
)
return
E_INVALIDARG
;
This
->
metrics
.
layoutHeight
=
maxHeight
;
...
...
@@ -2551,7 +2551,7 @@ static HRESULT WINAPI dwritetextlayout_SetFontSize(IDWriteTextLayout2 *iface, FL
TRACE
(
"(%p)->(%.2f %s)
\n
"
,
This
,
size
,
debugstr_range
(
&
range
));
if
(
size
<=
0
.
0
)
if
(
size
<=
0
.
0
f
)
return
E_INVALIDARG
;
value
.
range
=
range
;
...
...
@@ -2844,7 +2844,7 @@ static inline FLOAT renderer_apply_snapping(FLOAT coord, BOOL skiptransform, FLO
if
(
!
skiptransform
)
{
/* apply transform */
vec
[
0
]
=
0
.
0
;
vec
[
0
]
=
0
.
0
f
;
vec
[
1
]
=
coord
*
ppdip
;
vec2
[
0
]
=
m
->
m11
*
vec
[
0
]
+
m
->
m21
*
vec
[
1
]
+
m
->
dx
;
...
...
@@ -2872,7 +2872,7 @@ static HRESULT WINAPI dwritetextlayout_Draw(IDWriteTextLayout2 *iface,
struct
layout_effective_inline
*
inlineobject
;
struct
layout_effective_run
*
run
;
struct
layout_strikethrough
*
s
;
FLOAT
det
=
0
.
0
,
ppdip
=
0
.
0
;
FLOAT
det
=
0
.
0
f
,
ppdip
=
0
.
0
f
;
DWRITE_MATRIX
m
=
{
0
};
HRESULT
hr
;
...
...
@@ -2896,9 +2896,9 @@ static HRESULT WINAPI dwritetextlayout_Draw(IDWriteTextLayout2 *iface,
return
hr
;
/* it's only allowed to have a diagonal/antidiagonal transform matrix */
if
(
ppdip
<=
0
.
0
||
(
m
.
m11
*
m
.
m22
!=
0
.
0
&&
(
m
.
m12
!=
0
.
0
||
m
.
m21
!=
0
.
0
))
||
(
m
.
m12
*
m
.
m21
!=
0
.
0
&&
(
m
.
m11
!=
0
.
0
||
m
.
m22
!=
0
.
0
)))
if
(
ppdip
<=
0
.
0
f
||
(
m
.
m11
*
m
.
m22
!=
0
.
0
f
&&
(
m
.
m12
!=
0
.
0
f
||
m
.
m21
!=
0
.
0
f
))
||
(
m
.
m12
*
m
.
m21
!=
0
.
0
f
&&
(
m
.
m11
!=
0
.
0
f
||
m
.
m22
!=
0
.
0
f
)))
disabled
=
TRUE
;
else
skiptransform
=
should_skip_transform
(
&
m
,
&
det
);
...
...
@@ -3055,7 +3055,7 @@ static HRESULT WINAPI dwritetextlayout_DetermineMinWidth(IDWriteTextLayout2 *ifa
if
(
!
(
This
->
recompute
&
RECOMPUTE_MINIMAL_WIDTH
))
goto
width_done
;
*
min_width
=
0
.
0
;
*
min_width
=
0
.
0
f
;
hr
=
layout_compute
(
This
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -3066,7 +3066,7 @@ static HRESULT WINAPI dwritetextlayout_DetermineMinWidth(IDWriteTextLayout2 *ifa
i
++
;
}
else
{
width
=
0
.
0
;
width
=
0
.
0
f
;
while
(
!
is_terminal_cluster
(
This
,
i
))
{
width
+=
This
->
clustermetrics
[
i
].
width
;
i
++
;
...
...
@@ -3149,7 +3149,7 @@ static HRESULT WINAPI dwritetextlayout1_SetCharacterSpacing(IDWriteTextLayout2 *
TRACE
(
"(%p)->(%.2f %.2f %.2f %s)
\n
"
,
This
,
leading
,
trailing
,
min_advance
,
debugstr_range
(
&
range
));
if
(
min_advance
<
0
.
0
)
if
(
min_advance
<
0
.
0
f
)
return
E_INVALIDARG
;
value
.
range
=
range
;
...
...
@@ -3497,7 +3497,7 @@ static FLOAT WINAPI dwritetextformat1_layout_GetIncrementalTabStop(IDWriteTextFo
{
struct
dwrite_textlayout
*
This
=
impl_layout_form_IDWriteTextFormat1
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
0
.
0
;
return
0
.
0
f
;
}
static
HRESULT
WINAPI
dwritetextformat1_layout_GetTrimming
(
IDWriteTextFormat1
*
iface
,
DWRITE_TRIMMING
*
options
,
...
...
@@ -4015,7 +4015,7 @@ static HRESULT init_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *
layout
->
clusters
=
NULL
;
layout
->
lines
=
NULL
;
layout
->
line_alloc
=
0
;
layout
->
minwidth
=
0
.
0
;
layout
->
minwidth
=
0
.
0
f
;
list_init
(
&
layout
->
eruns
);
list_init
(
&
layout
->
inlineobjects
);
list_init
(
&
layout
->
strikethrough
);
...
...
@@ -4031,7 +4031,7 @@ static HRESULT init_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *
layout
->
metrics
.
layoutHeight
=
maxheight
;
layout
->
measuringmode
=
DWRITE_MEASURING_MODE_NATURAL
;
layout
->
ppdip
=
0
.
0
;
layout
->
ppdip
=
0
.
0
f
;
memset
(
&
layout
->
transform
,
0
,
sizeof
(
layout
->
transform
));
layout
->
str
=
heap_strdupnW
(
str
,
len
);
...
...
@@ -4178,8 +4178,8 @@ static HRESULT WINAPI dwritetrimmingsign_GetMetrics(IDWriteInlineObject *iface,
}
ret
->
width
=
metrics
.
width
;
ret
->
height
=
0
.
0
;
ret
->
baseline
=
0
.
0
;
ret
->
height
=
0
.
0
f
;
ret
->
baseline
=
0
.
0
f
;
ret
->
supportsSideways
=
FALSE
;
return
S_OK
;
}
...
...
@@ -4262,7 +4262,7 @@ HRESULT create_trimmingsign(IDWriteFactory2 *factory, IDWriteTextFormat *format,
This
->
IDWriteInlineObject_iface
.
lpVtbl
=
&
dwritetrimmingsignvtbl
;
This
->
ref
=
1
;
hr
=
IDWriteFactory2_CreateTextLayout
(
factory
,
&
ellipsisW
,
1
,
format
,
0
.
0
,
0
.
0
,
&
This
->
layout
);
hr
=
IDWriteFactory2_CreateTextLayout
(
factory
,
&
ellipsisW
,
1
,
format
,
0
.
0
f
,
0
.
0
f
,
&
This
->
layout
);
if
(
FAILED
(
hr
))
{
heap_free
(
This
);
return
hr
;
...
...
@@ -4388,7 +4388,7 @@ static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat1 *iface,
TRACE
(
"(%p)->(%d %f %f)
\n
"
,
This
,
method
,
spacing
,
baseline
);
if
(
spacing
<
0
.
0
||
(
UINT32
)
method
>
DWRITE_LINE_SPACING_METHOD_UNIFORM
)
if
(
spacing
<
0
.
0
f
||
(
UINT32
)
method
>
DWRITE_LINE_SPACING_METHOD_UNIFORM
)
return
E_INVALIDARG
;
This
->
format
.
spacingmethod
=
method
;
...
...
@@ -4436,7 +4436,7 @@ static FLOAT WINAPI dwritetextformat_GetIncrementalTabStop(IDWriteTextFormat1 *i
{
struct
dwrite_textformat
*
This
=
impl_from_IDWriteTextFormat1
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
0
.
0
;
return
0
.
0
f
;
}
static
HRESULT
WINAPI
dwritetextformat_GetTrimming
(
IDWriteTextFormat1
*
iface
,
DWRITE_TRIMMING
*
options
,
...
...
@@ -4681,8 +4681,8 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
This
->
format
.
flow
=
DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
;
This
->
format
.
spacingmethod
=
DWRITE_LINE_SPACING_METHOD_DEFAULT
;
This
->
format
.
vertical_orientation
=
DWRITE_VERTICAL_GLYPH_ORIENTATION_DEFAULT
;
This
->
format
.
spacing
=
0
.
0
;
This
->
format
.
baseline
=
0
.
0
;
This
->
format
.
spacing
=
0
.
0
f
;
This
->
format
.
baseline
=
0
.
0
f
;
This
->
format
.
trimming
.
granularity
=
DWRITE_TRIMMING_GRANULARITY_NONE
;
This
->
format
.
trimming
.
delimiter
=
0
;
This
->
format
.
trimming
.
delimiterCount
=
0
;
...
...
dlls/dwrite/main.c
View file @
74f00fa1
...
...
@@ -921,7 +921,7 @@ static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory2
if
(
!
fixme_once
++
)
FIXME
(
"(%p): monitor setting ignored
\n
"
,
monitor
);
hr
=
IDWriteFactory2_CreateCustomRenderingParams
(
iface
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
DWRITE_PIXEL_GEOMETRY_FLAT
,
DWRITE_RENDERING_MODE_DEFAULT
,
hr
=
IDWriteFactory2_CreateCustomRenderingParams
(
iface
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
DWRITE_PIXEL_GEOMETRY_FLAT
,
DWRITE_RENDERING_MODE_DEFAULT
,
DWRITE_GRID_FIT_MODE_DEFAULT
,
&
params2
);
*
params
=
(
IDWriteRenderingParams
*
)
params2
;
return
hr
;
...
...
@@ -936,7 +936,7 @@ static HRESULT WINAPI dwritefactory_CreateCustomRenderingParams(IDWriteFactory2
TRACE
(
"(%p)->(%f %f %f %d %d %p)
\n
"
,
This
,
gamma
,
enhancedContrast
,
cleartype_level
,
geometry
,
mode
,
params
);
hr
=
IDWriteFactory2_CreateCustomRenderingParams
(
iface
,
gamma
,
enhancedContrast
,
1
.
0
,
cleartype_level
,
geometry
,
hr
=
IDWriteFactory2_CreateCustomRenderingParams
(
iface
,
gamma
,
enhancedContrast
,
1
.
0
f
,
cleartype_level
,
geometry
,
mode
,
DWRITE_GRID_FIT_MODE_DEFAULT
,
&
params2
);
*
params
=
(
IDWriteRenderingParams
*
)
params2
;
return
hr
;
...
...
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