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
d33e0d2c
Commit
d33e0d2c
authored
Jul 25, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add an inline helper to retrieve a DDB byte width.
parent
dcfe0c48
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
41 deletions
+10
-41
bitmap.c
dlls/gdi32/bitmap.c
+3
-38
objects.c
dlls/gdi32/enhmfdrv/objects.c
+1
-1
gdi_private.h
dlls/gdi32/gdi_private.h
+5
-1
objects.c
dlls/gdi32/mfdrv/objects.c
+1
-1
No files found.
dlls/gdi32/bitmap.c
View file @
d33e0d2c
...
...
@@ -137,41 +137,6 @@ done:
}
/***********************************************************************
* BITMAP_GetWidthBytes
*
* Return number of bytes taken by a scanline of 16-bit aligned Windows DDB
* data.
*/
INT
BITMAP_GetWidthBytes
(
INT
bmWidth
,
INT
bpp
)
{
switch
(
bpp
)
{
case
1
:
return
2
*
((
bmWidth
+
15
)
>>
4
);
case
24
:
bmWidth
*=
3
;
/* fall through */
case
8
:
return
bmWidth
+
(
bmWidth
&
1
);
case
32
:
return
bmWidth
*
4
;
case
16
:
case
15
:
return
bmWidth
*
2
;
case
4
:
return
2
*
((
bmWidth
+
3
)
>>
2
);
default:
WARN
(
"Unknown depth %d, please report.
\n
"
,
bpp
);
}
return
-
1
;
}
/******************************************************************************
* CreateBitmap [GDI32.@]
*
...
...
@@ -196,7 +161,7 @@ HBITMAP WINAPI CreateBitmap( INT width, INT height, UINT planes,
bm
.
bmType
=
0
;
bm
.
bmWidth
=
width
;
bm
.
bmHeight
=
height
;
bm
.
bmWidthBytes
=
BITMAP_GetWidthBytes
(
width
,
bpp
);
bm
.
bmWidthBytes
=
get_bitmap_stride
(
width
,
bpp
);
bm
.
bmPlanes
=
planes
;
bm
.
bmBitsPixel
=
bpp
;
bm
.
bmBits
=
(
LPVOID
)
bits
;
...
...
@@ -363,7 +328,7 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp )
}
/* Windows ignores the provided bm.bmWidthBytes */
bm
.
bmWidthBytes
=
BITMAP_GetWidthBytes
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
);
bm
.
bmWidthBytes
=
get_bitmap_stride
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
);
/* XP doesn't allow to create bitmaps larger than 128 Mb */
if
(
bm
.
bmHeight
>
128
*
1024
*
1024
/
bm
.
bmWidthBytes
)
{
...
...
@@ -426,7 +391,7 @@ LONG WINAPI GetBitmapBits(
{
DIBSECTION
*
dib
=
bmp
->
dib
;
const
char
*
src
=
dib
->
dsBm
.
bmBits
;
INT
width_bytes
=
BITMAP_GetWidthBytes
(
dib
->
dsBm
.
bmWidth
,
dib
->
dsBm
.
bmBitsPixel
);
INT
width_bytes
=
get_bitmap_stride
(
dib
->
dsBm
.
bmWidth
,
dib
->
dsBm
.
bmBitsPixel
);
LONG
max
=
width_bytes
*
bmp
->
bitmap
.
bmHeight
;
if
(
!
bits
)
...
...
dlls/gdi32/enhmfdrv/objects.c
View file @
d33e0d2c
...
...
@@ -231,7 +231,7 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
info
->
biBitCount
=
bm
.
bmBitsPixel
;
info
->
biSizeImage
=
bmSize
;
GetBitmapBits
((
HANDLE
)
logbrush
.
lbHatch
,
bm
.
bmHeight
*
BITMAP_GetWidthBytes
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
),
bm
.
bmHeight
*
get_bitmap_stride
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
),
(
LPBYTE
)
info
+
sizeof
(
BITMAPINFOHEADER
));
/* Change the padding to be DIB compatible if needed */
...
...
dlls/gdi32/gdi_private.h
View file @
d33e0d2c
...
...
@@ -311,7 +311,6 @@ extern BOOL BIDI_Reorder( HDC hDC, LPCWSTR lpString, INT uCount, DWORD dwFlags,
/* bitmap.c */
extern
HBITMAP
BITMAP_CopyBitmap
(
HBITMAP
hbitmap
)
DECLSPEC_HIDDEN
;
extern
BOOL
BITMAP_SetOwnerDC
(
HBITMAP
hbitmap
,
PHYSDEV
physdev
)
DECLSPEC_HIDDEN
;
extern
INT
BITMAP_GetWidthBytes
(
INT
bmWidth
,
INT
bpp
)
DECLSPEC_HIDDEN
;
/* clipping.c */
extern
int
get_clip_box
(
DC
*
dc
,
RECT
*
rect
)
DECLSPEC_HIDDEN
;
...
...
@@ -549,6 +548,11 @@ static inline void offset_rect( RECT *rect, int offset_x, int offset_y )
rect
->
bottom
+=
offset_y
;
}
static
inline
int
get_bitmap_stride
(
int
width
,
int
bpp
)
{
return
((
width
*
bpp
+
15
)
>>
3
)
&
~
1
;
}
static
inline
int
get_dib_stride
(
int
width
,
int
bpp
)
{
return
((
width
*
bpp
+
31
)
>>
3
)
&
~
3
;
...
...
dlls/gdi32/mfdrv/objects.c
View file @
d33e0d2c
...
...
@@ -270,7 +270,7 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush )
info
->
bmiHeader
.
biSizeImage
=
bmSize
;
GetBitmapBits
((
HANDLE
)
logbrush
.
lbHatch
,
bm
.
bmHeight
*
BITMAP_GetWidthBytes
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
),
bm
.
bmHeight
*
get_bitmap_stride
(
bm
.
bmWidth
,
bm
.
bmBitsPixel
),
(
LPBYTE
)
info
+
sizeof
(
BITMAPINFO
)
+
sizeof
(
RGBQUAD
));
/* Change the padding to be DIB compatible if needed */
...
...
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