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
c9bdcbaf
Commit
c9bdcbaf
authored
Oct 31, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Allocate the bits for a DDB the first time it's used in any DIB driver call.
parent
7a8a56a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
44 deletions
+10
-44
bitmap.c
dlls/gdi32/bitmap.c
+3
-44
dc.c
dlls/gdi32/dibdrv/dc.c
+7
-0
No files found.
dlls/gdi32/bitmap.c
View file @
c9bdcbaf
...
...
@@ -53,57 +53,15 @@ static const struct gdi_obj_funcs bitmap_funcs =
DWORD
nulldrv_GetImage
(
PHYSDEV
dev
,
HBITMAP
hbitmap
,
BITMAPINFO
*
info
,
struct
gdi_image_bits
*
bits
,
struct
bitblt_coords
*
src
)
{
BITMAPOBJ
*
bmp
;
DWORD
ret
;
if
(
!
hbitmap
)
return
ERROR_NOT_SUPPORTED
;
if
(
!
(
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
)))
return
ERROR_INVALID_HANDLE
;
if
(
bmp
->
bitmap
.
bmBits
||
!
bits
)
{
ret
=
dib_driver
.
pGetImage
(
0
,
hbitmap
,
info
,
bits
,
src
);
}
else
if
(
!
(
ret
=
dib_driver
.
pGetImage
(
0
,
hbitmap
,
info
,
NULL
,
src
)))
{
info
->
bmiHeader
.
biHeight
=
-
(
src
->
visrect
.
bottom
-
src
->
visrect
.
top
);
info
->
bmiHeader
.
biSizeImage
=
get_dib_image_size
(
info
);
/* make the source rectangle relative to the returned bits */
src
->
y
-=
src
->
visrect
.
top
;
offset_rect
(
&
src
->
visrect
,
0
,
-
src
->
visrect
.
top
);
/* return all-zero bits */
bits
->
ptr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
info
->
bmiHeader
.
biSizeImage
);
bits
->
is_copy
=
TRUE
;
bits
->
free
=
free_heap_bits
;
}
GDI_ReleaseObj
(
hbitmap
);
return
ret
;
return
dib_driver
.
pGetImage
(
0
,
hbitmap
,
info
,
bits
,
src
);
}
DWORD
nulldrv_PutImage
(
PHYSDEV
dev
,
HBITMAP
hbitmap
,
HRGN
clip
,
BITMAPINFO
*
info
,
const
struct
gdi_image_bits
*
bits
,
struct
bitblt_coords
*
src
,
struct
bitblt_coords
*
dst
,
DWORD
rop
)
{
BITMAPOBJ
*
bmp
;
if
(
!
hbitmap
)
return
ERROR_SUCCESS
;
if
(
bits
)
{
if
(
!
(
bmp
=
GDI_GetObjPtr
(
hbitmap
,
OBJ_BITMAP
)))
return
ERROR_INVALID_HANDLE
;
if
(
!
bmp
->
bitmap
.
bmBits
)
{
int
width_bytes
=
get_dib_stride
(
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmBitsPixel
);
if
(
!
(
bmp
->
bitmap
.
bmBits
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
bmp
->
bitmap
.
bmHeight
*
width_bytes
)))
{
GDI_ReleaseObj
(
hbitmap
);
return
ERROR_OUTOFMEMORY
;
}
}
GDI_ReleaseObj
(
hbitmap
);
}
return
dib_driver
.
pPutImage
(
NULL
,
hbitmap
,
clip
,
info
,
bits
,
src
,
dst
,
rop
);
}
...
...
@@ -348,11 +306,12 @@ BOOL get_bitmap_image( HBITMAP hbitmap, BITMAPINFO *info, struct gdi_image_bits
if
(
bmp
)
{
const
struct
gdi_dc_funcs
*
funcs
=
get_bitmap_funcs
(
bmp
);
src
.
visrect
.
left
=
src
.
x
=
0
;
src
.
visrect
.
top
=
src
.
y
=
0
;
src
.
visrect
.
right
=
src
.
width
=
bmp
->
bitmap
.
bmWidth
;
src
.
visrect
.
bottom
=
src
.
height
=
bmp
->
bitmap
.
bmHeight
;
ret
=
!
bmp
->
funcs
->
pGetImage
(
NULL
,
hbitmap
,
info
,
bits
,
&
src
);
ret
=
!
funcs
->
pGetImage
(
NULL
,
hbitmap
,
info
,
bits
,
&
src
);
GDI_ReleaseObj
(
hbitmap
);
}
return
ret
;
...
...
dlls/gdi32/dibdrv/dc.c
View file @
c9bdcbaf
...
...
@@ -219,6 +219,13 @@ BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_f
BITMAPINFO
*
info
=
(
BITMAPINFO
*
)
buffer
;
get_ddb_bitmapinfo
(
bmp
,
info
);
if
(
!
bmp
->
bitmap
.
bmBits
)
{
int
width_bytes
=
get_dib_stride
(
bmp
->
bitmap
.
bmWidth
,
bmp
->
bitmap
.
bmBitsPixel
);
bmp
->
bitmap
.
bmBits
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
bmp
->
bitmap
.
bmHeight
*
width_bytes
);
if
(
!
bmp
->
bitmap
.
bmBits
)
return
FALSE
;
}
return
init_dib_info_from_bitmapinfo
(
dib
,
info
,
bmp
->
bitmap
.
bmBits
,
flags
|
private_color_table
);
}
...
...
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