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
27516bab
Commit
27516bab
authored
Sep 14, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a couple of helper functions for converting and stretching DIBs.
parent
7696168d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
29 deletions
+45
-29
bitblt.c
dlls/gdi32/bitblt.c
+45
-29
No files found.
dlls/gdi32/bitblt.c
View file @
27516bab
...
...
@@ -157,6 +157,45 @@ void free_heap_bits( struct gdi_image_bits *bits )
HeapFree
(
GetProcessHeap
(),
0
,
bits
->
ptr
);
}
static
DWORD
convert_bits
(
const
BITMAPINFO
*
src_info
,
struct
bitblt_coords
*
src
,
BITMAPINFO
*
dst_info
,
struct
gdi_image_bits
*
bits
)
{
void
*
ptr
;
DWORD
err
;
dst_info
->
bmiHeader
.
biWidth
=
src
->
visrect
.
right
-
src
->
visrect
.
left
;
if
(
!
(
ptr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
get_dib_image_size
(
dst_info
))))
return
ERROR_OUTOFMEMORY
;
err
=
convert_bitmapinfo
(
src_info
,
bits
->
ptr
,
src
,
dst_info
,
ptr
);
if
(
bits
->
free
)
bits
->
free
(
bits
);
bits
->
ptr
=
ptr
;
bits
->
is_copy
=
TRUE
;
bits
->
free
=
free_heap_bits
;
return
err
;
}
static
DWORD
stretch_bits
(
const
BITMAPINFO
*
src_info
,
struct
bitblt_coords
*
src
,
BITMAPINFO
*
dst_info
,
struct
bitblt_coords
*
dst
,
struct
gdi_image_bits
*
bits
,
int
mode
)
{
void
*
ptr
;
DWORD
err
;
dst_info
->
bmiHeader
.
biWidth
=
dst
->
visrect
.
right
-
dst
->
visrect
.
left
;
dst_info
->
bmiHeader
.
biHeight
=
dst
->
visrect
.
bottom
-
dst
->
visrect
.
top
;
if
(
src_info
->
bmiHeader
.
biHeight
<
0
)
dst_info
->
bmiHeader
.
biHeight
=
-
dst_info
->
bmiHeader
.
biHeight
;
if
(
!
(
ptr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
get_dib_image_size
(
dst_info
))))
return
ERROR_OUTOFMEMORY
;
err
=
stretch_bitmapinfo
(
src_info
,
bits
->
ptr
,
src
,
dst_info
,
ptr
,
dst
,
mode
);
if
(
bits
->
free
)
bits
->
free
(
bits
);
bits
->
ptr
=
ptr
;
bits
->
is_copy
=
TRUE
;
bits
->
free
=
free_heap_bits
;
return
err
;
}
/* nulldrv fallback implementation using StretchDIBits */
BOOL
nulldrv_StretchBlt
(
PHYSDEV
dst_dev
,
struct
bitblt_coords
*
dst
,
PHYSDEV
src_dev
,
struct
bitblt_coords
*
src
,
DWORD
rop
)
...
...
@@ -168,7 +207,6 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
BITMAPINFO
*
dst_info
=
(
BITMAPINFO
*
)
dst_buffer
;
DWORD
err
;
struct
gdi_image_bits
bits
;
LPVOID
ptr
;
if
(
!
(
dc_src
=
get_dc_ptr
(
src_dev
->
hdc
)))
return
FALSE
;
src_dev
=
GET_DC_PHYSDEV
(
dc_src
,
pGetImage
);
...
...
@@ -209,42 +247,20 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
dst_info
->
bmiHeader
.
biClrUsed
=
1
;
}
dst_info
->
bmiHeader
.
biWidth
=
src
->
visrect
.
right
-
src
->
visrect
.
left
;
if
((
ptr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
get_dib_image_size
(
dst_info
))))
if
(
!
(
err
=
convert_bits
(
src_info
,
src
,
dst_info
,
&
bits
)))
{
err
=
convert_bitmapinfo
(
src_info
,
bits
.
ptr
,
src
,
dst_info
,
ptr
);
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
bits
.
ptr
=
ptr
;
bits
.
is_copy
=
TRUE
;
bits
.
free
=
free_heap_bits
;
if
(
!
err
)
{
/* get rid of the fake 1-bpp table */
if
(
dst_info
->
bmiHeader
.
biClrUsed
==
1
)
dst_info
->
bmiHeader
.
biClrUsed
=
0
;
err
=
dst_dev
->
funcs
->
pPutImage
(
dst_dev
,
0
,
0
,
dst_info
,
&
bits
,
src
,
dst
,
rop
);
}
/* get rid of the fake 1-bpp table */
if
(
dst_info
->
bmiHeader
.
biClrUsed
==
1
)
dst_info
->
bmiHeader
.
biClrUsed
=
0
;
err
=
dst_dev
->
funcs
->
pPutImage
(
dst_dev
,
0
,
0
,
dst_info
,
&
bits
,
src
,
dst
,
rop
);
}
else
err
=
ERROR_OUTOFMEMORY
;
}
if
(
err
==
ERROR_TRANSFORM_NOT_SUPPORTED
&&
((
src
->
width
!=
dst
->
width
)
||
(
src
->
height
!=
dst
->
height
)))
{
memcpy
(
src_info
,
dst_info
,
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
));
dst_info
->
bmiHeader
.
biWidth
=
dst
->
visrect
.
right
-
dst
->
visrect
.
left
;
dst_info
->
bmiHeader
.
biHeight
=
dst
->
visrect
.
bottom
-
dst
->
visrect
.
top
;
if
(
src_info
->
bmiHeader
.
biHeight
<
0
)
dst_info
->
bmiHeader
.
biHeight
=
-
dst_info
->
bmiHeader
.
biHeight
;
if
((
ptr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
get_dib_image_size
(
dst_info
))))
{
err
=
stretch_bitmapinfo
(
src_info
,
bits
.
ptr
,
src
,
dst_info
,
ptr
,
dst
,
GetStretchBltMode
(
dst_dev
->
hdc
)
);
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
bits
.
ptr
=
ptr
;
bits
.
is_copy
=
TRUE
;
bits
.
free
=
free_heap_bits
;
if
(
!
err
)
err
=
dst_dev
->
funcs
->
pPutImage
(
dst_dev
,
0
,
0
,
dst_info
,
&
bits
,
src
,
dst
,
rop
);
}
else
err
=
ERROR_OUTOFMEMORY
;
err
=
stretch_bits
(
src_info
,
src
,
dst_info
,
dst
,
&
bits
,
GetStretchBltMode
(
dst_dev
->
hdc
));
if
(
!
err
)
err
=
dst_dev
->
funcs
->
pPutImage
(
dst_dev
,
0
,
0
,
dst_info
,
&
bits
,
src
,
dst
,
rop
);
}
if
(
bits
.
free
)
bits
.
free
(
&
bits
);
...
...
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