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
a32ddc0f
Commit
a32ddc0f
authored
Nov 25, 2000
by
Ove Kaaven
Committed by
Alexandre Julliard
Nov 25, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Get/SetDIBColorTable.
parent
235f1295
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
135 additions
and
87 deletions
+135
-87
bitmap.c
dlls/ttydrv/bitmap.c
+18
-0
dc.c
dlls/ttydrv/dc.c
+3
-1
ttydrv.h
dlls/ttydrv/ttydrv.h
+2
-0
dib.c
graphics/x11drv/dib.c
+92
-38
init.c
graphics/x11drv/init.c
+3
-1
bitmap.h
include/bitmap.h
+2
-0
x11drv.h
include/x11drv.h
+2
-0
dib.c
objects/dib.c
+13
-47
No files found.
dlls/ttydrv/bitmap.c
View file @
a32ddc0f
...
...
@@ -205,6 +205,24 @@ void TTYDRV_BITMAP_DeleteDIBSection(BITMAPOBJ *bmp)
}
/***********************************************************************
* TTYDRV_BITMAP_SetDIBColorTable
*/
UINT
TTYDRV_BITMAP_SetDIBColorTable
(
BITMAPOBJ
*
bmp
,
DC
*
dc
,
UINT
start
,
UINT
count
,
const
RGBQUAD
*
colors
)
{
FIXME
(
"(%p): stub
\n
"
,
bmp
);
return
0
;
}
/***********************************************************************
* TTYDRV_BITMAP_GetDIBColorTable
*/
UINT
TTYDRV_BITMAP_GetDIBColorTable
(
BITMAPOBJ
*
bmp
,
DC
*
dc
,
UINT
start
,
UINT
count
,
RGBQUAD
*
colors
)
{
FIXME
(
"(%p): stub
\n
"
,
bmp
);
return
0
;
}
/***********************************************************************
* TTYDRV_BITMAP_GetDIBits
*/
INT
TTYDRV_BITMAP_GetDIBits
(
...
...
dlls/ttydrv/dc.c
View file @
a32ddc0f
...
...
@@ -122,7 +122,9 @@ BITMAP_DRIVER TTYDRV_BITMAP_Driver =
{
TTYDRV_BITMAP_SetDIBits
,
TTYDRV_BITMAP_GetDIBits
,
TTYDRV_BITMAP_DeleteDIBSection
TTYDRV_BITMAP_DeleteDIBSection
,
TTYDRV_BITMAP_SetDIBColorTable
,
TTYDRV_BITMAP_GetDIBColorTable
};
PALETTE_DRIVER
TTYDRV_PALETTE_Driver
=
...
...
dlls/ttydrv/ttydrv.h
View file @
a32ddc0f
...
...
@@ -51,6 +51,8 @@ extern HBITMAP16 TTYDRV_BITMAP_CreateDIBSection16(struct tagDC *dc, BITMAPINFO *
extern
INT
TTYDRV_BITMAP_SetDIBits
(
struct
tagBITMAPOBJ
*
bmp
,
struct
tagDC
*
dc
,
UINT
startscan
,
UINT
lines
,
LPCVOID
bits
,
const
BITMAPINFO
*
info
,
UINT
coloruse
,
HBITMAP
hbitmap
);
extern
INT
TTYDRV_BITMAP_GetDIBits
(
struct
tagBITMAPOBJ
*
bmp
,
struct
tagDC
*
dc
,
UINT
startscan
,
UINT
lines
,
LPVOID
bits
,
BITMAPINFO
*
info
,
UINT
coloruse
,
HBITMAP
hbitmap
);
extern
void
TTYDRV_BITMAP_DeleteDIBSection
(
struct
tagBITMAPOBJ
*
bmp
);
extern
UINT
TTYDRV_BITMAP_SetDIBColorTable
(
struct
tagBITMAPOBJ
*
,
struct
tagDC
*
,
UINT
,
UINT
,
const
RGBQUAD
*
);
extern
UINT
TTYDRV_BITMAP_GetDIBColorTable
(
struct
tagBITMAPOBJ
*
,
struct
tagDC
*
,
UINT
,
UINT
,
RGBQUAD
*
);
#ifndef WINE_CURSES
typedef
struct
{
int
dummy
;
}
WINDOW
;
...
...
graphics/x11drv/dib.c
View file @
a32ddc0f
...
...
@@ -78,53 +78,29 @@ int X11DRV_DIB_GetXImageWidthBytes( int width, int depth )
}
/***********************************************************************
* X11DRV_DIB_
Build
ColorMap
* X11DRV_DIB_
Gen
ColorMap
*
*
Build the color map from the
bitmap palette. Should not be called
*
Fills the color map of a
bitmap palette. Should not be called
* for a >8-bit deep bitmap.
*/
int
*
X11DRV_DIB_BuildColorMap
(
DC
*
dc
,
WORD
coloruse
,
WORD
depth
,
const
BITMAPINFO
*
info
,
int
*
nColors
)
int
*
X11DRV_DIB_GenColorMap
(
DC
*
dc
,
int
*
colorMapping
,
WORD
coloruse
,
WORD
depth
,
BOOL
quads
,
const
void
*
colorPtr
,
int
start
,
int
end
)
{
int
i
,
colors
;
BOOL
isInfo
;
WORD
*
colorPtr
;
int
*
colorMapping
;
if
((
isInfo
=
(
info
->
bmiHeader
.
biSize
==
sizeof
(
BITMAPINFOHEADER
))))
{
colors
=
info
->
bmiHeader
.
biClrUsed
;
if
(
!
colors
)
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
colorPtr
=
(
WORD
*
)
info
->
bmiColors
;
}
else
/* assume BITMAPCOREINFO */
{
colors
=
1
<<
((
BITMAPCOREHEADER
*
)
&
info
->
bmiHeader
)
->
bcBitCount
;
colorPtr
=
(
WORD
*
)((
BITMAPCOREINFO
*
)
info
)
->
bmciColors
;
}
if
(
colors
>
256
)
{
ERR
(
"called with >256 colors!
\n
"
);
return
NULL
;
}
if
(
!
(
colorMapping
=
(
int
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
colors
*
sizeof
(
int
)
)))
return
NULL
;
int
i
;
if
(
coloruse
==
DIB_RGB_COLORS
)
{
if
(
isInfo
)
if
(
quads
)
{
RGBQUAD
*
rgb
=
(
RGBQUAD
*
)
colorPtr
;
if
(
depth
==
1
)
/* Monochrome */
for
(
i
=
0
;
i
<
colors
;
i
++
,
rgb
++
)
for
(
i
=
start
;
i
<
end
;
i
++
,
rgb
++
)
colorMapping
[
i
]
=
(
rgb
->
rgbRed
+
rgb
->
rgbGreen
+
rgb
->
rgbBlue
>
255
*
3
/
2
);
else
for
(
i
=
0
;
i
<
colors
;
i
++
,
rgb
++
)
for
(
i
=
start
;
i
<
end
;
i
++
,
rgb
++
)
colorMapping
[
i
]
=
X11DRV_PALETTE_ToPhysical
(
dc
,
RGB
(
rgb
->
rgbRed
,
rgb
->
rgbGreen
,
rgb
->
rgbBlue
));
...
...
@@ -134,11 +110,11 @@ int *X11DRV_DIB_BuildColorMap( DC *dc, WORD coloruse, WORD depth,
RGBTRIPLE
*
rgb
=
(
RGBTRIPLE
*
)
colorPtr
;
if
(
depth
==
1
)
/* Monochrome */
for
(
i
=
0
;
i
<
colors
;
i
++
,
rgb
++
)
for
(
i
=
start
;
i
<
end
;
i
++
,
rgb
++
)
colorMapping
[
i
]
=
(
rgb
->
rgbtRed
+
rgb
->
rgbtGreen
+
rgb
->
rgbtBlue
>
255
*
3
/
2
);
else
for
(
i
=
0
;
i
<
colors
;
i
++
,
rgb
++
)
for
(
i
=
start
;
i
<
end
;
i
++
,
rgb
++
)
colorMapping
[
i
]
=
X11DRV_PALETTE_ToPhysical
(
dc
,
RGB
(
rgb
->
rgbtRed
,
rgb
->
rgbtGreen
,
rgb
->
rgbtBlue
));
...
...
@@ -146,14 +122,56 @@ int *X11DRV_DIB_BuildColorMap( DC *dc, WORD coloruse, WORD depth,
}
else
/* DIB_PAL_COLORS */
{
for
(
i
=
0
;
i
<
colors
;
i
++
,
colorPtr
++
)
colorMapping
[
i
]
=
X11DRV_PALETTE_ToPhysical
(
dc
,
PALETTEINDEX
(
*
colorPtr
)
);
WORD
*
index
=
(
WORD
*
)
colorPtr
;
for
(
i
=
start
;
i
<
end
;
i
++
,
index
++
)
colorMapping
[
i
]
=
X11DRV_PALETTE_ToPhysical
(
dc
,
PALETTEINDEX
(
*
index
)
);
}
*
nColors
=
colors
;
return
colorMapping
;
}
/***********************************************************************
* X11DRV_DIB_BuildColorMap
*
* Build the color map from the bitmap palette. Should not be called
* for a >8-bit deep bitmap.
*/
int
*
X11DRV_DIB_BuildColorMap
(
DC
*
dc
,
WORD
coloruse
,
WORD
depth
,
const
BITMAPINFO
*
info
,
int
*
nColors
)
{
int
colors
;
BOOL
isInfo
;
WORD
*
colorPtr
;
int
*
colorMapping
;
if
((
isInfo
=
(
info
->
bmiHeader
.
biSize
==
sizeof
(
BITMAPINFOHEADER
))))
{
colors
=
info
->
bmiHeader
.
biClrUsed
;
if
(
!
colors
)
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
colorPtr
=
(
WORD
*
)
info
->
bmiColors
;
}
else
/* assume BITMAPCOREINFO */
{
colors
=
1
<<
((
BITMAPCOREHEADER
*
)
&
info
->
bmiHeader
)
->
bcBitCount
;
colorPtr
=
(
WORD
*
)((
BITMAPCOREINFO
*
)
info
)
->
bmciColors
;
}
if
(
colors
>
256
)
{
ERR
(
"called with >256 colors!
\n
"
);
return
NULL
;
}
if
(
!
(
colorMapping
=
(
int
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
colors
*
sizeof
(
int
)
)))
return
NULL
;
*
nColors
=
colors
;
return
X11DRV_DIB_GenColorMap
(
dc
,
colorMapping
,
coloruse
,
depth
,
isInfo
,
colorPtr
,
0
,
colors
);
}
/***********************************************************************
* X11DRV_DIB_MapColor
...
...
@@ -3603,6 +3621,42 @@ void X11DRV_DIB_DeleteDIBSection(BITMAPOBJ *bmp)
if
(
dib
->
selector
)
SELECTOR_FreeBlock
(
dib
->
selector
);
}
/***********************************************************************
* X11DRV_DIB_SetDIBColorTable
*/
UINT
X11DRV_DIB_SetDIBColorTable
(
BITMAPOBJ
*
bmp
,
DC
*
dc
,
UINT
start
,
UINT
count
,
const
RGBQUAD
*
colors
)
{
X11DRV_DIBSECTION
*
dib
=
(
X11DRV_DIBSECTION
*
)
bmp
->
dib
;
if
(
dib
&&
dib
->
colorMap
)
{
X11DRV_DIB_GenColorMap
(
dc
,
dib
->
colorMap
,
DIB_RGB_COLORS
,
dib
->
dibSection
.
dsBm
.
bmBitsPixel
,
TRUE
,
colors
,
start
,
count
-
start
);
return
count
;
}
return
0
;
}
/***********************************************************************
* X11DRV_DIB_GetDIBColorTable
*/
UINT
X11DRV_DIB_GetDIBColorTable
(
BITMAPOBJ
*
bmp
,
DC
*
dc
,
UINT
start
,
UINT
count
,
RGBQUAD
*
colors
)
{
X11DRV_DIBSECTION
*
dib
=
(
X11DRV_DIBSECTION
*
)
bmp
->
dib
;
if
(
dib
&&
dib
->
colorMap
)
{
int
i
,
end
=
count
-
start
;
for
(
i
=
start
;
i
<
end
;
i
++
,
colors
++
)
{
COLORREF
col
=
X11DRV_PALETTE_ToLogical
(
dib
->
colorMap
[
i
]
);
colors
->
rgbBlue
=
GetBValue
(
col
);
colors
->
rgbGreen
=
GetGValue
(
col
);
colors
->
rgbRed
=
GetRValue
(
col
);
colors
->
rgbReserved
=
0
;
}
return
count
;
}
return
0
;
}
/**************************************************************************
* X11DRV_DIB_CreateDIBFromPixmap
...
...
graphics/x11drv/init.c
View file @
a32ddc0f
...
...
@@ -131,7 +131,9 @@ BITMAP_DRIVER X11DRV_BITMAP_Driver =
{
X11DRV_DIB_SetDIBits
,
X11DRV_DIB_GetDIBits
,
X11DRV_DIB_DeleteDIBSection
X11DRV_DIB_DeleteDIBSection
,
X11DRV_DIB_SetDIBColorTable
,
X11DRV_DIB_GetDIBColorTable
};
PALETTE_DRIVER
X11DRV_PALETTE_Driver
=
...
...
include/bitmap.h
View file @
a32ddc0f
...
...
@@ -35,6 +35,8 @@ typedef struct tagBITMAP_DRIVER
INT
(
*
pSetDIBits
)(
struct
tagBITMAPOBJ
*
,
struct
tagDC
*
,
UINT
,
UINT
,
LPCVOID
,
const
BITMAPINFO
*
,
UINT
,
HBITMAP
);
INT
(
*
pGetDIBits
)(
struct
tagBITMAPOBJ
*
,
struct
tagDC
*
,
UINT
,
UINT
,
LPVOID
,
BITMAPINFO
*
,
UINT
,
HBITMAP
);
VOID
(
*
pDeleteDIBSection
)(
struct
tagBITMAPOBJ
*
);
UINT
(
*
pSetDIBColorTable
)(
struct
tagBITMAPOBJ
*
,
struct
tagDC
*
,
UINT
,
UINT
,
const
RGBQUAD
*
);
UINT
(
*
pGetDIBColorTable
)(
struct
tagBITMAPOBJ
*
,
struct
tagDC
*
,
UINT
,
UINT
,
RGBQUAD
*
);
}
BITMAP_DRIVER
;
extern
BITMAP_DRIVER
*
BITMAP_Driver
;
...
...
include/x11drv.h
View file @
a32ddc0f
...
...
@@ -280,6 +280,8 @@ extern INT X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT
UINT
lines
,
LPVOID
bits
,
BITMAPINFO
*
info
,
UINT
coloruse
,
HBITMAP
hbitmap
);
extern
void
X11DRV_DIB_DeleteDIBSection
(
struct
tagBITMAPOBJ
*
bmp
);
extern
UINT
X11DRV_DIB_SetDIBColorTable
(
struct
tagBITMAPOBJ
*
,
struct
tagDC
*
,
UINT
,
UINT
,
const
RGBQUAD
*
);
extern
UINT
X11DRV_DIB_GetDIBColorTable
(
struct
tagBITMAPOBJ
*
,
struct
tagDC
*
,
UINT
,
UINT
,
RGBQUAD
*
);
/**************************************************************************
* X11 GDI driver
...
...
objects/dib.c
View file @
a32ddc0f
...
...
@@ -306,40 +306,22 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries,
RGBQUAD
*
colors
)
{
DC
*
dc
;
PALETTEENTRY
*
palEntry
;
PALETTEOBJ
*
palette
;
RGBQUAD
*
end
;
BITMAPOBJ
*
bmp
;
UINT
result
;
if
(
!
(
dc
=
DC_GetDCUpdate
(
hdc
)))
return
0
;
if
(
!
(
palette
=
(
PALETTEOBJ
*
)
GDI_GetObjPtr
(
dc
->
hPalette
,
PALETTE
_MAGIC
)))
if
(
!
(
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
dc
->
hBitmap
,
BITMAP
_MAGIC
)))
{
GDI_ReleaseObj
(
hdc
);
return
0
;
}
/* Transfer color info */
if
(
dc
->
bitsPerPixel
<=
8
)
{
palEntry
=
palette
->
logpalette
.
palPalEntry
+
startpos
;
if
(
startpos
+
entries
>
(
1
<<
dc
->
bitsPerPixel
))
entries
=
(
1
<<
dc
->
bitsPerPixel
)
-
startpos
;
if
(
startpos
+
entries
>
palette
->
logpalette
.
palNumEntries
)
entries
=
palette
->
logpalette
.
palNumEntries
-
startpos
;
result
=
BITMAP_Driver
->
pSetDIBColorTable
(
bmp
,
dc
,
startpos
,
entries
,
colors
);
for
(
end
=
colors
+
entries
;
colors
<
end
;
palEntry
++
,
colors
++
)
{
palEntry
->
peRed
=
colors
->
rgbRed
;
palEntry
->
peGreen
=
colors
->
rgbGreen
;
palEntry
->
peBlue
=
colors
->
rgbBlue
;
}
}
else
{
entries
=
0
;
}
GDI_ReleaseObj
(
dc
->
hPalette
);
GDI_ReleaseObj
(
dc
->
hBitmap
);
GDI_ReleaseObj
(
hdc
);
return
entries
;
return
result
;
}
/***********************************************************************
...
...
@@ -358,38 +340,22 @@ UINT WINAPI GetDIBColorTable( HDC hdc, UINT startpos, UINT entries,
RGBQUAD
*
colors
)
{
DC
*
dc
;
PALETTEENTRY
*
palEntry
;
PALETTEOBJ
*
palette
;
RGBQUAD
*
end
;
BITMAPOBJ
*
bmp
;
UINT
result
;
if
(
!
(
dc
=
DC_GetDCUpdate
(
hdc
)))
return
0
;
if
(
!
(
palette
=
(
PALETTEOBJ
*
)
GDI_GetObjPtr
(
dc
->
hPalette
,
PALETTE
_MAGIC
)))
if
(
!
(
bmp
=
(
BITMAPOBJ
*
)
GDI_GetObjPtr
(
dc
->
hBitmap
,
BITMAP
_MAGIC
)))
{
GDI_ReleaseObj
(
hdc
);
return
0
;
}
/* Transfer color info */
if
(
dc
->
bitsPerPixel
<=
8
)
{
palEntry
=
palette
->
logpalette
.
palPalEntry
+
startpos
;
if
(
startpos
+
entries
>
(
1
<<
dc
->
bitsPerPixel
))
{
entries
=
(
1
<<
dc
->
bitsPerPixel
)
-
startpos
;
}
for
(
end
=
colors
+
entries
;
colors
<
end
;
palEntry
++
,
colors
++
)
{
colors
->
rgbRed
=
palEntry
->
peRed
;
colors
->
rgbGreen
=
palEntry
->
peGreen
;
colors
->
rgbBlue
=
palEntry
->
peBlue
;
colors
->
rgbReserved
=
0
;
}
}
else
{
entries
=
0
;
}
GDI_ReleaseObj
(
dc
->
hPalette
);
result
=
BITMAP_Driver
->
pGetDIBColorTable
(
bmp
,
dc
,
startpos
,
entries
,
colors
);
GDI_ReleaseObj
(
dc
->
hBitmap
);
GDI_ReleaseObj
(
hdc
);
return
entries
;
return
result
;
}
/* FIXME the following two structs should be combined with __sysPalTemplate in
...
...
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