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
b8db7f6a
Commit
b8db7f6a
authored
Nov 23, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dwrite: Update to IDWriteBitmapRenderTarget1.
parent
7ae3426e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
33 deletions
+84
-33
gdiinterop.c
dlls/dwrite/gdiinterop.c
+59
-33
font.c
dlls/dwrite/tests/font.c
+25
-0
No files found.
dlls/dwrite/gdiinterop.c
View file @
b8db7f6a
/*
* GDI Interop
*
* Copyright 2012 Nikolay Sivov for CodeWeavers
* Copyright 2012
, 2014
Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -44,9 +44,10 @@ struct gdiinterop {
};
struct
rendertarget
{
IDWriteBitmapRenderTarget
IDWriteBitmapRenderTarget
_iface
;
IDWriteBitmapRenderTarget
1
IDWriteBitmapRenderTarget1
_iface
;
LONG
ref
;
DWRITE_TEXT_ANTIALIAS_MODE
antialiasmode
;
FLOAT
pixels_per_dip
;
DWRITE_MATRIX
m
;
SIZE
size
;
...
...
@@ -75,9 +76,9 @@ static HRESULT create_target_dibsection(HDC hdc, UINT32 width, UINT32 height)
return
S_OK
;
}
static
inline
struct
rendertarget
*
impl_from_IDWriteBitmapRenderTarget
(
IDWriteBitmapRenderTarget
*
iface
)
static
inline
struct
rendertarget
*
impl_from_IDWriteBitmapRenderTarget
1
(
IDWriteBitmapRenderTarget1
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
rendertarget
,
IDWriteBitmapRenderTarget_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
rendertarget
,
IDWriteBitmapRenderTarget
1
_iface
);
}
static
inline
struct
gdiinterop
*
impl_from_IDWriteGdiInterop
(
IDWriteGdiInterop
*
iface
)
...
...
@@ -85,16 +86,18 @@ static inline struct gdiinterop *impl_from_IDWriteGdiInterop(IDWriteGdiInterop *
return
CONTAINING_RECORD
(
iface
,
struct
gdiinterop
,
IDWriteGdiInterop_iface
);
}
static
HRESULT
WINAPI
rendertarget_QueryInterface
(
IDWriteBitmapRenderTarget
*
iface
,
REFIID
riid
,
void
**
obj
)
static
HRESULT
WINAPI
rendertarget_QueryInterface
(
IDWriteBitmapRenderTarget
1
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDWriteBitmapRenderTarget
))
if
(
IsEqualIID
(
riid
,
&
IID_IDWriteBitmapRenderTarget1
)
||
IsEqualIID
(
riid
,
&
IID_IDWriteBitmapRenderTarget
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
IDWriteBitmapRenderTarget_AddRef
(
iface
);
IDWriteBitmapRenderTarget
1
_AddRef
(
iface
);
return
S_OK
;
}
...
...
@@ -103,17 +106,17 @@ static HRESULT WINAPI rendertarget_QueryInterface(IDWriteBitmapRenderTarget *ifa
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
rendertarget_AddRef
(
IDWriteBitmapRenderTarget
*
iface
)
static
ULONG
WINAPI
rendertarget_AddRef
(
IDWriteBitmapRenderTarget
1
*
iface
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
rendertarget_Release
(
IDWriteBitmapRenderTarget
*
iface
)
static
ULONG
WINAPI
rendertarget_Release
(
IDWriteBitmapRenderTarget
1
*
iface
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
ref
);
...
...
@@ -127,34 +130,34 @@ static ULONG WINAPI rendertarget_Release(IDWriteBitmapRenderTarget *iface)
return
ref
;
}
static
HRESULT
WINAPI
rendertarget_DrawGlyphRun
(
IDWriteBitmapRenderTarget
*
iface
,
static
HRESULT
WINAPI
rendertarget_DrawGlyphRun
(
IDWriteBitmapRenderTarget
1
*
iface
,
FLOAT
baselineOriginX
,
FLOAT
baselineOriginY
,
DWRITE_MEASURING_MODE
measuring_mode
,
DWRITE_GLYPH_RUN
const
*
glyph_run
,
IDWriteRenderingParams
*
params
,
COLORREF
textColor
,
RECT
*
blackbox_rect
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
FIXME
(
"(%p)->(%f %f %d %p %p 0x%08x %p): stub
\n
"
,
This
,
baselineOriginX
,
baselineOriginY
,
measuring_mode
,
glyph_run
,
params
,
textColor
,
blackbox_rect
);
return
E_NOTIMPL
;
}
static
HDC
WINAPI
rendertarget_GetMemoryDC
(
IDWriteBitmapRenderTarget
*
iface
)
static
HDC
WINAPI
rendertarget_GetMemoryDC
(
IDWriteBitmapRenderTarget
1
*
iface
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
hdc
;
}
static
FLOAT
WINAPI
rendertarget_GetPixelsPerDip
(
IDWriteBitmapRenderTarget
*
iface
)
static
FLOAT
WINAPI
rendertarget_GetPixelsPerDip
(
IDWriteBitmapRenderTarget
1
*
iface
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
pixels_per_dip
;
}
static
HRESULT
WINAPI
rendertarget_SetPixelsPerDip
(
IDWriteBitmapRenderTarget
*
iface
,
FLOAT
pixels_per_dip
)
static
HRESULT
WINAPI
rendertarget_SetPixelsPerDip
(
IDWriteBitmapRenderTarget
1
*
iface
,
FLOAT
pixels_per_dip
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
TRACE
(
"(%p)->(%.2f)
\n
"
,
This
,
pixels_per_dip
);
...
...
@@ -165,9 +168,9 @@ static HRESULT WINAPI rendertarget_SetPixelsPerDip(IDWriteBitmapRenderTarget *if
return
S_OK
;
}
static
HRESULT
WINAPI
rendertarget_GetCurrentTransform
(
IDWriteBitmapRenderTarget
*
iface
,
DWRITE_MATRIX
*
transform
)
static
HRESULT
WINAPI
rendertarget_GetCurrentTransform
(
IDWriteBitmapRenderTarget
1
*
iface
,
DWRITE_MATRIX
*
transform
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
transform
);
...
...
@@ -175,9 +178,9 @@ static HRESULT WINAPI rendertarget_GetCurrentTransform(IDWriteBitmapRenderTarget
return
S_OK
;
}
static
HRESULT
WINAPI
rendertarget_SetCurrentTransform
(
IDWriteBitmapRenderTarget
*
iface
,
DWRITE_MATRIX
const
*
transform
)
static
HRESULT
WINAPI
rendertarget_SetCurrentTransform
(
IDWriteBitmapRenderTarget
1
*
iface
,
DWRITE_MATRIX
const
*
transform
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
transform
);
...
...
@@ -185,18 +188,18 @@ static HRESULT WINAPI rendertarget_SetCurrentTransform(IDWriteBitmapRenderTarget
return
S_OK
;
}
static
HRESULT
WINAPI
rendertarget_GetSize
(
IDWriteBitmapRenderTarget
*
iface
,
SIZE
*
size
)
static
HRESULT
WINAPI
rendertarget_GetSize
(
IDWriteBitmapRenderTarget
1
*
iface
,
SIZE
*
size
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
size
);
*
size
=
This
->
size
;
return
S_OK
;
}
static
HRESULT
WINAPI
rendertarget_Resize
(
IDWriteBitmapRenderTarget
*
iface
,
UINT32
width
,
UINT32
height
)
static
HRESULT
WINAPI
rendertarget_Resize
(
IDWriteBitmapRenderTarget
1
*
iface
,
UINT32
width
,
UINT32
height
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
(
iface
);
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget
1
(
iface
);
TRACE
(
"(%p)->(%u %u)
\n
"
,
This
,
width
,
height
);
...
...
@@ -206,7 +209,27 @@ static HRESULT WINAPI rendertarget_Resize(IDWriteBitmapRenderTarget *iface, UINT
return
create_target_dibsection
(
This
->
hdc
,
width
,
height
);
}
static
const
IDWriteBitmapRenderTargetVtbl
rendertargetvtbl
=
{
static
DWRITE_TEXT_ANTIALIAS_MODE
WINAPI
rendertarget_GetTextAntialiasMode
(
IDWriteBitmapRenderTarget1
*
iface
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget1
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
return
This
->
antialiasmode
;
}
static
HRESULT
WINAPI
rendertarget_SetTextAntialiasMode
(
IDWriteBitmapRenderTarget1
*
iface
,
DWRITE_TEXT_ANTIALIAS_MODE
mode
)
{
struct
rendertarget
*
This
=
impl_from_IDWriteBitmapRenderTarget1
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
mode
);
if
((
DWORD
)
mode
>
DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE
)
return
E_INVALIDARG
;
This
->
antialiasmode
=
mode
;
return
S_OK
;
}
static
const
IDWriteBitmapRenderTarget1Vtbl
rendertargetvtbl
=
{
rendertarget_QueryInterface
,
rendertarget_AddRef
,
rendertarget_Release
,
...
...
@@ -217,7 +240,9 @@ static const IDWriteBitmapRenderTargetVtbl rendertargetvtbl = {
rendertarget_GetCurrentTransform
,
rendertarget_SetCurrentTransform
,
rendertarget_GetSize
,
rendertarget_Resize
rendertarget_Resize
,
rendertarget_GetTextAntialiasMode
,
rendertarget_SetTextAntialiasMode
};
static
HRESULT
create_rendertarget
(
HDC
hdc
,
UINT32
width
,
UINT32
height
,
IDWriteBitmapRenderTarget
**
ret
)
...
...
@@ -230,7 +255,7 @@ static HRESULT create_rendertarget(HDC hdc, UINT32 width, UINT32 height, IDWrite
target
=
heap_alloc
(
sizeof
(
struct
rendertarget
));
if
(
!
target
)
return
E_OUTOFMEMORY
;
target
->
IDWriteBitmapRenderTarget_iface
.
lpVtbl
=
&
rendertargetvtbl
;
target
->
IDWriteBitmapRenderTarget
1
_iface
.
lpVtbl
=
&
rendertargetvtbl
;
target
->
ref
=
1
;
target
->
size
.
cx
=
width
;
...
...
@@ -239,14 +264,15 @@ static HRESULT create_rendertarget(HDC hdc, UINT32 width, UINT32 height, IDWrite
target
->
hdc
=
CreateCompatibleDC
(
hdc
);
hr
=
create_target_dibsection
(
target
->
hdc
,
width
,
height
);
if
(
FAILED
(
hr
))
{
IDWriteBitmapRenderTarget
_Release
(
&
target
->
IDWriteBitmapRenderTarget
_iface
);
IDWriteBitmapRenderTarget
1_Release
(
&
target
->
IDWriteBitmapRenderTarget1
_iface
);
return
hr
;
}
target
->
m
=
identity
;
target
->
pixels_per_dip
=
1
.
0
;
target
->
antialiasmode
=
DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE
;
*
ret
=
&
target
->
IDWriteBitmapRenderTarget
_iface
;
*
ret
=
(
IDWriteBitmapRenderTarget
*
)
&
target
->
IDWriteBitmapRenderTarget1
_iface
;
return
S_OK
;
}
...
...
dlls/dwrite/tests/font.c
View file @
b8db7f6a
...
...
@@ -527,6 +527,7 @@ todo_wine {
static
void
test_CreateBitmapRenderTarget
(
void
)
{
IDWriteBitmapRenderTarget
*
target
,
*
target2
;
IDWriteBitmapRenderTarget1
*
target1
;
IDWriteGdiInterop
*
interop
;
IDWriteFactory
*
factory
;
HBITMAP
hbm
,
hbm2
;
...
...
@@ -701,6 +702,30 @@ if (0) /* crashes on native */
pdip
=
IDWriteBitmapRenderTarget_GetPixelsPerDip
(
target
);
ok
(
pdip
==
2
.
0
,
"got %.2f
\n
"
,
pdip
);
hr
=
IDWriteBitmapRenderTarget_QueryInterface
(
target
,
&
IID_IDWriteBitmapRenderTarget1
,
(
void
**
)
&
target1
);
if
(
hr
==
S_OK
)
{
DWRITE_TEXT_ANTIALIAS_MODE
mode
;
mode
=
IDWriteBitmapRenderTarget1_GetTextAntialiasMode
(
target1
);
ok
(
mode
==
DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE
,
"got %d
\n
"
,
mode
);
hr
=
IDWriteBitmapRenderTarget1_SetTextAntialiasMode
(
target1
,
DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
mode
=
IDWriteBitmapRenderTarget1_GetTextAntialiasMode
(
target1
);
ok
(
mode
==
DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE
,
"got %d
\n
"
,
mode
);
hr
=
IDWriteBitmapRenderTarget1_SetTextAntialiasMode
(
target1
,
DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
mode
=
IDWriteBitmapRenderTarget1_GetTextAntialiasMode
(
target1
);
ok
(
mode
==
DWRITE_TEXT_ANTIALIAS_MODE_GRAYSCALE
,
"got %d
\n
"
,
mode
);
IDWriteBitmapRenderTarget1_Release
(
target1
);
}
else
win_skip
(
"IDWriteBitmapRenderTarget1 is not supported.
\n
"
);
IDWriteBitmapRenderTarget_Release
(
target
);
IDWriteGdiInterop_Release
(
interop
);
IDWriteFactory_Release
(
factory
);
...
...
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