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
79d3f290
Commit
79d3f290
authored
Jul 14, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a null driver StretchBlt fallback using GetImage/PutImage.
parent
cf05fca8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
16 deletions
+65
-16
bitblt.c
dlls/gdi32/bitblt.c
+65
-16
No files found.
dlls/gdi32/bitblt.c
View file @
79d3f290
...
...
@@ -164,48 +164,97 @@ static void get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
}
}
static
DWORD
convert_bits
(
const
BITMAPINFO
*
src_info
,
struct
gdi_image_bits
*
src_bits
,
const
RECT
*
src_rect
,
BITMAPINFO
*
dst_info
,
struct
gdi_image_bits
*
dst_bits
)
{
FIXME
(
"%u -> %u not implemented
\n
"
,
src_info
->
bmiHeader
.
biBitCount
,
dst_info
->
bmiHeader
.
biBitCount
);
dst_bits
->
ptr
=
src_bits
->
ptr
;
dst_bits
->
offset
=
src_bits
->
offset
;
dst_bits
->
is_copy
=
src_bits
->
is_copy
;
dst_bits
->
free
=
NULL
;
return
ERROR_SUCCESS
;
}
/* nulldrv fallback implementation using StretchDIBits */
BOOL
nulldrv_StretchBlt
(
PHYSDEV
dst_dev
,
struct
bitblt_coords
*
dst
,
PHYSDEV
src_dev
,
struct
bitblt_coords
*
src
,
DWORD
rop
)
{
DC
*
dc
=
get_nulldrv_dc
(
dst_dev
);
DC
*
dc_src
,
*
dc_dst
=
get_nulldrv_dc
(
dst_dev
);
char
src_buffer
[
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
)];
char
dst_buffer
[
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
)];
BITMAPINFO
*
src_info
=
(
BITMAPINFO
*
)
src_buffer
;
BITMAPINFO
*
dst_info
=
(
BITMAPINFO
*
)
dst_buffer
;
DWORD
err
;
struct
gdi_image_bits
src_bits
,
dst_bits
;
BITMAP
bm
;
BITMAPINFOHEADER
info_hdr
;
HBITMAP
hbm
;
LPVOID
bits
;
INT
lines
;
if
(
dst
->
visrect
.
left
>=
dst
->
visrect
.
right
||
dst
->
visrect
.
top
>=
dst
->
visrect
.
bottom
)
return
TRUE
;
/* make sure we have a real implementation for StretchDIBits */
if
(
GET_DC_PHYSDEV
(
dc
,
pStretchDIBits
)
==
dst_dev
)
return
0
;
if
(
GET_DC_PHYSDEV
(
dc
_dst
,
pStretchDIBits
)
==
dst_dev
)
goto
try_get_image
;
if
(
GetObjectType
(
src_dev
->
hdc
)
!=
OBJ_MEMDC
)
return
FALSE
;
if
(
!
GetObjectW
(
GetCurrentObject
(
src_dev
->
hdc
,
OBJ_BITMAP
),
sizeof
(
bm
),
&
bm
))
return
FALSE
;
info_hdr
.
biSize
=
sizeof
(
info_hd
r
);
info_hd
r
.
biWidth
=
bm
.
bmWidth
;
info_hd
r
.
biHeight
=
bm
.
bmHeight
;
info_hd
r
.
biPlanes
=
1
;
info_hd
r
.
biBitCount
=
32
;
info_hd
r
.
biCompression
=
BI_RGB
;
info_hd
r
.
biSizeImage
=
0
;
info_hd
r
.
biXPelsPerMeter
=
0
;
info_hd
r
.
biYPelsPerMeter
=
0
;
info_hd
r
.
biClrUsed
=
0
;
info_hd
r
.
biClrImportant
=
0
;
src_info
->
bmiHeader
.
biSize
=
sizeof
(
src_info
->
bmiHeade
r
);
src_info
->
bmiHeade
r
.
biWidth
=
bm
.
bmWidth
;
src_info
->
bmiHeade
r
.
biHeight
=
bm
.
bmHeight
;
src_info
->
bmiHeade
r
.
biPlanes
=
1
;
src_info
->
bmiHeade
r
.
biBitCount
=
32
;
src_info
->
bmiHeade
r
.
biCompression
=
BI_RGB
;
src_info
->
bmiHeade
r
.
biSizeImage
=
0
;
src_info
->
bmiHeade
r
.
biXPelsPerMeter
=
0
;
src_info
->
bmiHeade
r
.
biYPelsPerMeter
=
0
;
src_info
->
bmiHeade
r
.
biClrUsed
=
0
;
src_info
->
bmiHeade
r
.
biClrImportant
=
0
;
if
(
!
(
bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
bm
.
bmHeight
*
bm
.
bmWidth
*
4
)))
return
FALSE
;
/* Select out the src bitmap before calling GetDIBits */
hbm
=
SelectObject
(
src_dev
->
hdc
,
GetStockObject
(
DEFAULT_BITMAP
)
);
lines
=
GetDIBits
(
src_dev
->
hdc
,
hbm
,
0
,
bm
.
bmHeight
,
bits
,
(
BITMAPINFO
*
)
&
info_hdr
,
DIB_RGB_COLORS
);
lines
=
GetDIBits
(
src_dev
->
hdc
,
hbm
,
0
,
bm
.
bmHeight
,
bits
,
src_info
,
DIB_RGB_COLORS
);
SelectObject
(
src_dev
->
hdc
,
hbm
);
if
(
lines
)
lines
=
StretchDIBits
(
dst_dev
->
hdc
,
dst
->
log_x
,
dst
->
log_y
,
dst
->
log_width
,
dst
->
log_height
,
src
->
x
,
bm
.
bmHeight
-
src
->
height
-
src
->
y
,
src
->
width
,
src
->
height
,
bits
,
(
BITMAPINFO
*
)
&
info_hdr
,
DIB_RGB_COLORS
,
rop
);
bits
,
src_info
,
DIB_RGB_COLORS
,
rop
);
HeapFree
(
GetProcessHeap
(),
0
,
bits
);
return
(
lines
==
src
->
height
);
try_get_image:
if
(
!
(
dc_src
=
get_dc_ptr
(
src_dev
->
hdc
)))
return
FALSE
;
src_dev
=
GET_DC_PHYSDEV
(
dc_src
,
pGetImage
);
err
=
src_dev
->
funcs
->
pGetImage
(
src_dev
,
0
,
src_info
,
&
src_bits
,
&
src
->
visrect
);
release_dc_ptr
(
dc_src
);
if
(
err
)
return
FALSE
;
dst_dev
=
GET_DC_PHYSDEV
(
dc_dst
,
pPutImage
);
if
((
src
->
width
!=
dst
->
width
)
||
(
src
->
height
!=
dst
->
height
))
FIXME
(
"should stretch %dx%d -> %dx%d
\n
"
,
src
->
width
,
src
->
height
,
dst
->
width
,
dst
->
height
);
memcpy
(
dst_info
,
src_info
,
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
));
err
=
dst_dev
->
funcs
->
pPutImage
(
dst_dev
,
0
,
dst_info
,
&
src_bits
,
&
dst
->
visrect
,
rop
);
if
(
err
==
ERROR_BAD_FORMAT
)
{
RECT
src_rect
=
src
->
visrect
;
offset_rect
(
&
src_rect
,
src_bits
.
offset
-
src
->
visrect
.
left
,
-
src
->
visrect
.
top
);
err
=
convert_bits
(
src_info
,
&
src_bits
,
&
src_rect
,
dst_info
,
&
dst_bits
);
if
(
!
err
)
{
err
=
dst_dev
->
funcs
->
pPutImage
(
dst_dev
,
0
,
dst_info
,
&
dst_bits
,
&
dst
->
visrect
,
rop
);
if
(
dst_bits
.
free
)
dst_bits
.
free
(
&
dst_bits
);
}
}
if
(
src_bits
.
free
)
src_bits
.
free
(
&
src_bits
);
return
!
err
;
}
/***********************************************************************
...
...
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