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
608629bc
Commit
608629bc
authored
Apr 18, 1999
by
Huw D M Davies
Committed by
Alexandre Julliard
Apr 18, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for upside-down DIBs.
parent
251ed43b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
26 deletions
+42
-26
objects.c
graphics/metafiledrv/objects.c
+4
-4
dib.c
graphics/x11drv/dib.c
+4
-3
bitmap.h
include/bitmap.h
+1
-0
brush.c
objects/brush.c
+11
-10
cursoricon.c
objects/cursoricon.c
+4
-3
dib.c
objects/dib.c
+18
-6
No files found.
graphics/metafiledrv/objects.c
View file @
608629bc
...
...
@@ -74,7 +74,7 @@ static BOOL MFDRV_CreatePatternBrush(DC *dc, HBRUSH16 hBrush,
return
FALSE
;
}
bmSize
=
bm
.
bmHeight
*
DIB_GetDIBWidthBytes
(
bm
.
bmWidth
,
1
);
bmSize
=
DIB_GetDIBImageBytes
(
bm
.
bmWidth
,
bm
.
bmHeight
,
1
);
len
=
sizeof
(
METARECORD
)
+
sizeof
(
WORD
)
+
sizeof
(
BITMAPINFO
)
+
sizeof
(
RGBQUAD
)
+
bmSize
;
...
...
@@ -106,9 +106,9 @@ static BOOL MFDRV_CreatePatternBrush(DC *dc, HBRUSH16 hBrush,
if
(
info
->
bmiHeader
.
biCompression
)
bmSize
=
info
->
bmiHeader
.
biSizeImage
;
else
bmSize
=
DIB_GetDIB
Width
Bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
bi
BitCount
)
*
info
->
bmiHeader
.
biHeight
;
bmSize
=
DIB_GetDIB
Image
Bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
bi
Height
,
info
->
bmiHeader
.
biBitCount
)
;
biSize
=
DIB_BitmapInfoSize
(
info
,
LOWORD
(
logbrush
->
lbColor
));
len
=
sizeof
(
METARECORD
)
+
biSize
+
bmSize
+
2
;
mr
=
HeapAlloc
(
SystemHeap
,
HEAP_ZERO_MEMORY
,
len
);
...
...
graphics/x11drv/dib.c
View file @
608629bc
...
...
@@ -1880,9 +1880,10 @@ INT X11DRV_DIB_GetDIBits(
LeaveCriticalSection
(
&
X11DRV_CritSection
);
if
(
info
->
bmiHeader
.
biSizeImage
==
0
)
/* Fill in biSizeImage */
info
->
bmiHeader
.
biSizeImage
=
info
->
bmiHeader
.
biHeight
*
DIB_GetDIBWidthBytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
biBitCount
);
info
->
bmiHeader
.
biSizeImage
=
DIB_GetDIBImageBytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
biHeight
,
info
->
bmiHeader
.
biBitCount
);
if
(
bbits
-
(
BYTE
*
)
bits
>
info
->
bmiHeader
.
biSizeImage
)
ERR
(
bitmap
,
"Buffer overrun. Please investigate.
\n
"
);
...
...
include/bitmap.h
View file @
608629bc
...
...
@@ -55,6 +55,7 @@ extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap );
/* objects/dib.c */
extern
int
DIB_GetDIBWidthBytes
(
int
width
,
int
depth
);
extern
int
DIB_GetDIBImageBytes
(
int
width
,
int
height
,
int
depth
);
extern
int
DIB_BitmapInfoSize
(
BITMAPINFO
*
info
,
WORD
coloruse
);
extern
int
DIB_GetBitmapInfo
(
const
BITMAPINFOHEADER
*
header
,
DWORD
*
width
,
int
*
height
,
WORD
*
bpp
,
WORD
*
compr
);
...
...
objects/brush.c
View file @
608629bc
...
...
@@ -114,9 +114,9 @@ HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
if
(
info
->
bmiHeader
.
biCompression
)
size
=
info
->
bmiHeader
.
biSizeImage
;
else
size
=
DIB_GetDIB
Width
Bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
bi
BitCount
)
*
info
->
bmiHeader
.
biHeight
;
size
=
DIB_GetDIB
Image
Bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
bi
Height
,
info
->
bmiHeader
.
biBitCount
)
;
size
+=
DIB_BitmapInfoSize
(
info
,
coloruse
);
if
(
!
(
logbrush
.
lbHatch
=
(
INT16
)
GlobalAlloc16
(
GMEM_MOVEABLE
,
size
)))
...
...
@@ -164,9 +164,9 @@ HBRUSH WINAPI CreateDIBPatternBrush(
if
(
info
->
bmiHeader
.
biCompression
)
size
=
info
->
bmiHeader
.
biSizeImage
;
else
size
=
DIB_GetDIB
Width
Bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
bi
BitCount
)
*
info
->
bmiHeader
.
biHeight
;
size
=
DIB_GetDIB
Image
Bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
bi
Height
,
info
->
bmiHeader
.
biBitCount
)
;
size
+=
DIB_BitmapInfoSize
(
info
,
coloruse
);
if
(
!
(
logbrush
.
lbHatch
=
(
INT
)
GlobalAlloc16
(
GMEM_MOVEABLE
,
size
)))
...
...
@@ -204,7 +204,8 @@ HBRUSH WINAPI CreateDIBPatternBrushPt(
BITMAPINFO
*
newInfo
;
INT
size
;
TRACE
(
gdi
,
"%p
\n
"
,
info
);
TRACE
(
gdi
,
"%p %ldx%ld %dbpp
\n
"
,
info
,
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
biHeight
,
info
->
bmiHeader
.
biBitCount
);
/* Make a copy of the bitmap */
...
...
@@ -212,9 +213,9 @@ HBRUSH WINAPI CreateDIBPatternBrushPt(
if
(
info
->
bmiHeader
.
biCompression
)
size
=
info
->
bmiHeader
.
biSizeImage
;
else
size
=
DIB_GetDIB
Width
Bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
bi
BitCount
)
*
info
->
bmiHeader
.
biHeight
;
size
=
DIB_GetDIB
Image
Bytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
bi
Height
,
info
->
bmiHeader
.
biBitCount
)
;
size
+=
DIB_BitmapInfoSize
(
info
,
coloruse
);
if
(
!
(
logbrush
.
lbHatch
=
(
INT
)
GlobalAlloc16
(
GMEM_MOVEABLE
,
size
)))
...
...
objects/cursoricon.c
View file @
608629bc
...
...
@@ -524,9 +524,10 @@ static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE16 hInstance, HGLOBAL16
CBM_INIT
,
(
char
*
)
bmi
+
size
,
pInfo
,
DIB_RGB_COLORS
);
if
(
hXorBits
)
{
char
*
bits
=
(
char
*
)
bmi
+
size
+
bmi
->
bmiHeader
.
biHeight
*
DIB_GetDIBWidthBytes
(
bmi
->
bmiHeader
.
biWidth
,
bmi
->
bmiHeader
.
biBitCount
)
/
2
;
char
*
bits
=
(
char
*
)
bmi
+
size
+
DIB_GetDIBImageBytes
(
bmi
->
bmiHeader
.
biWidth
,
bmi
->
bmiHeader
.
biHeight
,
bmi
->
bmiHeader
.
biBitCount
)
/
2
;
pInfo
->
bmiHeader
.
biBitCount
=
1
;
if
(
pInfo
->
bmiHeader
.
biSize
==
sizeof
(
BITMAPINFOHEADER
))
...
...
objects/dib.c
View file @
608629bc
...
...
@@ -40,6 +40,16 @@ int DIB_GetDIBWidthBytes( int width, int depth )
return
4
*
words
;
}
/***********************************************************************
* DIB_GetDIBImageBytes
*
* Return the number of bytes used to hold the image in a DIB bitmap.
*/
int
DIB_GetDIBImageBytes
(
int
width
,
int
height
,
int
depth
)
{
return
DIB_GetDIBWidthBytes
(
width
,
depth
)
*
abs
(
height
);
}
/***********************************************************************
* DIB_BitmapInfoSize
...
...
@@ -537,16 +547,18 @@ INT WINAPI GetDIBits(
info
->
bmiHeader
.
biHeight
=
bmp
->
bitmap
.
bmHeight
;
info
->
bmiHeader
.
biPlanes
=
1
;
info
->
bmiHeader
.
biBitCount
=
bmp
->
bitmap
.
bmBitsPixel
;
info
->
bmiHeader
.
biSizeImage
=
bmp
->
bitmap
.
bmHeight
*
DIB_GetDIBWidthBytes
(
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmBitsPixel
);
info
->
bmiHeader
.
biSizeImage
=
DIB_GetDIBImageBytes
(
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmHeight
,
bmp
->
bitmap
.
bmBitsPixel
);
info
->
bmiHeader
.
biCompression
=
0
;
}
else
{
info
->
bmiHeader
.
biSizeImage
=
info
->
bmiHeader
.
biHeight
*
DIB_GetDIBWidthBytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
biBitCount
);
info
->
bmiHeader
.
biSizeImage
=
DIB_GetDIBImageBytes
(
info
->
bmiHeader
.
biWidth
,
info
->
bmiHeader
.
biHeight
,
info
->
bmiHeader
.
biBitCount
);
}
}
...
...
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