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
7670d766
Commit
7670d766
authored
Jan 23, 2007
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jan 24, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Do not use DIB APIs for bitmap bits in a device dependent format.
parent
81a294f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
66 deletions
+14
-66
cursoricon.c
dlls/user32/cursoricon.c
+14
-66
No files found.
dlls/user32/cursoricon.c
View file @
7670d766
...
...
@@ -1236,24 +1236,7 @@ HICON16 WINAPI CreateIcon16( HINSTANCE16 hInstance, INT16 nWidth,
* Success: handle to an icon
* Failure: NULL
*
* BUGS
*
* - The provided bitmaps are not resized!
* - The documentation says the lpXORbits bitmap must be in a device
* dependent format. But we must still resize it and perform depth
* conversions if necessary.
* - I'm a bit unsure about the how the 'device dependent format' thing works.
* I did some tests on windows and found that if you provide a 16bpp bitmap
* in lpXORbits, then its format but be 565 RGB if the screen's bit depth
* is 16bpp but it must be 555 RGB if the screen's bit depth is anything
* else. I don't know if this is part of the GDI specs or if this is a
* quirk of the graphics card driver.
* - You may think that we check whether the bit depths match or not
* as an optimization. But the truth is that the conversion using
* CreateDIBitmap does not work for some bit depth (e.g. 8bpp) and I have
* no idea why.
* - I'm pretty sure that all the things we do in CreateIcon should
* also be done in CreateIconIndirect...
* FIXME: Do we need to resize the bitmaps?
*/
HICON
WINAPI
CreateIcon
(
HINSTANCE
hInstance
,
/* [in] the application's hInstance */
...
...
@@ -1264,58 +1247,23 @@ HICON WINAPI CreateIcon(
LPCVOID
lpANDbits
,
/* [in] a monochrome bitmap representing the icon's mask */
LPCVOID
lpXORbits
)
/* [in] the icon's 'color' bitmap */
{
ICONINFO
iinfo
;
HICON
hIcon
;
HDC
hdc
;
TRACE_
(
icon
)(
"%dx%d
x%d, xor=%p, and=
%p
\n
"
,
nWidth
,
nHeight
,
bPlanes
*
bBitsPixel
,
lpXORbits
,
lpANDbits
);
TRACE_
(
icon
)(
"%dx%d
, planes %d, bpp %d, xor %p, and
%p
\n
"
,
nWidth
,
nHeight
,
bPlanes
,
bBitsPixel
,
lpXORbits
,
lpANDbits
);
hdc
=
GetDC
(
0
);
if
(
!
hdc
)
return
0
;
iinfo
.
fIcon
=
TRUE
;
iinfo
.
xHotspot
=
ICON_HOTSPOT
;
iinfo
.
yHotspot
=
ICON_HOTSPOT
;
iinfo
.
hbmMask
=
CreateBitmap
(
nWidth
,
nHeight
,
1
,
1
,
lpANDbits
);
iinfo
.
hbmColor
=
CreateBitmap
(
nWidth
,
nHeight
,
bPlanes
,
bBitsPixel
,
lpXORbits
);
hIcon
=
CreateIconIndirect
(
&
iinfo
);
DeleteObject
(
iinfo
.
hbmMask
);
DeleteObject
(
iinfo
.
hbmColor
);
if
(
GetDeviceCaps
(
hdc
,
BITSPIXEL
)
==
bBitsPixel
)
{
CURSORICONINFO
info
;
info
.
ptHotSpot
.
x
=
ICON_HOTSPOT
;
info
.
ptHotSpot
.
y
=
ICON_HOTSPOT
;
info
.
nWidth
=
nWidth
;
info
.
nHeight
=
nHeight
;
info
.
nWidthBytes
=
0
;
info
.
bPlanes
=
bPlanes
;
info
.
bBitsPerPixel
=
bBitsPixel
;
hIcon
=
HICON_32
(
CreateCursorIconIndirect16
(
0
,
&
info
,
lpANDbits
,
lpXORbits
));
}
else
{
ICONINFO
iinfo
;
BITMAPINFO
bmi
;
iinfo
.
fIcon
=
TRUE
;
iinfo
.
xHotspot
=
ICON_HOTSPOT
;
iinfo
.
yHotspot
=
ICON_HOTSPOT
;
iinfo
.
hbmMask
=
CreateBitmap
(
nWidth
,
nHeight
,
1
,
1
,
lpANDbits
);
bmi
.
bmiHeader
.
biSize
=
sizeof
(
bmi
.
bmiHeader
);
bmi
.
bmiHeader
.
biWidth
=
nWidth
;
bmi
.
bmiHeader
.
biHeight
=-
nHeight
;
bmi
.
bmiHeader
.
biPlanes
=
bPlanes
;
bmi
.
bmiHeader
.
biBitCount
=
bBitsPixel
;
bmi
.
bmiHeader
.
biCompression
=
BI_RGB
;
bmi
.
bmiHeader
.
biSizeImage
=
0
;
bmi
.
bmiHeader
.
biXPelsPerMeter
=
0
;
bmi
.
bmiHeader
.
biYPelsPerMeter
=
0
;
bmi
.
bmiHeader
.
biClrUsed
=
0
;
bmi
.
bmiHeader
.
biClrImportant
=
0
;
iinfo
.
hbmColor
=
CreateDIBitmap
(
hdc
,
&
bmi
.
bmiHeader
,
CBM_INIT
,
lpXORbits
,
&
bmi
,
DIB_RGB_COLORS
);
hIcon
=
CreateIconIndirect
(
&
iinfo
);
DeleteObject
(
iinfo
.
hbmMask
);
DeleteObject
(
iinfo
.
hbmColor
);
}
ReleaseDC
(
0
,
hdc
);
return
hIcon
;
}
...
...
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