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
1420acef
Commit
1420acef
authored
Apr 02, 2003
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Apr 02, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ImageList_Read - the root cause of ugly toolbar icons.
parent
462172a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
25 deletions
+21
-25
imagelist.c
dlls/comctl32/imagelist.c
+21
-25
No files found.
dlls/comctl32/imagelist.c
View file @
1420acef
...
...
@@ -1894,15 +1894,14 @@ static int may_use_dibsection(HDC hdc) {
/* helper for ImageList_Read, see comments below */
static
HBITMAP
_read_bitmap
(
LPSTREAM
pstm
,
int
ilcFlag
,
int
cx
,
int
cy
)
{
HDC
xdc
=
0
;
HDC
xdc
=
0
,
hBitmapDC
=
0
;
BITMAPFILEHEADER
bmfh
;
BITMAPINFOHEADER
bmih
;
int
bitsperpixel
,
palspace
,
longsperline
,
width
,
height
;
LPBITMAPINFOHEADER
bmihc
=
NULL
;
int
result
=
0
;
HBITMAP
hbitmap
=
0
;
LPBYTE
bits
=
NULL
,
nbits
=
NULL
;
int
nbytesperline
,
bytesperline
;
HBITMAP
hbitmap
=
0
,
hDIB
=
0
;
LPBYTE
bits
=
NULL
;
if
(
!
SUCCEEDED
(
IStream_Read
(
pstm
,
&
bmfh
,
sizeof
(
bmfh
),
NULL
))
||
(
bmfh
.
bfType
!=
((
'M'
<<
8
)
|
'B'
))
||
...
...
@@ -1942,44 +1941,41 @@ static HBITMAP _read_bitmap(LPSTREAM pstm,int ilcFlag,int cx,int cy) {
} else
#endif
{
int
i
,
nwidth
,
nheight
;
int
i
,
nwidth
,
nheight
,
nRows
;
nwidth
=
width
*
(
height
/
cy
);
nheight
=
cy
;
nRows
=
(
height
/
cy
);
if
(
bitsperpixel
==
1
)
hbitmap
=
CreateBitmap
(
nwidth
,
nheight
,
1
,
1
,
NULL
);
else
hbitmap
=
CreateCompatibleBitmap
(
xdc
,
nwidth
,
nheight
);
/* Might be a bit excessive memory use here */
bits
=
(
LPBYTE
)
LocalAlloc
(
LMEM_ZEROINIT
,
bmihc
->
biSizeImage
);
nbits
=
(
LPBYTE
)
LocalAlloc
(
LMEM_ZEROINIT
,
bmihc
->
biSizeImage
);
if
(
!
SUCCEEDED
(
IStream_Read
(
pstm
,
bits
,
bmihc
->
biSizeImage
,
NULL
)))
goto
ret1
;
hDIB
=
CreateDIBSection
(
xdc
,(
BITMAPINFO
*
)
bmihc
,
0
,(
LPVOID
*
)
&
bits
,
0
,
0
);
if
(
!
hDIB
)
goto
ret1
;
if
(
!
SUCCEEDED
(
IStream_Read
(
pstm
,
bits
,
bmihc
->
biSizeImage
,
NULL
)))
goto
ret1
;
hBitmapDC
=
CreateCompatibleDC
(
0
);
SelectObject
(
hBitmapDC
,
hbitmap
);
/* Copy the NxM bitmap into a 1x(N*M) bitmap we need, linewise */
/* Do not forget that windows bitmaps are bottom->top */
bytesperline
=
longsperline
*
4
;
nbytesperline
=
(
height
/
cy
)
*
bytesperline
;
for
(
i
=
0
;
i
<
height
;
i
++
)
{
memcpy
(
nbits
+
((
height
-
1
-
i
)
%
cy
)
*
nbytesperline
+
(
i
/
cy
)
*
bytesperline
,
bits
+
bytesperline
*
(
height
-
1
-
i
),
bytesperline
);
}
bmihc
->
biWidth
=
nwidth
;
bmihc
->
biHeight
=
nheight
;
if
(
!
SetDIBits
(
xdc
,
hbitmap
,
0
,
nheight
,
nbits
,(
BITMAPINFO
*
)
bmihc
,
0
))
goto
ret1
;
LocalFree
((
HLOCAL
)
nbits
);
LocalFree
((
HLOCAL
)
bits
);
TRACE
(
"nRows=%d
\n
"
,
nRows
);
for
(
i
=
0
;
i
<
nRows
;
i
++
){
StretchDIBits
(
hBitmapDC
,
width
*
i
,
0
,
width
,
cy
,
0
,
cy
*
(
nRows
-
1
-
i
),
width
,
cy
,
bits
,
(
BITMAPINFO
*
)
bmihc
,
DIB_RGB_COLORS
,
SRCCOPY
);
}
result
=
1
;
}
ret1:
if
(
xdc
)
ReleaseDC
(
0
,
xdc
);
if
(
bmihc
)
LocalFree
((
HLOCAL
)
bmihc
);
if
(
hDIB
)
DeleteObject
(
hDIB
);
if
(
hBitmapDC
)
DeleteDC
(
hBitmapDC
);
if
(
!
result
)
{
if
(
hbitmap
)
{
DeleteObject
(
hbitmap
);
...
...
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