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
720bc3fa
Commit
720bc3fa
authored
Feb 19, 2011
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Feb 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Handle BITMAP_CopyBitmap correctly for negative heights.
parent
005915f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
bitmap.c
dlls/gdi32/bitmap.c
+13
-6
No files found.
dlls/gdi32/bitmap.c
View file @
720bc3fa
...
@@ -512,15 +512,18 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
...
@@ -512,15 +512,18 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
{
{
HBITMAP
res
;
HBITMAP
res
;
DIBSECTION
dib
;
DIBSECTION
dib
;
DWORD
size
;
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
);
if
(
!
(
size
=
GetObjectW
(
hbitmap
,
sizeof
(
dib
),
&
dib
)))
return
0
;
if
(
size
==
sizeof
(
DIBSECTION
))
if
(
!
bmp
)
return
0
;
if
(
bmp
->
dib
)
{
{
void
*
bits
;
void
*
bits
;
BITMAPINFO
*
bi
;
BITMAPINFO
*
bi
;
HDC
dc
=
CreateCompatibleDC
(
NULL
);
HDC
dc
;
dib
=
*
bmp
->
dib
;
GDI_ReleaseObj
(
hbitmap
);
dc
=
CreateCompatibleDC
(
NULL
);
if
(
!
dc
)
return
0
;
if
(
!
dc
)
return
0
;
if
(
!
(
bi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
))))
if
(
!
(
bi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
BITMAPINFO
,
bmiColors
[
256
]
))))
...
@@ -532,6 +535,7 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
...
@@ -532,6 +535,7 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
/* Get the color table or the color masks */
/* Get the color table or the color masks */
GetDIBits
(
dc
,
hbitmap
,
0
,
0
,
NULL
,
bi
,
DIB_RGB_COLORS
);
GetDIBits
(
dc
,
hbitmap
,
0
,
0
,
NULL
,
bi
,
DIB_RGB_COLORS
);
bi
->
bmiHeader
.
biHeight
=
dib
.
dsBmih
.
biHeight
;
res
=
CreateDIBSection
(
dc
,
bi
,
DIB_RGB_COLORS
,
&
bits
,
NULL
,
0
);
res
=
CreateDIBSection
(
dc
,
bi
,
DIB_RGB_COLORS
,
&
bits
,
NULL
,
0
);
if
(
res
)
SetDIBits
(
dc
,
res
,
0
,
dib
.
dsBm
.
bmHeight
,
dib
.
dsBm
.
bmBits
,
bi
,
DIB_RGB_COLORS
);
if
(
res
)
SetDIBits
(
dc
,
res
,
0
,
dib
.
dsBm
.
bmHeight
,
dib
.
dsBm
.
bmBits
,
bi
,
DIB_RGB_COLORS
);
...
@@ -539,13 +543,16 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
...
@@ -539,13 +543,16 @@ HBITMAP BITMAP_CopyBitmap(HBITMAP hbitmap)
DeleteDC
(
dc
);
DeleteDC
(
dc
);
return
res
;
return
res
;
}
}
dib
.
dsBm
=
bmp
->
bitmap
;
dib
.
dsBm
.
bmBits
=
NULL
;
GDI_ReleaseObj
(
hbitmap
);
res
=
CreateBitmapIndirect
(
&
dib
.
dsBm
);
res
=
CreateBitmapIndirect
(
&
dib
.
dsBm
);
if
(
res
)
{
if
(
res
)
{
char
*
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dib
.
dsBm
.
bmWidthBytes
*
dib
.
dsBm
.
bmHeight
);
char
*
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dib
.
dsBm
.
bmWidthBytes
*
dib
.
dsBm
.
bmHeight
);
GetBitmapBits
(
hbitmap
,
dib
.
dsBm
.
bmWidthBytes
*
dib
.
dsBm
.
bmHeight
,
buf
);
GetBitmapBits
(
hbitmap
,
dib
.
dsBm
.
bmWidthBytes
*
dib
.
dsBm
.
bmHeight
,
buf
);
SetBitmapBits
(
res
,
dib
.
dsBm
.
bmWidthBytes
*
dib
.
dsBm
.
bmHeight
,
buf
);
SetBitmapBits
(
res
,
dib
.
dsBm
.
bmWidthBytes
*
dib
.
dsBm
.
bmHeight
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
}
return
res
;
return
res
;
}
}
...
...
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