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
0aab81fa
Commit
0aab81fa
authored
Jun 01, 2004
by
Jon Griffiths
Committed by
Alexandre Julliard
Jun 01, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also handle OS2 v1.x (AKA windows 2.0) bitmaps.
parent
9c4df210
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
9 deletions
+50
-9
newstruc.c
tools/wrc/newstruc.c
+50
-9
No files found.
tools/wrc/newstruc.c
View file @
0aab81fa
...
...
@@ -34,6 +34,17 @@
#include "wingdi.h"
/* for BITMAPINFOHEADER */
#include <pshpack2.h>
typedef
struct
{
DWORD
biSize
;
WORD
biWidth
;
WORD
biHeight
;
WORD
biPlanes
;
WORD
biBitCount
;
}
BITMAPOS2HEADER
;
#include <poppack.h>
/* Generate new_* functions that have no parameters (NOTE: no ';') */
__NEW_STRUCT_FUNC
(
dialog
)
__NEW_STRUCT_FUNC
(
dialogex
)
...
...
@@ -220,25 +231,40 @@ static void convert_bitmap_swap_v4(BITMAPV4HEADER *b4h)
b4h
->
bV4GammaBlue
=
BYTESWAP_DWORD
(
b4h
->
bV4GammaBlue
);
}
static
void
convert_bitmap_swap_os2
(
BITMAPOS2HEADER
*
boh
)
{
boh
->
biSize
=
BYTESWAP_DWORD
(
boh
->
biSize
);
boh
->
biWidth
=
BYTESWAP_WORD
(
boh
->
biWidth
);
boh
->
biHeight
=
BYTESWAP_WORD
(
boh
->
biHeight
);
boh
->
biPlanes
=
BYTESWAP_WORD
(
boh
->
biPlanes
);
boh
->
biBitCount
=
BYTESWAP_WORD
(
boh
->
biBitCount
);
}
#define FL_SIGBE 0x01
#define FL_SIZEBE 0x02
#define FL_V4 0x04
#define FL_OS2 0x08
static
int
convert_bitmap
(
char
*
data
,
int
size
)
{
BITMAPINFOHEADER
*
bih
=
(
BITMAPINFOHEADER
*
)
data
;
BITMAPV4HEADER
*
b4h
=
(
BITMAPV4HEADER
*
)
data
;
BITMAPOS2HEADER
*
boh
=
(
BITMAPOS2HEADER
*
)
data
;
int
type
=
0
;
int
returnSize
=
0
;
/* size to be returned */
int
returnSize
=
0
;
/* size to be returned */
#ifdef WORDS_BIGENDIAN
DWORD
bisizel
=
BYTESWAP_DWORD
(
sizeof
(
BITMAPINFOHEADER
));
DWORD
b4sizel
=
BYTESWAP_DWORD
(
sizeof
(
BITMAPV4HEADER
));
DWORD
bosizel
=
BYTESWAP_DWORD
(
sizeof
(
BITMAPOS2HEADER
));
DWORD
bisizeb
=
sizeof
(
BITMAPINFOHEADER
);
DWORD
b4sizeb
=
sizeof
(
BITMAPV4HEADER
);
DWORD
bosizeb
=
sizeof
(
BITMAPOS2HEADER
);
#else
DWORD
bisizel
=
sizeof
(
BITMAPINFOHEADER
);
DWORD
b4sizel
=
sizeof
(
BITMAPV4HEADER
);
DWORD
bosizel
=
sizeof
(
BITMAPOS2HEADER
);
DWORD
bisizeb
=
BYTESWAP_DWORD
(
sizeof
(
BITMAPINFOHEADER
));
DWORD
b4sizeb
=
BYTESWAP_DWORD
(
sizeof
(
BITMAPV4HEADER
));
DWORD
bosizeb
=
BYTESWAP_DWORD
(
sizeof
(
BITMAPOS2HEADER
));
#endif
...
...
@@ -265,20 +291,28 @@ static int convert_bitmap(char *data, int size)
{
/* Little endian */
}
else
if
(
bih
->
biSize
==
b4sizel
)
{
type
|=
FL_V4
;
}
else
if
(
bih
->
biSize
==
bisizeb
)
{
type
|=
FL_SIZEBE
;
}
else
if
(
bih
->
biSize
==
b4sizel
)
{
type
|=
FL_V4
;
}
else
if
(
bih
->
biSize
==
b4sizeb
)
{
type
|=
FL_SIZEBE
|
FL_V4
;
}
else
if
(
!
bih
->
biSize
||
bih
->
biSize
==
bosizel
)
{
type
|=
FL_OS2
;
}
else
if
(
bih
->
biSize
==
bosizeb
)
{
type
|=
FL_SIZEBE
|
FL_OS2
;
}
else
type
=
-
1
;
yyerror
(
"Invalid bitmap format, bih->biSize = %ld"
,
bih
->
biSize
)
;
switch
(
type
)
{
...
...
@@ -286,15 +320,14 @@ static int convert_bitmap(char *data, int size)
break
;
case
FL_SIZEBE
:
case
FL_SIZEBE
|
FL_V4
:
case
FL_SIZEBE
|
FL_OS2
:
yywarning
(
"Bitmap v%c signature little-endian, but size big-endian"
,
type
&
FL_V4
?
'4'
:
'3'
);
break
;
case
FL_SIGBE
:
case
FL_SIGBE
|
FL_V4
:
case
FL_SIGBE
|
FL_OS2
:
yywarning
(
"Bitmap v%c signature big-endian, but size little-endian"
,
type
&
FL_V4
?
'4'
:
'3'
);
break
;
case
-
1
:
yyerror
(
"Invalid bitmap format"
);
break
;
}
switch
(
byteorder
)
...
...
@@ -307,6 +340,10 @@ static int convert_bitmap(char *data, int size)
{
if
(
type
&
FL_V4
)
convert_bitmap_swap_v4
(
b4h
);
else
if
(
type
&
FL_OS2
)
{
convert_bitmap_swap_os2
(
boh
);
}
else
convert_bitmap_swap_v3
(
bih
);
}
...
...
@@ -319,6 +356,10 @@ static int convert_bitmap(char *data, int size)
{
if
(
type
&
FL_V4
)
convert_bitmap_swap_v4
(
b4h
);
else
if
(
type
&
FL_OS2
)
{
convert_bitmap_swap_os2
(
boh
);
}
else
convert_bitmap_swap_v3
(
bih
);
}
...
...
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