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
1c2f9255
Commit
1c2f9255
authored
Jun 22, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Fix StretchDIBits return value when destination is clipped.
parent
0773ed8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
22 deletions
+46
-22
dib.c
dlls/gdi32/dib.c
+3
-2
bitmap.c
dlls/gdi32/tests/bitmap.c
+43
-20
No files found.
dlls/gdi32/dib.c
View file @
1c2f9255
...
...
@@ -544,6 +544,9 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
src
.
visrect
.
bottom
=
height
;
if
(
!
intersect_rect
(
&
src
.
visrect
,
&
src
.
visrect
,
&
rect
))
goto
done
;
if
(
rop
==
SRCCOPY
)
ret
=
height
;
else
ret
=
src_info
->
bmiHeader
.
biHeight
;
get_bounding_rect
(
&
rect
,
dst
.
x
,
dst
.
y
,
dst
.
width
,
dst
.
height
);
if
(
!
clip_visrect
(
dc
,
&
dst
.
visrect
,
&
rect
))
goto
done
;
...
...
@@ -584,8 +587,6 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
if
(
!
err
)
err
=
dev
->
funcs
->
pPutImage
(
dev
,
NULL
,
dst_info
,
&
src_bits
,
&
src
,
&
dst
,
rop
);
}
if
(
err
)
ret
=
0
;
else
if
(
rop
==
SRCCOPY
)
ret
=
height
;
else
ret
=
src_info
->
bmiHeader
.
biHeight
;
done:
if
(
src_bits
.
free
)
src_bits
.
free
(
&
src_bits
);
...
...
dlls/gdi32/tests/bitmap.c
View file @
1c2f9255
...
...
@@ -3353,12 +3353,13 @@ static void check_StretchDIBits_pixel(HDC hdcDst, UINT32 *dstBuffer, UINT32 *src
dwRop
,
expected
,
*
dstBuffer
,
line
);
}
static
void
check_StretchDIBits_stretch
(
HDC
hdcDst
,
UINT32
*
dstBuffer
,
UINT32
*
srcBuffer
,
static
INT
check_StretchDIBits_stretch
(
HDC
hdcDst
,
UINT32
*
dstBuffer
,
UINT32
*
srcBuffer
,
int
nXOriginDest
,
int
nYOriginDest
,
int
nWidthDest
,
int
nHeightDest
,
int
nXOriginSrc
,
int
nYOriginSrc
,
int
nWidthSrc
,
int
nHeightSrc
,
UINT32
expected
[
4
],
int
line
)
{
BITMAPINFO
bitmapInfo
;
INT
ret
;
memset
(
&
bitmapInfo
,
0
,
sizeof
(
BITMAPINFO
));
bitmapInfo
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
...
...
@@ -3369,9 +3370,9 @@ static void check_StretchDIBits_stretch(HDC hdcDst, UINT32 *dstBuffer, UINT32 *s
bitmapInfo
.
bmiHeader
.
biCompression
=
BI_RGB
;
memset
(
dstBuffer
,
0
,
16
);
StretchDIBits
(
hdcDst
,
nXOriginDest
,
nYOriginDest
,
nWidthDest
,
nHeightDest
,
nXOriginSrc
,
nYOriginSrc
,
nWidthSrc
,
nHeightSrc
,
srcBuffer
,
&
bitmapInfo
,
DIB_RGB_COLORS
,
SRCCOPY
);
ret
=
StretchDIBits
(
hdcDst
,
nXOriginDest
,
nYOriginDest
,
nWidthDest
,
nHeightDest
,
nXOriginSrc
,
nYOriginSrc
,
nWidthSrc
,
nHeightSrc
,
srcBuffer
,
&
bitmapInfo
,
DIB_RGB_COLORS
,
SRCCOPY
);
ok
(
memcmp
(
dstBuffer
,
expected
,
16
)
==
0
,
"StretchDIBits expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X } "
"stretching { %d, %d, %d, %d } to { %d, %d, %d, %d } from line %d
\n
"
,
...
...
@@ -3379,6 +3380,7 @@ static void check_StretchDIBits_stretch(HDC hdcDst, UINT32 *dstBuffer, UINT32 *s
dstBuffer
[
0
],
dstBuffer
[
1
],
dstBuffer
[
2
],
dstBuffer
[
3
],
nXOriginSrc
,
nYOriginSrc
,
nWidthSrc
,
nHeightSrc
,
nXOriginDest
,
nYOriginDest
,
nWidthDest
,
nHeightDest
,
line
);
return
ret
;
}
static
void
test_StretchDIBits
(
void
)
...
...
@@ -3390,6 +3392,7 @@ static void test_StretchDIBits(void)
HBRUSH
hBrush
,
hOldBrush
;
BITMAPINFO
biDst
;
UINT32
expected
[
4
];
INT
ret
;
memset
(
&
biDst
,
0
,
sizeof
(
BITMAPINFO
));
biDst
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
);
...
...
@@ -3435,43 +3438,63 @@ static void test_StretchDIBits(void)
expected
[
0
]
=
0xCAFED00D
,
expected
[
1
]
=
0xFEEDFACE
;
expected
[
2
]
=
0xFEDCBA98
,
expected
[
3
]
=
0x76543210
;
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
2
,
2
,
0
,
0
,
2
,
2
,
expected
,
__LINE__
);
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
2
,
2
,
0
,
0
,
2
,
2
,
expected
,
__LINE__
);
ok
(
ret
==
2
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0xCAFED00D
,
expected
[
1
]
=
0x00000000
;
expected
[
2
]
=
0x00000000
,
expected
[
3
]
=
0x00000000
;
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
1
,
1
,
0
,
0
,
1
,
1
,
expected
,
__LINE__
);
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
1
,
1
,
0
,
0
,
1
,
1
,
expected
,
__LINE__
);
todo_wine
ok
(
ret
==
1
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0xFEDCBA98
,
expected
[
1
]
=
0xFEDCBA98
;
expected
[
2
]
=
0xFEDCBA98
,
expected
[
3
]
=
0xFEDCBA98
;
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
2
,
2
,
0
,
0
,
1
,
1
,
expected
,
__LINE__
);
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
2
,
2
,
0
,
0
,
1
,
1
,
expected
,
__LINE__
);
ok
(
ret
==
2
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0x42441000
,
expected
[
1
]
=
0x00000000
;
expected
[
2
]
=
0x00000000
,
expected
[
3
]
=
0x00000000
;
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
1
,
1
,
0
,
0
,
2
,
2
,
expected
,
__LINE__
);
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
1
,
1
,
0
,
0
,
2
,
2
,
expected
,
__LINE__
);
ok
(
ret
==
2
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0x00000000
,
expected
[
1
]
=
0x00000000
;
expected
[
2
]
=
0x00000000
,
expected
[
3
]
=
0x00000000
;
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
2
,
2
,
1
,
1
,
-
2
,
-
2
,
expected
,
__LINE__
);
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
2
,
2
,
1
,
1
,
-
2
,
-
2
,
expected
,
__LINE__
);
ok
(
ret
==
0
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0x00000000
,
expected
[
1
]
=
0x00000000
;
expected
[
2
]
=
0x00000000
,
expected
[
3
]
=
0x00000000
;
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
2
,
2
,
1
,
1
,
-
2
,
-
2
,
expected
,
__LINE__
);
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
0
,
0
,
2
,
2
,
1
,
1
,
-
2
,
-
2
,
expected
,
__LINE__
);
ok
(
ret
==
0
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0x00000000
,
expected
[
1
]
=
0x00000000
;
expected
[
2
]
=
0x00000000
,
expected
[
3
]
=
0x00000000
;
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
1
,
1
,
-
2
,
-
2
,
1
,
1
,
-
2
,
-
2
,
expected
,
__LINE__
);
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
1
,
1
,
-
2
,
-
2
,
1
,
1
,
-
2
,
-
2
,
expected
,
__LINE__
);
ok
(
ret
==
0
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0x00000000
,
expected
[
1
]
=
0x00000000
;
expected
[
2
]
=
0x00000000
,
expected
[
3
]
=
0xCAFED00D
;
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
1
,
1
,
2
,
2
,
0
,
0
,
2
,
2
,
expected
,
__LINE__
);
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
1
,
1
,
2
,
2
,
0
,
0
,
2
,
2
,
expected
,
__LINE__
);
ok
(
ret
==
2
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0x00000000
,
expected
[
1
]
=
0x00000000
;
expected
[
2
]
=
0x00000000
,
expected
[
3
]
=
0x00000000
;
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
2
,
2
,
4
,
4
,
0
,
0
,
2
,
2
,
expected
,
__LINE__
);
ok
(
ret
==
2
,
"got ret %d
\n
"
,
ret
);
expected
[
0
]
=
0x00000000
,
expected
[
1
]
=
0x00000000
;
expected
[
2
]
=
0x00000000
,
expected
[
3
]
=
0x00000000
;
ret
=
check_StretchDIBits_stretch
(
hdcDst
,
dstBuffer
,
srcBuffer
,
-
4
,
-
4
,
4
,
4
,
0
,
0
,
4
,
4
,
expected
,
__LINE__
);
ok
(
ret
==
2
,
"got ret %d
\n
"
,
ret
);
SelectObject
(
hdcDst
,
oldDst
);
DeleteObject
(
bmpDst
);
...
...
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