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
e2b59a87
Commit
e2b59a87
authored
Apr 24, 2012
by
Vincent Povirk
Committed by
Alexandre Julliard
Apr 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Store only one surround color if all colors are the same.
parent
8273d58a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
3 deletions
+48
-3
brush.c
dlls/gdiplus/brush.c
+17
-3
brush.c
dlls/gdiplus/tests/brush.c
+31
-0
No files found.
dlls/gdiplus/brush.c
View file @
e2b59a87
...
...
@@ -1699,6 +1699,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
*
grad
,
GDIPCONST
ARGB
*
argb
,
INT
*
count
)
{
ARGB
*
new_surroundcolors
;
INT
i
,
num_colors
;
TRACE
(
"(%p,%p,%p)
\n
"
,
grad
,
argb
,
count
);
...
...
@@ -1706,16 +1707,29 @@ GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
(
*
count
>
grad
->
path
->
pathdata
.
Count
))
return
InvalidParameter
;
new_surroundcolors
=
GdipAlloc
(
*
count
*
sizeof
(
ARGB
));
num_colors
=
*
count
;
/* If all colors are the same, only store 1 color. */
if
(
*
count
>
1
)
{
for
(
i
=
1
;
i
<
num_colors
;
i
++
)
if
(
argb
[
i
]
!=
argb
[
i
-
1
])
break
;
if
(
i
==
num_colors
)
num_colors
=
1
;
}
new_surroundcolors
=
GdipAlloc
(
num_colors
*
sizeof
(
ARGB
));
if
(
!
new_surroundcolors
)
return
OutOfMemory
;
memcpy
(
new_surroundcolors
,
argb
,
*
count
*
sizeof
(
ARGB
));
memcpy
(
new_surroundcolors
,
argb
,
num_colors
*
sizeof
(
ARGB
));
GdipFree
(
grad
->
surroundcolors
);
grad
->
surroundcolors
=
new_surroundcolors
;
grad
->
surroundcolorcount
=
*
count
;
grad
->
surroundcolorcount
=
num_colors
;
return
Ok
;
}
...
...
dlls/gdiplus/tests/brush.c
View file @
e2b59a87
...
...
@@ -876,6 +876,37 @@ static void test_gradientsurroundcolorcount(void)
expect
(
Ok
,
status
);
expect
(
2
,
count
);
/* If all colors are the same, count is set to 1. */
color
[
0
]
=
color
[
1
]
=
0
;
count
=
2
;
status
=
GdipSetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
expect
(
Ok
,
status
);
expect
(
2
,
count
);
color
[
0
]
=
color
[
1
]
=
color
[
2
]
=
0xdeadbeef
;
count
=
2
;
status
=
GdipGetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
expect
(
Ok
,
status
);
expect
(
1
,
count
);
expect
(
0x00000000
,
color
[
0
]);
expect
(
0x00000000
,
color
[
1
]);
expect
(
0xdeadbeef
,
color
[
2
]);
color
[
0
]
=
color
[
1
]
=
0xff00ff00
;
count
=
2
;
status
=
GdipSetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
expect
(
Ok
,
status
);
expect
(
2
,
count
);
color
[
0
]
=
color
[
1
]
=
color
[
2
]
=
0xdeadbeef
;
count
=
2
;
status
=
GdipGetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
expect
(
Ok
,
status
);
expect
(
1
,
count
);
expect
(
0xff00ff00
,
color
[
0
]);
expect
(
0xff00ff00
,
color
[
1
]);
expect
(
0xdeadbeef
,
color
[
2
]);
count
=
0
;
status
=
GdipSetPathGradientSurroundColorsWithCount
(
grad
,
color
,
&
count
);
expect
(
InvalidParameter
,
status
);
...
...
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