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
4386caa1
Commit
4386caa1
authored
Dec 05, 2008
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Dec 05, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Reduce the number of casts by using the proper type for variables.
parent
176c8eb3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
23 deletions
+20
-23
brush.c
dlls/gdiplus/brush.c
+5
-6
image.c
dlls/gdiplus/image.c
+15
-17
No files found.
dlls/gdiplus/brush.c
View file @
4386caa1
...
...
@@ -478,8 +478,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
REAL
height
,
GpTexture
**
texture
)
{
HDC
hdc
;
OLE_HANDLE
hbm
;
HBITMAP
old
=
NULL
;
HBITMAP
hbm
,
old
=
NULL
;
BITMAPINFO
*
pbmi
;
BITMAPINFOHEADER
*
bmih
;
INT
n_x
,
n_y
,
n_width
,
n_height
,
abs_height
,
stride
,
image_stride
,
i
,
bytespp
;
...
...
@@ -507,7 +506,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
n_y
+
n_height
>
((
GpBitmap
*
)
image
)
->
height
)
return
InvalidParameter
;
IPicture_get_Handle
(
image
->
picture
,
&
hbm
);
IPicture_get_Handle
(
image
->
picture
,
(
OLE_HANDLE
*
)
&
hbm
);
if
(
!
hbm
)
return
GenericError
;
IPicture_get_CurDC
(
image
->
picture
,
&
hdc
);
bm_is_selected
=
(
hdc
!=
0
);
...
...
@@ -520,11 +519,11 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
if
(
!
bm_is_selected
){
hdc
=
CreateCompatibleDC
(
0
);
old
=
SelectObject
(
hdc
,
(
HBITMAP
)
hbm
);
old
=
SelectObject
(
hdc
,
hbm
);
}
/* fill out bmi */
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
bytespp
=
pbmi
->
bmiHeader
.
biBitCount
/
8
;
abs_height
=
abs
(
pbmi
->
bmiHeader
.
biHeight
);
...
...
@@ -538,7 +537,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
dibits
=
GdipAlloc
(
pbmi
->
bmiHeader
.
biSizeImage
);
if
(
dibits
)
/* this is not a good place to error out */
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs_height
,
dibits
,
pbmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
hbm
,
0
,
abs_height
,
dibits
,
pbmi
,
DIB_RGB_COLORS
);
if
(
!
bm_is_selected
){
SelectObject
(
hdc
,
old
);
...
...
dlls/gdiplus/image.c
View file @
4386caa1
...
...
@@ -96,9 +96,8 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
{
BOOL
bm_is_selected
;
INT
stride
,
bitspp
=
PIXELFORMATBPP
(
format
);
OLE_HANDLE
hbm
;
HDC
hdc
;
HBITMAP
old
=
NULL
;
HBITMAP
hbm
,
old
=
NULL
;
BITMAPINFO
*
pbmi
;
BYTE
*
buff
=
NULL
;
UINT
abs_height
;
...
...
@@ -128,7 +127,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
if
(
bitmap
->
lockmode
)
return
WrongState
;
IPicture_get_Handle
(
bitmap
->
image
.
picture
,
&
hbm
);
IPicture_get_Handle
(
bitmap
->
image
.
picture
,
(
OLE_HANDLE
*
)
&
hbm
);
IPicture_get_CurDC
(
bitmap
->
image
.
picture
,
&
hdc
);
bm_is_selected
=
(
hdc
!=
0
);
...
...
@@ -140,11 +139,11 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
if
(
!
bm_is_selected
){
hdc
=
CreateCompatibleDC
(
0
);
old
=
SelectObject
(
hdc
,
(
HBITMAP
)
hbm
);
old
=
SelectObject
(
hdc
,
hbm
);
}
/* fill out bmi */
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
abs_height
=
abs
(
pbmi
->
bmiHeader
.
biHeight
);
stride
=
pbmi
->
bmiHeader
.
biWidth
*
bitspp
/
8
;
...
...
@@ -155,7 +154,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
pbmi
->
bmiHeader
.
biBitCount
=
bitspp
;
if
(
buff
)
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs_height
,
buff
,
pbmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
hbm
,
0
,
abs_height
,
buff
,
pbmi
,
DIB_RGB_COLORS
);
if
(
!
bm_is_selected
){
SelectObject
(
hdc
,
old
);
...
...
@@ -194,9 +193,8 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
GpStatus
WINGDIPAPI
GdipBitmapUnlockBits
(
GpBitmap
*
bitmap
,
BitmapData
*
lockeddata
)
{
OLE_HANDLE
hbm
;
HDC
hdc
;
HBITMAP
old
=
NULL
;
HBITMAP
hbm
,
old
=
NULL
;
BOOL
bm_is_selected
;
BITMAPINFO
*
pbmi
;
...
...
@@ -218,7 +216,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
return
Ok
;
}
IPicture_get_Handle
(
bitmap
->
image
.
picture
,
&
hbm
);
IPicture_get_Handle
(
bitmap
->
image
.
picture
,
(
OLE_HANDLE
*
)
&
hbm
);
IPicture_get_CurDC
(
bitmap
->
image
.
picture
,
&
hdc
);
bm_is_selected
=
(
hdc
!=
0
);
...
...
@@ -228,12 +226,12 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
if
(
!
bm_is_selected
){
hdc
=
CreateCompatibleDC
(
0
);
old
=
SelectObject
(
hdc
,
(
HBITMAP
)
hbm
);
old
=
SelectObject
(
hdc
,
hbm
);
}
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
pbmi
->
bmiHeader
.
biBitCount
=
PIXELFORMATBPP
(
lockeddata
->
PixelFormat
);
SetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
abs
(
pbmi
->
bmiHeader
.
biHeight
),
SetDIBits
(
hdc
,
hbm
,
0
,
abs
(
pbmi
->
bmiHeader
.
biHeight
),
bitmap
->
bitmapbits
,
pbmi
,
DIB_RGB_COLORS
);
if
(
!
bm_is_selected
){
...
...
@@ -1035,7 +1033,7 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
if
(
type
==
PICTYPE_BITMAP
){
BITMAPINFO
*
pbmi
;
BITMAPCOREHEADER
*
bmch
;
OLE_HANDLE
hbm
;
HBITMAP
hbm
;
HDC
hdc
;
pbmi
=
GdipAlloc
(
sizeof
(
BITMAPINFOHEADER
)
+
256
*
sizeof
(
RGBQUAD
));
...
...
@@ -1052,7 +1050,7 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
(
*
((
GpBitmap
**
)
image
))
->
height
=
ipicture_pixel_height
(
pic
);
/* get the pixel format */
IPicture_get_Handle
(
pic
,
&
hbm
);
IPicture_get_Handle
(
pic
,
(
OLE_HANDLE
*
)
&
hbm
);
IPicture_get_CurDC
(
pic
,
&
hdc
);
bmch
=
(
BITMAPCOREHEADER
*
)
(
&
pbmi
->
bmiHeader
);
...
...
@@ -1061,13 +1059,13 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
if
(
!
hdc
){
HBITMAP
old
;
hdc
=
CreateCompatibleDC
(
0
);
old
=
SelectObject
(
hdc
,
(
HBITMAP
)
hbm
);
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
old
=
SelectObject
(
hdc
,
hbm
);
GetDIBits
(
hdc
,
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
SelectObject
(
hdc
,
old
);
DeleteDC
(
hdc
);
}
else
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
hbm
,
0
,
0
,
NULL
,
pbmi
,
DIB_RGB_COLORS
);
(
*
((
GpBitmap
**
)
image
))
->
format
=
(
bmch
->
bcBitCount
<<
8
)
|
PixelFormatGDI
;
GdipFree
(
pbmi
);
...
...
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