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
d9f4df06
Commit
d9f4df06
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: Pass palette instead of bitmap to setpixel helpers.
parent
87f8e560
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
image.c
dlls/gdiplus/image.c
+16
-13
No files found.
dlls/gdiplus/image.c
View file @
d9f4df06
...
@@ -297,11 +297,14 @@ GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap* bitmap, INT x, INT y,
...
@@ -297,11 +297,14 @@ GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap* bitmap, INT x, INT y,
return
Ok
;
return
Ok
;
}
}
static
inline
UINT
get_palette_index
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
GpBitmap
*
bitmap
)
{
static
inline
UINT
get_palette_index
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
ColorPalette
*
palette
)
{
BYTE
index
=
0
;
BYTE
index
=
0
;
int
best_distance
=
0x7fff
;
int
best_distance
=
0x7fff
;
int
distance
;
int
distance
;
int
i
;
int
i
;
if
(
!
palette
)
return
0
;
/* This algorithm scans entire palette,
/* This algorithm scans entire palette,
computes difference from desired color (all color components have equal weight)
computes difference from desired color (all color components have equal weight)
and returns the index of color with least difference.
and returns the index of color with least difference.
...
@@ -311,8 +314,8 @@ static inline UINT get_palette_index(BYTE r, BYTE g, BYTE b, BYTE a, GpBitmap* b
...
@@ -311,8 +314,8 @@ static inline UINT get_palette_index(BYTE r, BYTE g, BYTE b, BYTE a, GpBitmap* b
tables and thus may actually be slower if this method is called only few times per
tables and thus may actually be slower if this method is called only few times per
every image.
every image.
*/
*/
for
(
i
=
0
;
i
<
bitmap
->
image
.
palette
->
Count
;
i
++
)
{
for
(
i
=
0
;
i
<
palette
->
Count
;
i
++
)
{
ARGB
color
=
bitmap
->
image
.
palette
->
Entries
[
i
];
ARGB
color
=
palette
->
Entries
[
i
];
distance
=
abs
(
b
-
(
color
&
0xff
))
+
abs
(
g
-
(
color
>>
8
&
0xff
))
+
abs
(
r
-
(
color
>>
16
&
0xff
))
+
abs
(
a
-
(
color
>>
24
&
0xff
));
distance
=
abs
(
b
-
(
color
&
0xff
))
+
abs
(
g
-
(
color
>>
8
&
0xff
))
+
abs
(
r
-
(
color
>>
16
&
0xff
))
+
abs
(
a
-
(
color
>>
24
&
0xff
));
if
(
distance
<
best_distance
)
{
if
(
distance
<
best_distance
)
{
best_distance
=
distance
;
best_distance
=
distance
;
...
@@ -323,25 +326,25 @@ static inline UINT get_palette_index(BYTE r, BYTE g, BYTE b, BYTE a, GpBitmap* b
...
@@ -323,25 +326,25 @@ static inline UINT get_palette_index(BYTE r, BYTE g, BYTE b, BYTE a, GpBitmap* b
}
}
static
inline
void
setpixel_8bppIndexed
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
static
inline
void
setpixel_8bppIndexed
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
BYTE
*
row
,
UINT
x
,
GpBitmap
*
bitmap
)
BYTE
*
row
,
UINT
x
,
ColorPalette
*
palette
)
{
{
BYTE
index
=
get_palette_index
(
r
,
g
,
b
,
a
,
bitmap
);
BYTE
index
=
get_palette_index
(
r
,
g
,
b
,
a
,
palette
);
row
[
x
]
=
index
;
row
[
x
]
=
index
;
}
}
static
inline
void
setpixel_1bppIndexed
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
static
inline
void
setpixel_1bppIndexed
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
BYTE
*
row
,
UINT
x
,
GpBitmap
*
bitmap
)
BYTE
*
row
,
UINT
x
,
ColorPalette
*
palette
)
{
{
row
[
x
/
8
]
=
(
row
[
x
/
8
]
&
~
(
1
<<
(
7
-
x
%
8
)))
|
(
get_palette_index
(
r
,
g
,
b
,
a
,
bitmap
)
<<
(
7
-
x
%
8
));
row
[
x
/
8
]
=
(
row
[
x
/
8
]
&
~
(
1
<<
(
7
-
x
%
8
)))
|
(
get_palette_index
(
r
,
g
,
b
,
a
,
palette
)
<<
(
7
-
x
%
8
));
}
}
static
inline
void
setpixel_4bppIndexed
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
static
inline
void
setpixel_4bppIndexed
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
BYTE
*
row
,
UINT
x
,
GpBitmap
*
bitmap
)
BYTE
*
row
,
UINT
x
,
ColorPalette
*
palette
)
{
{
if
(
x
&
1
)
if
(
x
&
1
)
row
[
x
/
2
]
=
(
row
[
x
/
2
]
&
0xf0
)
|
get_palette_index
(
r
,
g
,
b
,
a
,
bitmap
);
row
[
x
/
2
]
=
(
row
[
x
/
2
]
&
0xf0
)
|
get_palette_index
(
r
,
g
,
b
,
a
,
palette
);
else
else
row
[
x
/
2
]
=
(
row
[
x
/
2
]
&
0x0f
)
|
get_palette_index
(
r
,
g
,
b
,
a
,
bitmap
)
<<
4
;
row
[
x
/
2
]
=
(
row
[
x
/
2
]
&
0x0f
)
|
get_palette_index
(
r
,
g
,
b
,
a
,
palette
)
<<
4
;
}
}
static
inline
void
setpixel_16bppGrayScale
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
static
inline
void
setpixel_16bppGrayScale
(
BYTE
r
,
BYTE
g
,
BYTE
b
,
BYTE
a
,
...
@@ -483,13 +486,13 @@ GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap* bitmap, INT x, INT y,
...
@@ -483,13 +486,13 @@ GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap* bitmap, INT x, INT y,
setpixel_64bppPARGB
(
r
,
g
,
b
,
a
,
row
,
x
);
setpixel_64bppPARGB
(
r
,
g
,
b
,
a
,
row
,
x
);
break
;
break
;
case
PixelFormat8bppIndexed
:
case
PixelFormat8bppIndexed
:
setpixel_8bppIndexed
(
r
,
g
,
b
,
a
,
row
,
x
,
bitmap
);
setpixel_8bppIndexed
(
r
,
g
,
b
,
a
,
row
,
x
,
bitmap
->
image
.
palette
);
break
;
break
;
case
PixelFormat4bppIndexed
:
case
PixelFormat4bppIndexed
:
setpixel_4bppIndexed
(
r
,
g
,
b
,
a
,
row
,
x
,
bitmap
);
setpixel_4bppIndexed
(
r
,
g
,
b
,
a
,
row
,
x
,
bitmap
->
image
.
palette
);
break
;
break
;
case
PixelFormat1bppIndexed
:
case
PixelFormat1bppIndexed
:
setpixel_1bppIndexed
(
r
,
g
,
b
,
a
,
row
,
x
,
bitmap
);
setpixel_1bppIndexed
(
r
,
g
,
b
,
a
,
row
,
x
,
bitmap
->
image
.
palette
);
break
;
break
;
default:
default:
FIXME
(
"not implemented for format 0x%x
\n
"
,
bitmap
->
format
);
FIXME
(
"not implemented for format 0x%x
\n
"
,
bitmap
->
format
);
...
...
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