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
2ed1aaa9
Commit
2ed1aaa9
authored
Jul 17, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Add support for converting RGB formats to 8bpp indexed.
parent
d9f4df06
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
image.c
dlls/gdiplus/image.c
+32
-0
image.c
dlls/gdiplus/tests/image.c
+2
-2
No files found.
dlls/gdiplus/image.c
View file @
2ed1aaa9
...
...
@@ -541,6 +541,16 @@ GpStatus convert_pixels(INT width, INT height,
return Ok; \
} while (0);
#define convert_rgb_to_indexed(getpixel_function, setpixel_function) do { \
for (x=0; x<width; x++) \
for (y=0; y<height; y++) { \
BYTE r, g, b, a; \
getpixel_function(&r, &g, &b, &a, src_bits+src_stride*y, x); \
setpixel_function(r, g, b, a, dst_bits+dst_stride*y, x, palette); \
} \
return Ok; \
} while (0);
switch
(
src_format
)
{
case
PixelFormat1bppIndexed
:
...
...
@@ -627,6 +637,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat16bppGrayScale
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_16bppGrayScale
,
setpixel_8bppIndexed
);
case
PixelFormat16bppRGB555
:
convert_rgb_to_rgb
(
getpixel_16bppGrayScale
,
setpixel_16bppRGB555
);
case
PixelFormat16bppRGB565
:
...
...
@@ -652,6 +664,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat16bppRGB555
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_16bppRGB555
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_16bppRGB555
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB565
:
...
...
@@ -677,6 +691,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat16bppRGB565
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_16bppRGB565
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_16bppRGB565
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
@@ -702,6 +718,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat16bppARGB1555
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_16bppARGB1555
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_16bppARGB1555
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
@@ -727,6 +745,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat24bppRGB
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_24bppRGB
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_24bppRGB
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
@@ -752,6 +772,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat32bppRGB
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_32bppRGB
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_32bppRGB
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
@@ -777,6 +799,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat32bppARGB
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_32bppARGB
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_32bppARGB
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
@@ -801,6 +825,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat32bppPARGB
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_32bppPARGB
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_32bppPARGB
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
@@ -826,6 +852,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat48bppRGB
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_48bppRGB
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_48bppRGB
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
@@ -851,6 +879,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat64bppARGB
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_64bppARGB
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_64bppARGB
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
@@ -876,6 +906,8 @@ GpStatus convert_pixels(INT width, INT height,
case
PixelFormat64bppPARGB
:
switch
(
dst_format
)
{
case
PixelFormat8bppIndexed
:
convert_rgb_to_indexed
(
getpixel_64bppPARGB
,
setpixel_8bppIndexed
);
case
PixelFormat16bppGrayScale
:
convert_rgb_to_rgb
(
getpixel_64bppPARGB
,
setpixel_16bppGrayScale
);
case
PixelFormat16bppRGB555
:
...
...
dlls/gdiplus/tests/image.c
View file @
2ed1aaa9
...
...
@@ -3388,7 +3388,6 @@ static void test_bitmapbits(void)
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
};
#if 0 /* FIXME: these tests crash gdiplus in Wine */
static
const
BYTE
pixels_8
[
16
]
=
{
0x01
,
0
,
0x01
,
0
,
0x01
,
0
,
0x01
,
0
,
...
...
@@ -3405,6 +3404,7 @@ static void test_bitmapbits(void)
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
,
0x77
};
#if 0 /* FIXME: these tests crash gdiplus in Wine */
static const BYTE pixels_1_77[64] =
{
0xaa,0x77,0x77,0x77,0x77,0x77,0x77,0x77,
...
...
@@ -3438,7 +3438,6 @@ static void test_bitmapbits(void)
{
PixelFormat24bppRGB
,
24
,
ImageLockModeRead
|
ImageLockModeUserInputBuf
,
32
,
64
,
pixels_24_77
,
pixels_24
},
{
PixelFormat24bppRGB
,
24
,
ImageLockModeWrite
|
ImageLockModeUserInputBuf
,
32
,
64
,
pixels_77
,
pixels_00
},
{
PixelFormat24bppRGB
,
24
,
ImageLockModeUserInputBuf
,
32
,
64
,
pixels_77
,
pixels_24
},
#if 0 /* FIXME: these tests crash gdiplus in Wine */
/* 8 */
{
PixelFormat8bppIndexed
,
8
,
0
,
8
,
16
,
pixels_8
,
pixels_24
},
{
PixelFormat8bppIndexed
,
8
,
ImageLockModeRead
,
8
,
16
,
pixels_8
,
pixels_24
},
...
...
@@ -3447,6 +3446,7 @@ static void test_bitmapbits(void)
{
PixelFormat8bppIndexed
,
8
,
ImageLockModeRead
|
ImageLockModeUserInputBuf
,
32
,
64
,
pixels_8_77
,
pixels_24
},
{
PixelFormat8bppIndexed
,
8
,
ImageLockModeWrite
|
ImageLockModeUserInputBuf
,
32
,
64
,
pixels_77
,
pixels_00
},
{
PixelFormat8bppIndexed
,
8
,
ImageLockModeUserInputBuf
,
32
,
64
,
pixels_77
,
pixels_24
},
#if 0 /* FIXME: these tests crash gdiplus in Wine */
/* 15 */
{ PixelFormat1bppIndexed, 1, 0, 4, 8, pixels_1, pixels_24 },
{ PixelFormat1bppIndexed, 1, ImageLockModeRead, 4, 8, pixels_1, pixels_24 },
...
...
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