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
58b2f0a0
Commit
58b2f0a0
authored
Jan 23, 1999
by
Juergen Schmied
Committed by
Alexandre Julliard
Jan 23, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented CreateHalftonePalette.
Fixed 3 crashes (1 real, 2 potential).
parent
628e3e0f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
6 deletions
+49
-6
palette.c
objects/palette.c
+49
-6
No files found.
objects/palette.c
View file @
58b2f0a0
...
...
@@ -56,12 +56,15 @@ HPALETTE16 PALETTE_Init(void)
hpalette
=
CreatePalette16
(
palPtr
);
palObj
=
(
PALETTEOBJ
*
)
GDI_GetObjPtr
(
hpalette
,
PALETTE_MAGIC
);
if
(
palObj
)
{
palObj
->
mapping
=
xmalloc
(
sizeof
(
int
)
*
20
);
GDI_HEAP_UNLOCK
(
hpalette
);
HeapFree
(
GetProcessHeap
(),
0
,
palPtr
);
}
return
hpalette
;
}
...
...
@@ -125,12 +128,49 @@ HPALETTE32 WINAPI CreatePalette32(
* RETURNS
* Success: Handle to logical halftone palette
* Failure: 0
*
* FIXME: not truly tested
*/
HPALETTE32
WINAPI
CreateHalftonePalette
(
HDC32
hdc
)
/* [in] Handle to device context */
{
FIXME
(
palette
,
"(0x%x): stub
\n
"
,
hdc
);
return
(
HPALETTE32
)
NULL
;
HPALETTE32
WINAPI
CreateHalftonePalette
(
HDC32
hdc
)
/* [in] Handle to device context */
{
int
r
,
g
,
b
,
i
;
HPALETTE32
hPalette
=
0
;
int
palNumEntries
=
216
+
NB_RESERVED_COLORS
;
const
PALETTEENTRY
*
__sysPalTemplate
=
COLOR_GetSystemPaletteTemplate
();
LOGPALETTE
*
pLogPal
=
(
LOGPALETTE
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
LOGPALETTE
)
+
(
palNumEntries
-
1
)
*
sizeof
(
PALETTEENTRY
));
TRACE
(
palette
,
"(0x%x)
\n
"
,
hdc
);
pLogPal
->
palVersion
=
0x300
;
pLogPal
->
palNumEntries
=
palNumEntries
;
for
(
i
=
0
;
i
<
NB_RESERVED_COLORS
;
i
++
)
{
pLogPal
->
palPalEntry
[
i
].
peRed
=
__sysPalTemplate
[
i
].
peRed
;
pLogPal
->
palPalEntry
[
i
].
peGreen
=
__sysPalTemplate
[
i
].
peGreen
;
pLogPal
->
palPalEntry
[
i
].
peBlue
=
__sysPalTemplate
[
i
].
peBlue
;
pLogPal
->
palPalEntry
[
i
].
peFlags
=
0
;
}
for
(
r
=
0
;
r
<
6
;
r
++
)
{
for
(
g
=
0
;
g
<
6
;
g
++
)
{
for
(
b
=
0
;
b
<
6
;
b
++
)
{
pLogPal
->
palPalEntry
[
NB_RESERVED_COLORS
+
r
*
36
+
g
*
6
+
b
].
peRed
=
r
*
51
;
pLogPal
->
palPalEntry
[
NB_RESERVED_COLORS
+
r
*
36
+
g
*
6
+
b
].
peGreen
=
g
*
51
;
pLogPal
->
palPalEntry
[
NB_RESERVED_COLORS
+
r
*
36
+
g
*
6
+
b
].
peBlue
=
b
*
51
;
pLogPal
->
palPalEntry
[
NB_RESERVED_COLORS
+
r
*
36
+
g
*
6
+
b
].
peFlags
=
0
;
}
}
}
hPalette
=
CreatePalette32
(
pLogPal
);
if
(
hPalette
)
{
SelectPalette32
(
hdc
,
hPalette
,
FALSE
);
}
HeapFree
(
GetProcessHeap
(),
0
,
pLogPal
);
return
hPalette
;
}
...
...
@@ -325,6 +365,7 @@ BOOL32 WINAPI AnimatePalette32(
if
(
hPal
!=
STOCK_DEFAULT_PALETTE
)
{
PALETTEOBJ
*
palPtr
=
(
PALETTEOBJ
*
)
GDI_GetObjPtr
(
hPal
,
PALETTE_MAGIC
);
if
(
!
palPtr
)
return
FALSE
;
if
(
(
StartIndex
+
NumEntries
)
<=
palPtr
->
logpalette
.
palNumEntries
)
{
...
...
@@ -508,6 +549,7 @@ COLORREF WINAPI GetNearestColor32(
palObj
=
(
PALETTEOBJ
*
)
GDI_GetObjPtr
(
(
dc
->
w
.
hPalette
)
?
dc
->
w
.
hPalette
:
STOCK_DEFAULT_PALETTE
,
PALETTE_MAGIC
);
if
(
!
palObj
)
return
nearest
;
nearest
=
COLOR_LookupNearestColor
(
palObj
->
logpalette
.
palPalEntry
,
palObj
->
logpalette
.
palNumEntries
,
color
);
...
...
@@ -652,6 +694,7 @@ UINT16 WINAPI RealizeDefaultPalette( HDC16 hdc )
hLastRealizedPalette
=
STOCK_DEFAULT_PALETTE
;
palPtr
=
(
PALETTEOBJ
*
)
GDI_GetObjPtr
(
STOCK_DEFAULT_PALETTE
,
PALETTE_MAGIC
);
if
(
!
palPtr
)
return
0
;
/* lookup is needed to account for SetSystemPaletteUse() stuff */
...
...
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