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
6f275874
Commit
6f275874
authored
Sep 06, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a SetDIBitsToDevice implementation in the null driver using PutImage.
parent
650e000b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
7 deletions
+109
-7
dib.c
dlls/gdi32/dib.c
+101
-0
driver.c
dlls/gdi32/driver.c
+0
-7
gdi_private.h
dlls/gdi32/gdi_private.h
+3
-0
bitmap.c
dlls/gdi32/tests/bitmap.c
+5
-0
No files found.
dlls/gdi32/dib.c
View file @
6f275874
...
...
@@ -610,6 +610,107 @@ done:
}
INT
nulldrv_SetDIBitsToDevice
(
PHYSDEV
dev
,
INT
x_dst
,
INT
y_dst
,
DWORD
cx
,
DWORD
cy
,
INT
x_src
,
INT
y_src
,
UINT
startscan
,
UINT
lines
,
const
void
*
bits
,
BITMAPINFO
*
src_info
,
UINT
coloruse
)
{
DC
*
dc
=
get_nulldrv_dc
(
dev
);
char
dst_buffer
[
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
)];
BITMAPINFO
*
dst_info
=
(
BITMAPINFO
*
)
dst_buffer
;
struct
bitblt_coords
src
,
dst
;
struct
gdi_image_bits
src_bits
;
DWORD
err
;
UINT
height
;
BOOL
top_down
;
POINT
pt
;
RECT
rect
;
top_down
=
(
src_info
->
bmiHeader
.
biHeight
<
0
);
height
=
abs
(
src_info
->
bmiHeader
.
biHeight
);
src_bits
.
ptr
=
(
void
*
)
bits
;
src_bits
.
is_copy
=
FALSE
;
src_bits
.
free
=
NULL
;
if
(
coloruse
==
DIB_PAL_COLORS
&&
!
fill_color_table_from_palette
(
src_info
,
dev
->
hdc
))
return
0
;
if
(
!
lines
||
(
startscan
>=
height
))
return
0
;
if
(
!
top_down
&&
lines
>
height
-
startscan
)
lines
=
height
-
startscan
;
/* map src to top-down coordinates with startscan as origin */
src
.
x
=
x_src
;
src
.
y
=
startscan
+
lines
-
(
y_src
+
cy
);
src
.
width
=
cx
;
src
.
height
=
cy
;
if
(
src
.
y
>
0
)
{
if
(
!
top_down
)
{
/* get rid of unnecessary lines */
if
(
src
.
y
>=
lines
)
return
0
;
lines
-=
src
.
y
;
src
.
y
=
0
;
}
else
if
(
src
.
y
>=
lines
)
return
lines
;
}
src_info
->
bmiHeader
.
biHeight
=
top_down
?
-
lines
:
lines
;
src
.
visrect
.
left
=
src
.
x
;
src
.
visrect
.
top
=
src
.
y
;
src
.
visrect
.
right
=
src
.
x
+
cx
;
src
.
visrect
.
bottom
=
src
.
y
+
cy
;
rect
.
left
=
0
;
rect
.
top
=
0
;
rect
.
right
=
src_info
->
bmiHeader
.
biWidth
;
rect
.
bottom
=
abs
(
src_info
->
bmiHeader
.
biHeight
);
if
(
!
intersect_rect
(
&
src
.
visrect
,
&
src
.
visrect
,
&
rect
))
return
0
;
pt
.
x
=
x_dst
;
pt
.
y
=
y_dst
;
LPtoDP
(
dev
->
hdc
,
&
pt
,
1
);
dst
.
x
=
pt
.
x
;
dst
.
y
=
pt
.
y
;
dst
.
width
=
cx
;
dst
.
height
=
cy
;
if
(
GetLayout
(
dev
->
hdc
)
&
LAYOUT_RTL
)
dst
.
x
-=
cx
-
1
;
dst
.
visrect
.
left
=
dst
.
x
;
dst
.
visrect
.
top
=
dst
.
y
;
dst
.
visrect
.
right
=
dst
.
x
+
cx
;
dst
.
visrect
.
bottom
=
dst
.
y
+
cy
;
if
(
get_clip_box
(
dc
,
&
rect
))
intersect_rect
(
&
dst
.
visrect
,
&
dst
.
visrect
,
&
rect
);
offset_rect
(
&
src
.
visrect
,
dst
.
x
-
src
.
x
,
dst
.
y
-
src
.
y
);
intersect_rect
(
&
rect
,
&
src
.
visrect
,
&
dst
.
visrect
);
src
.
visrect
=
dst
.
visrect
=
rect
;
offset_rect
(
&
src
.
visrect
,
src
.
x
-
dst
.
x
,
src
.
y
-
dst
.
y
);
if
(
is_rect_empty
(
&
dst
.
visrect
))
return
lines
;
dev
=
GET_DC_PHYSDEV
(
dc
,
pPutImage
);
memcpy
(
dst_info
,
src_info
,
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
));
err
=
dev
->
funcs
->
pPutImage
(
dev
,
0
,
0
,
dst_info
,
&
src_bits
,
&
src
,
&
dst
,
SRCCOPY
);
if
(
err
==
ERROR_BAD_FORMAT
)
{
void
*
ptr
;
dst_info
->
bmiHeader
.
biWidth
=
src
.
visrect
.
right
-
src
.
visrect
.
left
;
ptr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
get_dib_image_size
(
dst_info
));
if
(
ptr
)
{
err
=
convert_bitmapinfo
(
src_info
,
src_bits
.
ptr
,
&
src
,
dst_info
,
ptr
);
if
(
src_bits
.
free
)
src_bits
.
free
(
&
src_bits
);
src_bits
.
ptr
=
ptr
;
src_bits
.
is_copy
=
TRUE
;
src_bits
.
free
=
free_heap_bits
;
if
(
!
err
)
err
=
dev
->
funcs
->
pPutImage
(
dev
,
0
,
0
,
dst_info
,
&
src_bits
,
&
src
,
&
dst
,
SRCCOPY
);
}
else
err
=
ERROR_OUTOFMEMORY
;
}
if
(
err
)
lines
=
0
;
if
(
src_bits
.
free
)
src_bits
.
free
(
&
src_bits
);
return
lines
;
}
/***********************************************************************
* SetDIBitsToDevice (GDI32.@)
*/
...
...
dlls/gdi32/driver.c
View file @
6f275874
...
...
@@ -502,13 +502,6 @@ static UINT nulldrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const R
return
0
;
}
static
INT
nulldrv_SetDIBitsToDevice
(
PHYSDEV
dev
,
INT
x_dst
,
INT
y_dst
,
DWORD
width
,
DWORD
height
,
INT
x_src
,
INT
y_src
,
UINT
start
,
UINT
lines
,
const
void
*
bits
,
BITMAPINFO
*
info
,
UINT
coloruse
)
{
return
0
;
}
static
void
nulldrv_SetDeviceClipping
(
PHYSDEV
dev
,
HRGN
vis_rgn
,
HRGN
clip_rgn
)
{
}
...
...
dlls/gdi32/gdi_private.h
View file @
6f275874
...
...
@@ -499,6 +499,9 @@ extern INT nulldrv_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern
BOOL
nulldrv_ScaleViewportExtEx
(
PHYSDEV
dev
,
INT
x_num
,
INT
x_denom
,
INT
y_num
,
INT
y_denom
,
SIZE
*
size
)
DECLSPEC_HIDDEN
;
extern
BOOL
nulldrv_ScaleWindowExtEx
(
PHYSDEV
dev
,
INT
x_num
,
INT
x_denom
,
INT
y_num
,
INT
y_denom
,
SIZE
*
size
)
DECLSPEC_HIDDEN
;
extern
BOOL
nulldrv_SelectClipPath
(
PHYSDEV
dev
,
INT
mode
)
DECLSPEC_HIDDEN
;
extern
INT
nulldrv_SetDIBitsToDevice
(
PHYSDEV
dev
,
INT
x_dst
,
INT
y_dst
,
DWORD
width
,
DWORD
height
,
INT
x_src
,
INT
y_src
,
UINT
start
,
UINT
lines
,
const
void
*
bits
,
BITMAPINFO
*
info
,
UINT
coloruse
)
DECLSPEC_HIDDEN
;
extern
INT
nulldrv_SetMapMode
(
PHYSDEV
dev
,
INT
mode
)
DECLSPEC_HIDDEN
;
extern
BOOL
nulldrv_SetViewportExtEx
(
PHYSDEV
dev
,
INT
cx
,
INT
cy
,
SIZE
*
size
)
DECLSPEC_HIDDEN
;
extern
BOOL
nulldrv_SetViewportOrgEx
(
PHYSDEV
dev
,
INT
x
,
INT
y
,
POINT
*
pt
)
DECLSPEC_HIDDEN
;
...
...
dlls/gdi32/tests/bitmap.c
View file @
6f275874
...
...
@@ -4265,6 +4265,11 @@ static void test_SetDIBitsToDevice(void)
for
(
i
=
0
;
i
<
64
;
i
++
)
ok
(
dib_bits
[
i
]
==
0xaaaaaaaa
,
"%d: got %08x
\n
"
,
i
,
dib_bits
[
i
]
);
memset
(
dib_bits
,
0xaa
,
64
*
4
);
ret
=
SetDIBitsToDevice
(
hdc
,
0
,
2
,
8
,
4
,
0
,
-
1
,
3
,
12
,
data
,
info
,
DIB_RGB_COLORS
);
ok
(
ret
==
0
,
"got %d
\n
"
,
ret
);
for
(
i
=
0
;
i
<
64
;
i
++
)
ok
(
dib_bits
[
i
]
==
0xaaaaaaaa
,
"%d: got %08x
\n
"
,
i
,
dib_bits
[
i
]
);
memset
(
dib_bits
,
0xaa
,
64
*
4
);
SetMapMode
(
hdc
,
MM_ANISOTROPIC
);
SetWindowExtEx
(
hdc
,
3
,
3
,
NULL
);
ret
=
SetDIBitsToDevice
(
hdc
,
2
,
2
,
2
,
2
,
1
,
2
,
1
,
5
,
data
,
info
,
DIB_RGB_COLORS
);
...
...
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