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
549e2478
Commit
549e2478
authored
Aug 30, 2003
by
Dave Belanger
Committed by
Alexandre Julliard
Aug 30, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementation of SelectPalette and RealizePalette in the metafile
driver.
parent
2c754a6e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
7 deletions
+105
-7
init.c
dlls/gdi/mfdrv/init.c
+2
-2
metafiledrv.h
dlls/gdi/mfdrv/metafiledrv.h
+2
-0
objects.c
dlls/gdi/mfdrv/objects.c
+91
-0
palette.c
objects/palette.c
+10
-5
No files found.
dlls/gdi/mfdrv/init.c
View file @
549e2478
...
...
@@ -97,7 +97,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_Polyline
,
/* pPolyline */
NULL
,
/* pPolylineTo */
NULL
,
/* pRealizeDefaultPalette */
NULL
,
/* pRealizePalette */
MFDRV_RealizePalette
,
/* pRealizePalette */
MFDRV_Rectangle
,
/* pRectangle */
NULL
,
/* pResetDC */
MFDRV_RestoreDC
,
/* pRestoreDC */
...
...
@@ -109,7 +109,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_SelectBrush
,
/* pSelectBrush */
MFDRV_SelectClipPath
,
/* pSelectClipPath */
MFDRV_SelectFont
,
/* pSelectFont */
NULL
,
/* pSelectPalette */
MFDRV_SelectPalette
,
/* pSelectPalette */
MFDRV_SelectPen
,
/* pSelectPen */
NULL
,
/* pSetBitmapBits */
MFDRV_SetBkColor
,
/* pSetBkColor */
...
...
dlls/gdi/mfdrv/metafiledrv.h
View file @
549e2478
...
...
@@ -118,6 +118,8 @@ extern HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH handle );
extern
BOOL
MFDRV_SelectClipPath
(
PHYSDEV
dev
,
INT
iMode
);
extern
HFONT
MFDRV_SelectFont
(
PHYSDEV
dev
,
HFONT
handle
);
extern
HPEN
MFDRV_SelectPen
(
PHYSDEV
dev
,
HPEN
handle
);
extern
HPALETTE
MFDRV_SelectPalette
(
PHYSDEV
dev
,
HPALETTE
hPalette
,
BOOL
bForceBackground
);
extern
UINT
MFDRV_RealizePalette
(
PHYSDEV
dev
,
HPALETTE
hPalette
,
BOOL
primary
);
extern
COLORREF
MFDRV_SetBkColor
(
PHYSDEV
dev
,
COLORREF
color
);
extern
INT
MFDRV_SetBkMode
(
PHYSDEV
dev
,
INT
mode
);
extern
INT
MFDRV_SetMapMode
(
PHYSDEV
dev
,
INT
mode
);
...
...
dlls/gdi/mfdrv/objects.c
View file @
549e2478
...
...
@@ -234,3 +234,94 @@ HPEN MFDRV_SelectPen( PHYSDEV dev, HPEN hpen )
if
(
MFDRV_CreatePenIndirect
(
dev
,
hpen
,
&
logpen
))
return
hpen
;
return
0
;
}
/******************************************************************
* MFDRV_CreatePalette
*/
static
BOOL
MFDRV_CreatePalette
(
PHYSDEV
dev
,
HPALETTE
hPalette
,
LOGPALETTE
*
logPalette
,
int
sizeofPalette
)
{
int
index
;
BOOL
ret
;
METARECORD
*
mr
;
mr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
METARECORD
)
+
sizeofPalette
-
sizeof
(
WORD
)
);
mr
->
rdSize
=
(
sizeof
(
METARECORD
)
+
sizeofPalette
-
sizeof
(
WORD
))
/
sizeof
(
WORD
);
mr
->
rdFunction
=
META_CREATEPALETTE
;
memcpy
(
&
(
mr
->
rdParm
),
logPalette
,
sizeofPalette
);
if
(
!
(
MFDRV_WriteRecord
(
dev
,
mr
,
mr
->
rdSize
*
sizeof
(
WORD
))))
{
HeapFree
(
GetProcessHeap
(),
0
,
mr
);
return
FALSE
;
}
mr
->
rdSize
=
sizeof
(
METARECORD
)
/
sizeof
(
WORD
);
mr
->
rdFunction
=
META_SELECTPALETTE
;
if
((
index
=
MFDRV_AddHandleDC
(
dev
))
==
-
1
)
ret
=
FALSE
;
else
{
*
(
mr
->
rdParm
)
=
index
;
ret
=
MFDRV_WriteRecord
(
dev
,
mr
,
mr
->
rdSize
*
sizeof
(
WORD
));
}
HeapFree
(
GetProcessHeap
(),
0
,
mr
);
return
ret
;
}
/***********************************************************************
* MFDRV_SelectPalette
*/
HPALETTE
MFDRV_SelectPalette
(
PHYSDEV
dev
,
HPALETTE
hPalette
,
BOOL
bForceBackground
)
{
#define PALVERSION 0x0300
PLOGPALETTE
logPalette
;
WORD
wNumEntries
=
0
;
BOOL
creationSucceed
;
int
sizeofPalette
;
GetObjectA
(
hPalette
,
sizeof
(
WORD
),
(
LPSTR
)
&
wNumEntries
);
if
(
wNumEntries
==
0
)
return
0
;
sizeofPalette
=
sizeof
(
LOGPALETTE
)
+
((
wNumEntries
-
1
)
*
sizeof
(
PALETTEENTRY
));
logPalette
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeofPalette
);
if
(
logPalette
==
NULL
)
return
0
;
logPalette
->
palVersion
=
PALVERSION
;
logPalette
->
palNumEntries
=
wNumEntries
;
GetPaletteEntries
(
hPalette
,
0
,
wNumEntries
,
logPalette
->
palPalEntry
);
creationSucceed
=
MFDRV_CreatePalette
(
dev
,
hPalette
,
logPalette
,
sizeofPalette
);
HeapFree
(
GetProcessHeap
(),
0
,
logPalette
);
if
(
creationSucceed
)
return
hPalette
;
return
0
;
}
/***********************************************************************
* MFDRV_RealizePalette
*/
UINT
MFDRV_RealizePalette
(
PHYSDEV
dev
,
HPALETTE
hPalette
,
BOOL
dummy
)
{
char
buffer
[
sizeof
(
METARECORD
)
-
sizeof
(
WORD
)];
METARECORD
*
mr
=
(
METARECORD
*
)
&
buffer
;
mr
->
rdSize
=
(
sizeof
(
METARECORD
)
-
sizeof
(
WORD
))
/
sizeof
(
WORD
);
mr
->
rdFunction
=
META_REALIZEPALETTE
;
if
(
!
(
MFDRV_WriteRecord
(
dev
,
mr
,
mr
->
rdSize
*
sizeof
(
WORD
))))
return
0
;
/* The return value is suppose to be the number of entries
in the logical palette mapped to the system palette or 0
if the function failed. Since it's not trivial here to
get that kind of information and since it's of little
use in the case of metafiles, we'll always return 1. */
return
1
;
}
objects/palette.c
View file @
549e2478
...
...
@@ -677,7 +677,7 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle, void *obj )
*/
HPALETTE
WINAPI
GDISelectPalette
(
HDC
hdc
,
HPALETTE
hpal
,
WORD
wBkg
)
{
HPALETTE
prev
;
HPALETTE
ret
;
DC
*
dc
;
TRACE
(
"%p %p
\n
"
,
hdc
,
hpal
);
...
...
@@ -688,11 +688,16 @@ HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg)
return
0
;
}
if
(
!
(
dc
=
DC_GetDCPtr
(
hdc
)))
return
0
;
prev
=
dc
->
hPalette
;
dc
->
hPalette
=
hpal
;
ret
=
dc
->
hPalette
;
if
(
dc
->
funcs
->
pSelectPalette
)
hpal
=
dc
->
funcs
->
pSelectPalette
(
dc
->
physDev
,
hpal
,
FALSE
);
if
(
hpal
)
{
dc
->
hPalette
=
hpal
;
if
(
!
wBkg
)
hPrimaryPalette
=
hpal
;
}
else
ret
=
0
;
GDI_ReleaseObj
(
hdc
);
if
(
!
wBkg
)
hPrimaryPalette
=
hpal
;
return
prev
;
return
ret
;
}
...
...
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