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
24814f8f
Commit
24814f8f
authored
Sep 26, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Create shader resource views for gradient stop collections.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c1cba92c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
4 deletions
+70
-4
brush.c
dlls/d2d1/brush.c
+66
-2
d2d1_private.h
dlls/d2d1/d2d1_private.h
+2
-1
render_target.c
dlls/d2d1/render_target.c
+2
-1
No files found.
dlls/d2d1/brush.c
View file @
24814f8f
...
...
@@ -68,6 +68,7 @@ static ULONG STDMETHODCALLTYPE d2d_gradient_Release(ID2D1GradientStopCollection
if
(
!
refcount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
gradient
->
stops
);
ID3D10ShaderResourceView_Release
(
gradient
->
view
);
ID2D1Factory_Release
(
gradient
->
factory
);
HeapFree
(
GetProcessHeap
(),
0
,
gradient
);
}
...
...
@@ -129,21 +130,84 @@ static const struct ID2D1GradientStopCollectionVtbl d2d_gradient_vtbl =
d2d_gradient_GetExtendMode
,
};
HRESULT
d2d_gradient_create
(
ID2D1Factory
*
factory
,
const
D2D1_GRADIENT_STOP
*
stops
,
HRESULT
d2d_gradient_create
(
ID2D1Factory
*
factory
,
ID3D10Device
*
device
,
const
D2D1_GRADIENT_STOP
*
stops
,
UINT32
stop_count
,
D2D1_GAMMA
gamma
,
D2D1_EXTEND_MODE
extend_mode
,
struct
d2d_gradient
**
gradient
)
{
D3D10_SHADER_RESOURCE_VIEW_DESC
srv_desc
;
D3D10_SUBRESOURCE_DATA
buffer_data
;
ID3D10ShaderResourceView
*
view
;
D3D10_BUFFER_DESC
buffer_desc
;
struct
d2d_vec4
*
data
;
ID3D10Buffer
*
buffer
;
unsigned
int
i
;
HRESULT
hr
;
if
(
!
(
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
2
*
stop_count
*
sizeof
(
*
data
))))
{
ERR
(
"Failed to allocate data.
\n
"
);
return
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
stop_count
;
++
i
)
{
data
[
i
*
2
].
x
=
stops
[
i
].
position
;
data
[
i
*
2
+
1
].
x
=
stops
[
i
].
color
.
r
;
data
[
i
*
2
+
1
].
y
=
stops
[
i
].
color
.
g
;
data
[
i
*
2
+
1
].
z
=
stops
[
i
].
color
.
b
;
data
[
i
*
2
+
1
].
w
=
stops
[
i
].
color
.
a
;
}
buffer_desc
.
ByteWidth
=
2
*
stop_count
*
sizeof
(
*
data
);
buffer_desc
.
Usage
=
D3D10_USAGE_DEFAULT
;
buffer_desc
.
BindFlags
=
D3D10_BIND_SHADER_RESOURCE
;
buffer_desc
.
CPUAccessFlags
=
0
;
buffer_desc
.
MiscFlags
=
0
;
buffer_data
.
pSysMem
=
data
;
buffer_data
.
SysMemPitch
=
0
;
buffer_data
.
SysMemSlicePitch
=
0
;
hr
=
ID3D10Device_CreateBuffer
(
device
,
&
buffer_desc
,
&
buffer_data
,
&
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to create buffer, hr %#x.
\n
"
,
hr
);
return
hr
;
}
srv_desc
.
Format
=
DXGI_FORMAT_R32G32B32A32_FLOAT
;
srv_desc
.
ViewDimension
=
D3D10_SRV_DIMENSION_BUFFER
;
srv_desc
.
Buffer
.
ElementOffset
=
0
;
srv_desc
.
Buffer
.
ElementWidth
=
2
*
stop_count
;
hr
=
ID3D10Device_CreateShaderResourceView
(
device
,
(
ID3D10Resource
*
)
buffer
,
&
srv_desc
,
&
view
);
ID3D10Buffer_Release
(
buffer
);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to create view, hr %#x.
\n
"
,
hr
);
return
hr
;
}
if
(
!
(
*
gradient
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
**
gradient
))))
{
ID3D10ShaderResourceView_Release
(
view
);
return
E_OUTOFMEMORY
;
}
FIXME
(
"Ignoring gradient properties.
\n
"
);
if
(
gamma
!=
D2D1_GAMMA_2_2
)
FIXME
(
"Ignoring gamma %#x.
\n
"
,
gamma
);
if
(
extend_mode
!=
D2D1_EXTEND_MODE_CLAMP
)
FIXME
(
"Ignoring extend mode %#x.
\n
"
,
extend_mode
);
(
*
gradient
)
->
ID2D1GradientStopCollection_iface
.
lpVtbl
=
&
d2d_gradient_vtbl
;
(
*
gradient
)
->
refcount
=
1
;
ID2D1Factory_AddRef
((
*
gradient
)
->
factory
=
factory
);
(
*
gradient
)
->
view
=
view
;
(
*
gradient
)
->
stop_count
=
stop_count
;
if
(
!
((
*
gradient
)
->
stops
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stop_count
*
sizeof
(
*
stops
))))
{
ID3D10ShaderResourceView_Release
(
view
);
HeapFree
(
GetProcessHeap
(),
0
,
*
gradient
);
return
E_OUTOFMEMORY
;
}
...
...
dlls/d2d1/d2d1_private.h
View file @
24814f8f
...
...
@@ -201,11 +201,12 @@ struct d2d_gradient
LONG
refcount
;
ID2D1Factory
*
factory
;
ID3D10ShaderResourceView
*
view
;
D2D1_GRADIENT_STOP
*
stops
;
UINT32
stop_count
;
};
HRESULT
d2d_gradient_create
(
ID2D1Factory
*
factory
,
const
D2D1_GRADIENT_STOP
*
stops
,
HRESULT
d2d_gradient_create
(
ID2D1Factory
*
factory
,
ID3D10Device
*
device
,
const
D2D1_GRADIENT_STOP
*
stops
,
UINT32
stop_count
,
D2D1_GAMMA
gamma
,
D2D1_EXTEND_MODE
extend_mode
,
struct
d2d_gradient
**
gradient
)
DECLSPEC_HIDDEN
;
...
...
dlls/d2d1/render_target.c
View file @
24814f8f
...
...
@@ -380,7 +380,8 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateGradientStopCollect
TRACE
(
"iface %p, stops %p, stop_count %u, gamma %#x, extend_mode %#x, gradient %p.
\n
"
,
iface
,
stops
,
stop_count
,
gamma
,
extend_mode
,
gradient
);
if
(
SUCCEEDED
(
hr
=
d2d_gradient_create
(
render_target
->
factory
,
stops
,
stop_count
,
gamma
,
extend_mode
,
&
object
)))
if
(
SUCCEEDED
(
hr
=
d2d_gradient_create
(
render_target
->
factory
,
render_target
->
device
,
stops
,
stop_count
,
gamma
,
extend_mode
,
&
object
)))
*
gradient
=
&
object
->
ID2D1GradientStopCollection_iface
;
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