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
c4576b4a
Commit
c4576b4a
authored
May 27, 2011
by
Huw Davies
Committed by
Alexandre Julliard
May 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add support for 8 bpp brushes.
parent
64a34a33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
139 additions
and
0 deletions
+139
-0
primitives.c
dlls/gdi32/dibdrv/primitives.c
+139
-0
No files found.
dlls/gdi32/dibdrv/primitives.c
View file @
c4576b4a
...
...
@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include "gdi_private.h"
#include "dibdrv.h"
...
...
@@ -402,6 +404,27 @@ static BOOL convert_to_8888(dib_info *dst, const dib_info *src, const RECT *src_
break
;
}
case
8
:
{
BYTE
*
src_start
=
get_pixel_ptr_8
(
src
,
src_rect
->
left
,
src_rect
->
top
),
*
src_pixel
;
for
(
y
=
src_rect
->
top
;
y
<
src_rect
->
bottom
;
y
++
)
{
dst_pixel
=
dst_start
;
src_pixel
=
src_start
;
for
(
x
=
src_rect
->
left
;
x
<
src_rect
->
right
;
x
++
)
{
RGBQUAD
rgb
;
src_val
=
*
src_pixel
++
;
if
(
src_val
>=
src
->
color_table_size
)
src_val
=
src
->
color_table_size
-
1
;
rgb
=
src
->
color_table
[
src_val
];
*
dst_pixel
++
=
rgb
.
rgbRed
<<
16
|
rgb
.
rgbGreen
<<
8
|
rgb
.
rgbBlue
;
}
dst_start
+=
dst
->
stride
/
4
;
src_start
+=
src
->
stride
;
}
break
;
}
default:
FIXME
(
"Unsupported conversion: %d -> 8888
\n
"
,
src
->
bit_count
);
return
FALSE
;
...
...
@@ -474,6 +497,29 @@ static BOOL convert_to_32(dib_info *dst, const dib_info *src, const RECT *src_re
break
;
}
case
8
:
{
BYTE
*
src_start
=
get_pixel_ptr_8
(
src
,
src_rect
->
left
,
src_rect
->
top
),
*
src_pixel
;
for
(
y
=
src_rect
->
top
;
y
<
src_rect
->
bottom
;
y
++
)
{
dst_pixel
=
dst_start
;
src_pixel
=
src_start
;
for
(
x
=
src_rect
->
left
;
x
<
src_rect
->
right
;
x
++
)
{
RGBQUAD
rgb
;
src_val
=
*
src_pixel
++
;
if
(
src_val
>=
src
->
color_table_size
)
src_val
=
src
->
color_table_size
-
1
;
rgb
=
src
->
color_table
[
src_val
];
*
dst_pixel
++
=
put_field
(
rgb
.
rgbRed
,
dst
->
red_shift
,
dst
->
red_len
)
|
put_field
(
rgb
.
rgbGreen
,
dst
->
green_shift
,
dst
->
green_len
)
|
put_field
(
rgb
.
rgbBlue
,
dst
->
blue_shift
,
dst
->
blue_len
);
}
dst_start
+=
dst
->
stride
/
4
;
src_start
+=
src
->
stride
;
}
break
;
}
default:
FIXME
(
"Unsupported conversion: %d -> 32
\n
"
,
src
->
bit_count
);
return
FALSE
;
...
...
@@ -544,6 +590,29 @@ static BOOL convert_to_555(dib_info *dst, const dib_info *src, const RECT *src_r
break
;
}
case
8
:
{
BYTE
*
src_start
=
get_pixel_ptr_8
(
src
,
src_rect
->
left
,
src_rect
->
top
),
*
src_pixel
;
for
(
y
=
src_rect
->
top
;
y
<
src_rect
->
bottom
;
y
++
)
{
dst_pixel
=
dst_start
;
src_pixel
=
src_start
;
for
(
x
=
src_rect
->
left
;
x
<
src_rect
->
right
;
x
++
)
{
RGBQUAD
rgb
;
src_val
=
*
src_pixel
++
;
if
(
src_val
>=
src
->
color_table_size
)
src_val
=
src
->
color_table_size
-
1
;
rgb
=
src
->
color_table
[
src_val
];
*
dst_pixel
++
=
((
rgb
.
rgbRed
<<
7
)
&
0x7c00
)
|
((
rgb
.
rgbGreen
<<
2
)
&
0x03e0
)
|
((
rgb
.
rgbBlue
>>
3
)
&
0x001f
);
}
dst_start
+=
dst
->
stride
/
2
;
src_start
+=
src
->
stride
;
}
break
;
}
default:
FIXME
(
"Unsupported conversion: %d -> 555
\n
"
,
src
->
bit_count
);
return
FALSE
;
...
...
@@ -617,6 +686,29 @@ static BOOL convert_to_16(dib_info *dst, const dib_info *src, const RECT *src_re
break
;
}
case
8
:
{
BYTE
*
src_start
=
get_pixel_ptr_8
(
src
,
src_rect
->
left
,
src_rect
->
top
),
*
src_pixel
;
for
(
y
=
src_rect
->
top
;
y
<
src_rect
->
bottom
;
y
++
)
{
dst_pixel
=
dst_start
;
src_pixel
=
src_start
;
for
(
x
=
src_rect
->
left
;
x
<
src_rect
->
right
;
x
++
)
{
RGBQUAD
rgb
;
src_val
=
*
src_pixel
++
;
if
(
src_val
>=
src
->
color_table_size
)
src_val
=
src
->
color_table_size
-
1
;
rgb
=
src
->
color_table
[
src_val
];
*
dst_pixel
++
=
put_field
(
rgb
.
rgbRed
,
dst
->
red_shift
,
dst
->
red_len
)
|
put_field
(
rgb
.
rgbGreen
,
dst
->
green_shift
,
dst
->
green_len
)
|
put_field
(
rgb
.
rgbBlue
,
dst
->
blue_shift
,
dst
->
blue_len
);
}
dst_start
+=
dst
->
stride
/
2
;
src_start
+=
src
->
stride
;
}
break
;
}
default:
FIXME
(
"Unsupported conversion: %d -> 16
\n
"
,
src
->
bit_count
);
return
FALSE
;
...
...
@@ -625,6 +717,14 @@ static BOOL convert_to_16(dib_info *dst, const dib_info *src, const RECT *src_re
return
TRUE
;
}
static
inline
BOOL
color_tables_match
(
const
dib_info
*
d1
,
const
dib_info
*
d2
)
{
assert
(
d1
->
color_table_size
&&
d2
->
color_table_size
);
if
(
d1
->
color_table_size
!=
d2
->
color_table_size
)
return
FALSE
;
return
!
memcmp
(
d1
->
color_table
,
d2
->
color_table
,
d1
->
color_table_size
*
sizeof
(
d1
->
color_table
[
0
]));
}
static
BOOL
convert_to_8
(
dib_info
*
dst
,
const
dib_info
*
src
,
const
RECT
*
src_rect
)
{
BYTE
*
dst_start
=
dst
->
bits
,
*
dst_pixel
;
...
...
@@ -690,6 +790,45 @@ static BOOL convert_to_8(dib_info *dst, const dib_info *src, const RECT *src_rec
break
;
}
case
8
:
{
BYTE
*
src_start
=
get_pixel_ptr_8
(
src
,
src_rect
->
left
,
src_rect
->
top
),
*
src_pixel
;
if
(
color_tables_match
(
dst
,
src
))
{
if
(
src
->
stride
>
0
&&
dst
->
stride
>
0
&&
src_rect
->
left
==
0
&&
src_rect
->
right
==
src
->
width
)
memcpy
(
dst
->
bits
,
src_start
,
(
src_rect
->
bottom
-
src_rect
->
top
)
*
src
->
stride
);
else
{
for
(
y
=
src_rect
->
top
;
y
<
src_rect
->
bottom
;
y
++
)
{
memcpy
(
dst_start
,
src_start
,
src_rect
->
right
-
src_rect
->
left
);
dst_start
+=
dst
->
stride
;
src_start
+=
src
->
stride
;
}
}
}
else
{
for
(
y
=
src_rect
->
top
;
y
<
src_rect
->
bottom
;
y
++
)
{
dst_pixel
=
dst_start
;
src_pixel
=
src_start
;
for
(
x
=
src_rect
->
left
;
x
<
src_rect
->
right
;
x
++
)
{
RGBQUAD
rgb
;
src_val
=
*
src_pixel
++
;
if
(
src_val
>=
src
->
color_table_size
)
src_val
=
src
->
color_table_size
-
1
;
rgb
=
src
->
color_table
[
src_val
];
*
dst_pixel
++
=
colorref_to_pixel_colortable
(
dst
,
RGB
(
rgb
.
rgbRed
,
rgb
.
rgbGreen
,
rgb
.
rgbBlue
));
}
dst_start
+=
dst
->
stride
;
src_start
+=
src
->
stride
;
}
}
break
;
}
default:
FIXME
(
"Unsupported conversion: %d -> 8
\n
"
,
src
->
bit_count
);
return
FALSE
;
...
...
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