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
1e5b9d36
Commit
1e5b9d36
authored
Jul 17, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Use antialias mode set for bitmap render target.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e1f191e3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
18 deletions
+80
-18
gdiinterop.c
dlls/dwrite/gdiinterop.c
+19
-18
font.c
dlls/dwrite/tests/font.c
+61
-0
No files found.
dlls/dwrite/gdiinterop.c
View file @
1e5b9d36
...
...
@@ -43,7 +43,7 @@ struct rendertarget {
ID2D1SimplifiedGeometrySink
ID2D1SimplifiedGeometrySink_iface
;
LONG
ref
;
IDWriteFactory
*
factory
;
IDWriteFactory
5
*
factory
;
DWRITE_TEXT_ANTIALIAS_MODE
antialiasmode
;
FLOAT
ppdip
;
DWRITE_MATRIX
m
;
...
...
@@ -243,7 +243,7 @@ static ULONG WINAPI rendertarget_Release(IDWriteBitmapRenderTarget1 *iface)
if
(
!
ref
)
{
IDWriteFactory_Release
(
This
->
factory
);
IDWriteFactory
5
_Release
(
This
->
factory
);
DeleteDC
(
This
->
hdc
);
heap_free
(
This
);
}
...
...
@@ -313,8 +313,10 @@ static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *ifac
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget1
(
iface
);
IDWriteGlyphRunAnalysis
*
analysis
;
DWRITE_RENDERING_MODE
rendermode
;
DWRITE_GRID_FIT_MODE
gridfitmode
;
DWRITE_TEXTURE_TYPE
texturetype
;
IDWriteFontFace1
*
fontface1
;
IDWriteFontFace2
*
fontface2
;
DWRITE_GLYPH_RUN
scaled_run
;
RECT
target
,
bounds
;
HRESULT
hr
;
...
...
@@ -326,17 +328,15 @@ static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *ifac
if
(
!
This
->
dib
.
ptr
)
return
S_OK
;
hr
=
IDWriteFontFace_QueryInterface
(
run
->
fontFace
,
&
IID_IDWriteFontFace1
,
(
void
**
)
&
fontface1
);
if
(
hr
==
S_OK
)
{
hr
=
IDWriteFontFace1_GetRecommendedRenderingMode
(
fontface1
,
run
->
fontEmSize
,
This
->
ppdip
*
96
.
0
f
,
This
->
ppdip
*
96
.
0
f
,
NULL
,
run
->
isSideways
,
DWRITE_OUTLINE_THRESHOLD_ALIASED
,
measuring_mode
,
&
rendermode
);
IDWriteFontFace1_Release
(
fontface1
);
if
(
FAILED
(
hr
=
IDWriteFontFace_QueryInterface
(
run
->
fontFace
,
&
IID_IDWriteFontFace2
,
(
void
**
)
&
fontface2
)))
{
WARN
(
"Failed to get IDWriteFontFace2 interface, hr %#x.
\n
"
,
hr
);
return
hr
;
}
else
hr
=
IDWriteFontFace_GetRecommendedRenderingMode
(
run
->
fontFace
,
run
->
fontEmSize
,
This
->
ppdip
,
measuring_mode
,
params
,
&
rendermode
);
hr
=
IDWriteFontFace2_GetRecommendedRenderingMode
(
fontface2
,
run
->
fontEmSize
,
This
->
ppdip
*
96
.
0
f
,
This
->
ppdip
*
96
.
0
f
,
NULL
/* FIXME */
,
run
->
isSideways
,
DWRITE_OUTLINE_THRESHOLD_ALIASED
,
measuring_mode
,
params
,
&
rendermode
,
&
gridfitmode
);
IDWriteFontFace2_Release
(
fontface2
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -392,9 +392,10 @@ static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *ifac
return
hr
;
}
hr
=
IDWriteFactory_CreateGlyphRunAnalysis
(
This
->
factory
,
run
,
This
->
ppdip
,
&
This
->
m
,
rendermode
,
measuring_mode
,
originX
,
originY
,
&
analysis
);
scaled_run
=
*
run
;
scaled_run
.
fontEmSize
*=
This
->
ppdip
;
hr
=
IDWriteFactory5_CreateGlyphRunAnalysis
(
This
->
factory
,
&
scaled_run
,
&
This
->
m
,
rendermode
,
measuring_mode
,
gridfitmode
,
This
->
antialiasmode
,
originX
,
originY
,
&
analysis
);
if
(
FAILED
(
hr
))
{
WARN
(
"failed to create analysis instance, 0x%08x
\n
"
,
hr
);
return
hr
;
...
...
@@ -549,7 +550,7 @@ static const IDWriteBitmapRenderTarget1Vtbl rendertargetvtbl = {
rendertarget_SetTextAntialiasMode
};
static
HRESULT
create_rendertarget
(
IDWriteFactory
*
factory
,
HDC
hdc
,
UINT32
width
,
UINT32
height
,
IDWriteBitmapRenderTarget
**
ret
)
static
HRESULT
create_rendertarget
(
IDWriteFactory
5
*
factory
,
HDC
hdc
,
UINT32
width
,
UINT32
height
,
IDWriteBitmapRenderTarget
**
ret
)
{
struct
rendertarget
*
target
;
HRESULT
hr
;
...
...
@@ -575,7 +576,7 @@ static HRESULT create_rendertarget(IDWriteFactory *factory, HDC hdc, UINT32 widt
target
->
ppdip
=
GetDeviceCaps
(
target
->
hdc
,
LOGPIXELSX
)
/
96
.
0
f
;
target
->
antialiasmode
=
DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE
;
target
->
factory
=
factory
;
IDWriteFactory_AddRef
(
factory
);
IDWriteFactory
5
_AddRef
(
factory
);
*
ret
=
(
IDWriteBitmapRenderTarget
*
)
&
target
->
IDWriteBitmapRenderTarget1_iface
;
...
...
@@ -779,7 +780,7 @@ static HRESULT WINAPI gdiinterop_CreateBitmapRenderTarget(IDWriteGdiInterop1 *if
{
struct
gdiinterop
*
This
=
impl_from_IDWriteGdiInterop1
(
iface
);
TRACE
(
"(%p)->(%p %u %u %p)
\n
"
,
This
,
hdc
,
width
,
height
,
target
);
return
create_rendertarget
(
(
IDWriteFactory
*
)
This
->
factory
,
hdc
,
width
,
height
,
target
);
return
create_rendertarget
(
This
->
factory
,
hdc
,
width
,
height
,
target
);
}
static
HRESULT
WINAPI
gdiinterop1_CreateFontFromLOGFONT
(
IDWriteGdiInterop1
*
iface
,
...
...
dlls/dwrite/tests/font.c
View file @
1e5b9d36
...
...
@@ -1053,9 +1053,13 @@ static void test_CreateBitmapRenderTarget(void)
{
IDWriteBitmapRenderTarget
*
target
,
*
target2
;
IDWriteBitmapRenderTarget1
*
target1
;
IDWriteRenderingParams
*
params
;
IDWriteGdiInterop
*
interop
;
IDWriteFontFace
*
fontface
;
IDWriteFactory
*
factory
;
DWRITE_GLYPH_RUN
run
;
HBITMAP
hbm
,
hbm2
;
UINT16
glyphs
[
2
];
DWRITE_MATRIX
m
;
DIBSECTION
ds
;
XFORM
xform
;
...
...
@@ -1064,6 +1068,7 @@ static void test_CreateBitmapRenderTarget(void)
FLOAT
pdip
;
SIZE
size
;
ULONG
ref
;
UINT32
ch
;
HDC
hdc
;
int
ret
;
...
...
@@ -1307,6 +1312,62 @@ static void test_CreateBitmapRenderTarget(void)
else
win_skip
(
"IDWriteBitmapRenderTarget1 is not supported.
\n
"
);
/* DrawGlyphRun() argument validation. */
hr
=
IDWriteBitmapRenderTarget_Resize
(
target
,
16
,
16
);
ok
(
hr
==
S_OK
,
"Failed to resize target, hr %#x.
\n
"
,
hr
);
fontface
=
create_fontface
(
factory
);
ch
=
'A'
;
glyphs
[
0
]
=
0
;
hr
=
IDWriteFontFace_GetGlyphIndices
(
fontface
,
&
ch
,
1
,
glyphs
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
glyphs
[
0
]
>
0
,
"got %u
\n
"
,
glyphs
[
0
]);
glyphs
[
1
]
=
glyphs
[
0
];
memset
(
&
run
,
0
,
sizeof
(
run
));
run
.
fontFace
=
fontface
;
run
.
fontEmSize
=
12
.
0
f
;
run
.
glyphCount
=
2
;
run
.
glyphIndices
=
glyphs
;
hr
=
IDWriteFactory_CreateCustomRenderingParams
(
factory
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
DWRITE_PIXEL_GEOMETRY_FLAT
,
DWRITE_RENDERING_MODE_DEFAULT
,
&
params
);
ok
(
hr
==
S_OK
,
"Failed to create rendering params, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteBitmapRenderTarget_DrawGlyphRun
(
target
,
0
.
0
f
,
0
.
0
f
,
DWRITE_MEASURING_MODE_NATURAL
,
&
run
,
NULL
,
RGB
(
255
,
0
,
0
),
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteBitmapRenderTarget_DrawGlyphRun
(
target
,
0
.
0
f
,
0
.
0
f
,
DWRITE_MEASURING_MODE_GDI_NATURAL
+
1
,
&
run
,
NULL
,
RGB
(
255
,
0
,
0
),
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteBitmapRenderTarget_DrawGlyphRun
(
target
,
0
.
0
f
,
0
.
0
f
,
DWRITE_MEASURING_MODE_GDI_NATURAL
+
1
,
&
run
,
params
,
RGB
(
255
,
0
,
0
),
NULL
);
ok
(
hr
==
E_INVALIDARG
||
broken
(
hr
==
S_OK
)
/* Vista */
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteBitmapRenderTarget_DrawGlyphRun
(
target
,
0
.
0
f
,
0
.
0
f
,
DWRITE_MEASURING_MODE_GDI_NATURAL
,
&
run
,
params
,
RGB
(
255
,
0
,
0
),
NULL
);
ok
(
hr
==
S_OK
,
"Failed to draw a run, hr %#x.
\n
"
,
hr
);
IDWriteRenderingParams_Release
(
params
);
/* Zero sized target returns earlier. */
hr
=
IDWriteBitmapRenderTarget_Resize
(
target
,
0
,
16
);
ok
(
hr
==
S_OK
,
"Failed to resize target, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteBitmapRenderTarget_DrawGlyphRun
(
target
,
0
.
0
f
,
0
.
0
f
,
DWRITE_MEASURING_MODE_NATURAL
,
&
run
,
NULL
,
RGB
(
255
,
0
,
0
),
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDWriteBitmapRenderTarget_DrawGlyphRun
(
target
,
0
.
0
f
,
0
.
0
f
,
DWRITE_MEASURING_MODE_GDI_NATURAL
+
1
,
&
run
,
params
,
RGB
(
255
,
0
,
0
),
NULL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
IDWriteFontFace_Release
(
fontface
);
ref
=
IDWriteBitmapRenderTarget_Release
(
target
);
ok
(
ref
==
0
,
"render target not released, %u
\n
"
,
ref
);
ref
=
IDWriteGdiInterop_Release
(
interop
);
...
...
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