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
7e90dc3d
Commit
7e90dc3d
authored
Feb 29, 2012
by
Vincent Povirk
Committed by
Alexandre Julliard
Mar 15, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Implement path gradient surround color accessors.
parent
7a9f6abd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
38 deletions
+74
-38
brush.c
dlls/gdiplus/brush.c
+39
-15
gdiplus_private.h
dlls/gdiplus/gdiplus_private.h
+2
-0
brush.c
dlls/gdiplus/tests/brush.c
+33
-23
No files found.
dlls/gdiplus/brush.c
View file @
7e90dc3d
...
...
@@ -83,17 +83,20 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
dest
->
blendcount
=
count
;
dest
->
blendfac
=
GdipAlloc
(
count
*
sizeof
(
REAL
));
dest
->
blendpos
=
GdipAlloc
(
count
*
sizeof
(
REAL
));
dest
->
surroundcolors
=
GdipAlloc
(
dest
->
surroundcolorcount
*
sizeof
(
ARGB
));
if
(
!
dest
->
blendfac
||
!
dest
->
blendpos
){
if
(
!
dest
->
blendfac
||
!
dest
->
blendpos
||
!
dest
->
surroundcolors
){
GdipDeletePath
(
dest
->
path
);
GdipFree
(
dest
->
blendfac
);
GdipFree
(
dest
->
blendpos
);
GdipFree
(
dest
->
surroundcolors
);
GdipFree
(
dest
);
return
OutOfMemory
;
}
memcpy
(
dest
->
blendfac
,
src
->
blendfac
,
count
*
sizeof
(
REAL
));
memcpy
(
dest
->
blendpos
,
src
->
blendpos
,
count
*
sizeof
(
REAL
));
memcpy
(
dest
->
surroundcolors
,
src
->
surroundcolors
,
dest
->
surroundcolorcount
*
sizeof
(
ARGB
));
break
;
}
...
...
@@ -499,9 +502,11 @@ static GpStatus create_path_gradient(GpPath *path, GpPathGradient **grad)
(
*
grad
)
->
blendfac
=
GdipAlloc
(
sizeof
(
REAL
));
(
*
grad
)
->
blendpos
=
GdipAlloc
(
sizeof
(
REAL
));
if
(
!
(
*
grad
)
->
blendfac
||
!
(
*
grad
)
->
blendpos
){
(
*
grad
)
->
surroundcolors
=
GdipAlloc
(
sizeof
(
ARGB
));
if
(
!
(
*
grad
)
->
blendfac
||
!
(
*
grad
)
->
blendpos
||
!
(
*
grad
)
->
surroundcolors
){
GdipFree
((
*
grad
)
->
blendfac
);
GdipFree
((
*
grad
)
->
blendpos
);
GdipFree
((
*
grad
)
->
surroundcolors
);
GdipFree
(
*
grad
);
*
grad
=
NULL
;
return
OutOfMemory
;
...
...
@@ -521,6 +526,8 @@ static GpStatus create_path_gradient(GpPath *path, GpPathGradient **grad)
(
*
grad
)
->
center
.
Y
=
bounds
.
Y
+
bounds
.
Height
/
2
;
(
*
grad
)
->
focus
.
X
=
0
.
0
;
(
*
grad
)
->
focus
.
Y
=
0
.
0
;
(
*
grad
)
->
surroundcolors
[
0
]
=
0xffffffff
;
(
*
grad
)
->
surroundcolorcount
=
1
;
TRACE
(
"<-- %p
\n
"
,
*
grad
);
...
...
@@ -870,6 +877,7 @@ GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
GdipDeletePath
(((
GpPathGradient
*
)
brush
)
->
path
);
GdipFree
(((
GpPathGradient
*
)
brush
)
->
blendfac
);
GdipFree
(((
GpPathGradient
*
)
brush
)
->
blendpos
);
GdipFree
(((
GpPathGradient
*
)
brush
)
->
surroundcolors
);
break
;
case
BrushTypeLinearGradient
:
GdipFree
(((
GpLineGradient
*
)
brush
)
->
blendfac
);
...
...
@@ -1086,32 +1094,40 @@ GpStatus WINGDIPAPI GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect
GpStatus
WINGDIPAPI
GdipGetPathGradientSurroundColorsWithCount
(
GpPathGradient
*
grad
,
ARGB
*
argb
,
INT
*
count
)
{
static
int
calls
;
INT
i
;
TRACE
(
"(%p,%p,%p)
\n
"
,
grad
,
argb
,
count
);
if
(
!
grad
||
!
argb
||
!
count
||
(
*
count
<
grad
->
path
->
pathdata
.
Count
))
return
InvalidParameter
;
if
(
!
(
calls
++
))
FIXME
(
"not implemented
\n
"
);
for
(
i
=
0
;
i
<
grad
->
path
->
pathdata
.
Count
;
i
++
)
{
if
(
i
<
grad
->
surroundcolorcount
)
argb
[
i
]
=
grad
->
surroundcolors
[
i
];
else
argb
[
i
]
=
grad
->
surroundcolors
[
grad
->
surroundcolorcount
-
1
];
}
return
NotImplemented
;
*
count
=
grad
->
surroundcolorcount
;
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipGetPathGradientSurroundColorCount
(
GpPathGradient
*
brush
,
INT
*
count
)
{
static
int
calls
;
TRACE
(
"(%p, %p)
\n
"
,
brush
,
count
);
if
(
!
brush
||
!
count
)
return
InvalidParameter
;
if
(
!
(
calls
++
))
FIXME
(
"not implemented
\n
"
);
/* Yes, this actually returns the number of points in the path (which is the
* required size of a buffer to get the surround colors), rather than the
* number of surround colors. The real count is returned when getting the
* colors. */
*
count
=
brush
->
path
->
pathdata
.
Count
;
return
NotImplemented
;
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipGetPathGradientWrapMode
(
GpPathGradient
*
brush
,
...
...
@@ -1503,7 +1519,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient *grad,
GpStatus
WINGDIPAPI
GdipSetPathGradientSurroundColorsWithCount
(
GpPathGradient
*
grad
,
GDIPCONST
ARGB
*
argb
,
INT
*
count
)
{
static
int
call
s
;
ARGB
*
new_surroundcolor
s
;
TRACE
(
"(%p,%p,%p)
\n
"
,
grad
,
argb
,
count
);
...
...
@@ -1511,10 +1527,18 @@ GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
(
*
count
>
grad
->
path
->
pathdata
.
Count
))
return
InvalidParameter
;
if
(
!
(
calls
++
))
FIXME
(
"not implemented
\n
"
);
new_surroundcolors
=
GdipAlloc
(
*
count
*
sizeof
(
ARGB
));
if
(
!
new_surroundcolors
)
return
OutOfMemory
;
return
NotImplemented
;
memcpy
(
new_surroundcolors
,
argb
,
*
count
*
sizeof
(
ARGB
));
GdipFree
(
grad
->
surroundcolors
);
grad
->
surroundcolors
=
new_surroundcolors
;
grad
->
surroundcolorcount
=
*
count
;
return
Ok
;
}
GpStatus
WINGDIPAPI
GdipSetPathGradientWrapMode
(
GpPathGradient
*
grad
,
...
...
dlls/gdiplus/gdiplus_private.h
View file @
7e90dc3d
...
...
@@ -196,6 +196,8 @@ struct GpPathGradient{
REAL
*
blendfac
;
/* blend factors */
REAL
*
blendpos
;
/* blend positions */
INT
blendcount
;
ARGB
*
surroundcolors
;
INT
surroundcolorcount
;
};
struct
GpLineGradient
{
...
...
dlls/gdiplus/tests/brush.c
View file @
7e90dc3d
...
...
@@ -781,25 +781,25 @@ static void test_gradientsurroundcolorcount(void)
count
=
0
;
status
=
GdipGetPathGradientSurroundColorCount
(
grad
,
&
count
);
todo_wine
expect
(
Ok
,
status
);
todo_wine
expect
(
2
,
count
);
expect
(
Ok
,
status
);
expect
(
2
,
count
);
color
[
0
]
=
color
[
1
]
=
color
[
2
]
=
0xdeadbeef
;
count
=
3
;
status
=
GdipGetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
todo_wine
expect
(
Ok
,
status
);
todo_wine
expect
(
1
,
count
);
todo_wine
expect
(
0xffffffff
,
color
[
0
]);
todo_wine
expect
(
0xffffffff
,
color
[
1
]);
expect
(
Ok
,
status
);
expect
(
1
,
count
);
expect
(
0xffffffff
,
color
[
0
]);
expect
(
0xffffffff
,
color
[
1
]);
expect
(
0xdeadbeef
,
color
[
2
]);
color
[
0
]
=
color
[
1
]
=
color
[
2
]
=
0xdeadbeef
;
count
=
2
;
status
=
GdipGetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
todo_wine
expect
(
Ok
,
status
);
todo_wine
expect
(
1
,
count
);
todo_wine
expect
(
0xffffffff
,
color
[
0
]);
todo_wine
expect
(
0xffffffff
,
color
[
1
]);
expect
(
Ok
,
status
);
expect
(
1
,
count
);
expect
(
0xffffffff
,
color
[
0
]);
expect
(
0xffffffff
,
color
[
1
]);
expect
(
0xdeadbeef
,
color
[
2
]);
color
[
0
]
=
color
[
1
]
=
color
[
2
]
=
0xdeadbeef
;
...
...
@@ -843,7 +843,7 @@ static void test_gradientsurroundcolorcount(void)
}
status
=
GdipSetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
todo_wine
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
expect
(
2
,
count
);
status
=
GdipGetPathGradientSurroundColorCount
(
NULL
,
&
count
);
...
...
@@ -854,26 +854,31 @@ static void test_gradientsurroundcolorcount(void)
count
=
0
;
status
=
GdipGetPathGradientSurroundColorCount
(
grad
,
&
count
);
todo_wine
expect
(
Ok
,
status
);
todo_wine
expect
(
2
,
count
);
expect
(
Ok
,
status
);
expect
(
2
,
count
);
color
[
0
]
=
color
[
1
]
=
color
[
2
]
=
0xdeadbeef
;
count
=
2
;
status
=
GdipGetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
todo_wine
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
expect
(
2
,
count
);
todo_wine
expect
(
0x00ff0000
,
color
[
0
]);
todo_wine
expect
(
0x0000ff00
,
color
[
1
]);
expect
(
0x00ff0000
,
color
[
0
]);
expect
(
0x0000ff00
,
color
[
1
]);
expect
(
0xdeadbeef
,
color
[
2
]);
count
=
1
;
status
=
GdipSetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
todo_wine
expect
(
Ok
,
status
);
expect
(
Ok
,
status
);
expect
(
1
,
count
);
count
=
0
;
status
=
GdipGetPathGradientSurroundColorCount
(
grad
,
&
count
);
expect
(
Ok
,
status
);
expect
(
2
,
count
);
count
=
0
;
status
=
GdipSetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
todo_wine
expect
(
InvalidParameter
,
status
);
expect
(
InvalidParameter
,
status
);
expect
(
0
,
count
);
GdipDeleteBrush
((
GpBrush
*
)
grad
);
...
...
@@ -884,11 +889,11 @@ static void test_gradientsurroundcolorcount(void)
color
[
0
]
=
color
[
1
]
=
color
[
2
]
=
0xdeadbeef
;
count
=
3
;
status
=
GdipGetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
todo_wine
expect
(
Ok
,
status
);
todo_wine
expect
(
1
,
count
);
todo_wine
expect
(
0xffffffff
,
color
[
0
]);
todo_wine
expect
(
0xffffffff
,
color
[
1
]);
todo_wine
expect
(
0xffffffff
,
color
[
2
]);
expect
(
Ok
,
status
);
expect
(
1
,
count
);
expect
(
0xffffffff
,
color
[
0
]);
expect
(
0xffffffff
,
color
[
1
]);
expect
(
0xffffffff
,
color
[
2
]);
color
[
0
]
=
color
[
1
]
=
color
[
2
]
=
0xdeadbeef
;
count
=
2
;
...
...
@@ -899,6 +904,11 @@ static void test_gradientsurroundcolorcount(void)
expect
(
0xdeadbeef
,
color
[
1
]);
expect
(
0xdeadbeef
,
color
[
2
]);
count
=
0
;
status
=
GdipGetPathGradientSurroundColorCount
(
grad
,
&
count
);
expect
(
Ok
,
status
);
expect
(
3
,
count
);
GdipDeleteBrush
((
GpBrush
*
)
grad
);
}
...
...
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