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
44e554b7
Commit
44e554b7
authored
Jan 15, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jan 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Avoid not necessary memory allocation for palette entries.
parent
34ef07fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
22 deletions
+9
-22
image.c
dlls/gdiplus/image.c
+9
-22
No files found.
dlls/gdiplus/image.c
View file @
44e554b7
...
...
@@ -4724,28 +4724,17 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
if
(
retval
==
Ok
&&
hpal
)
{
WORD
num_palette_entries
;
PALETTEENTRY
*
palette_entries
=
NULL
;
PALETTEENTRY
entry
[
256
];
ColorPalette
*
palette
=
NULL
;
int
i
;
int
i
,
num_palette_entries
;
if
(
!
GetObjectW
(
hpal
,
sizeof
(
num_palette_entries
),
&
num_palette_entries
))
num_palette_entries
=
GetPaletteEntries
(
hpal
,
0
,
256
,
entry
);
if
(
!
num_palette_entries
)
retval
=
GenericError
;
if
(
retval
==
Ok
)
{
palette_entries
=
GdipAlloc
(
sizeof
(
PALETTEENTRY
)
*
num_palette_entries
);
palette
=
GdipAlloc
(
sizeof
(
ColorPalette
)
+
sizeof
(
ARGB
)
*
(
num_palette_entries
-
1
));
if
(
!
palette_entries
||
!
palette
)
retval
=
OutOfMemory
;
}
if
(
retval
==
Ok
)
{
if
(
!
GetPaletteEntries
(
hpal
,
0
,
num_palette_entries
,
palette_entries
))
retval
=
GenericError
;
}
palette
=
GdipAlloc
(
sizeof
(
ColorPalette
)
+
sizeof
(
ARGB
)
*
(
num_palette_entries
-
1
));
if
(
!
palette
)
retval
=
OutOfMemory
;
if
(
retval
==
Ok
)
{
...
...
@@ -4754,15 +4743,13 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
for
(
i
=
0
;
i
<
num_palette_entries
;
i
++
)
{
PALETTEENTRY
*
entry
=
&
palette_entries
[
i
];
palette
->
Entries
[
i
]
=
0xff000000
|
entry
->
peRed
<<
16
|
entry
->
peGreen
<<
8
|
entry
->
peBlue
;
palette
->
Entries
[
i
]
=
0xff000000
|
entry
[
i
].
peRed
<<
16
|
entry
[
i
].
peGreen
<<
8
|
entry
[
i
].
peBlue
;
}
retval
=
GdipSetImagePalette
((
GpImage
*
)
*
bitmap
,
palette
);
}
GdipFree
(
palette_entries
);
GdipFree
(
palette
);
}
...
...
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