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
cae4ef81
Commit
cae4ef81
authored
Dec 12, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: init_dib_info() can no longer fail, and no longer requires freeing.
parent
d357392b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
63 deletions
+31
-63
bitblt.c
dlls/gdi32/dibdrv/bitblt.c
+10
-32
dc.c
dlls/gdi32/dibdrv/dc.c
+17
-22
dibdrv.h
dlls/gdi32/dibdrv/dibdrv.h
+3
-5
graphics.c
dlls/gdi32/dibdrv/graphics.c
+1
-2
objects.c
dlls/gdi32/dibdrv/objects.c
+0
-2
No files found.
dlls/gdi32/dibdrv/bitblt.c
View file @
cae4ef81
...
...
@@ -881,7 +881,7 @@ DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
if
(
!
bmp
)
return
ERROR_INVALID_HANDLE
;
if
(
!
init_dib_info_from_bitmapobj
(
&
stand_alone
,
bmp
,
0
))
{
ret
=
ERROR_
BAD_FORMAT
;
ret
=
ERROR_
OUTOFMEMORY
;
goto
done
;
}
dib
=
&
stand_alone
;
...
...
@@ -909,12 +909,7 @@ DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
}
done:
if
(
hbitmap
)
{
if
(
dib
)
free_dib_info
(
dib
);
GDI_ReleaseObj
(
hbitmap
);
}
if
(
hbitmap
)
GDI_ReleaseObj
(
hbitmap
);
return
ret
;
}
...
...
@@ -984,7 +979,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
if
(
!
bmp
)
return
ERROR_INVALID_HANDLE
;
if
(
!
init_dib_info_from_bitmapobj
(
&
stand_alone
,
bmp
,
0
))
{
ret
=
ERROR_
BAD_FORMAT
;
ret
=
ERROR_
OUTOFMEMORY
;
goto
done
;
}
dib
=
&
stand_alone
;
...
...
@@ -1029,10 +1024,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
ret
=
execute_rop
(
pdev
,
&
dst
->
visrect
,
&
src_dib
,
&
src
->
visrect
,
clip
,
rop
);
}
free_dib_info
(
&
src_dib
);
if
(
saved_clip
)
restore_clipping_region
(
pdev
,
saved_clip
);
goto
done
;
update_format:
...
...
@@ -1042,12 +1034,7 @@ update_format:
ret
=
ERROR_BAD_FORMAT
;
done:
if
(
hbitmap
)
{
if
(
dib
)
free_dib_info
(
dib
);
GDI_ReleaseObj
(
hbitmap
);
}
if
(
hbitmap
)
GDI_ReleaseObj
(
hbitmap
);
return
ret
;
}
...
...
@@ -1059,7 +1046,6 @@ DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_b
{
dibdrv_physdev
*
pdev
=
get_dibdrv_pdev
(
dev
);
dib_info
src_dib
;
DWORD
ret
;
TRACE
(
"%p %p
\n
"
,
dev
,
info
);
...
...
@@ -1077,11 +1063,7 @@ DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct gdi_image_b
init_dib_info_from_bitmapinfo
(
&
src_dib
,
info
,
bits
->
ptr
,
0
);
src_dib
.
bits
.
is_copy
=
bits
->
is_copy
;
ret
=
blend_rect
(
&
pdev
->
dib
,
&
dst
->
visrect
,
&
src_dib
,
&
src
->
visrect
,
pdev
->
clip
,
blend
);
free_dib_info
(
&
src_dib
);
return
ret
;
return
blend_rect
(
&
pdev
->
dib
,
&
dst
->
visrect
,
&
src_dib
,
&
src
->
visrect
,
pdev
->
clip
,
blend
);
update_format:
if
(
blend
.
AlphaFormat
&
AC_SRC_ALPHA
)
/* source alpha requires A8R8G8B8 format */
...
...
@@ -1220,10 +1202,8 @@ DWORD stretch_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
dst
->
x
,
dst
->
y
,
dst
->
width
,
dst
->
height
,
wine_dbgstr_rect
(
&
dst
->
visrect
),
src
->
x
,
src
->
y
,
src
->
width
,
src
->
height
,
wine_dbgstr_rect
(
&
src
->
visrect
));
if
(
!
init_dib_info_from_bitmapinfo
(
&
src_dib
,
src_info
,
src_bits
,
0
)
)
return
ERROR_BAD_FORMAT
;
if
(
!
init_dib_info_from_bitmapinfo
(
&
dst_dib
,
dst_info
,
dst_bits
,
0
)
)
return
ERROR_BAD_FORMAT
;
init_dib_info_from_bitmapinfo
(
&
src_dib
,
src_info
,
src_bits
,
0
);
init_dib_info_from_bitmapinfo
(
&
dst_dib
,
dst_info
,
dst_bits
,
0
);
/* v */
ret
=
calc_1d_stretch_params
(
dst
->
y
,
dst
->
height
,
dst
->
visrect
.
top
,
dst
->
visrect
.
bottom
,
...
...
@@ -1324,10 +1304,8 @@ DWORD blend_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitbl
{
dib_info
src_dib
,
dst_dib
;
if
(
!
init_dib_info_from_bitmapinfo
(
&
src_dib
,
src_info
,
src_bits
,
0
)
)
return
ERROR_BAD_FORMAT
;
if
(
!
init_dib_info_from_bitmapinfo
(
&
dst_dib
,
dst_info
,
dst_bits
,
default_color_table
)
)
return
ERROR_BAD_FORMAT
;
init_dib_info_from_bitmapinfo
(
&
src_dib
,
src_info
,
src_bits
,
0
);
init_dib_info_from_bitmapinfo
(
&
dst_dib
,
dst_info
,
dst_bits
,
default_color_table
);
return
blend_rect
(
&
dst_dib
,
&
dst
->
visrect
,
&
src_dib
,
&
src
->
visrect
,
NULL
,
blend
);
}
...
...
@@ -1344,7 +1322,7 @@ DWORD gradient_bitmapinfo( const BITMAPINFO *info, void *bits, TRIVERTEX *vert_a
DWORD
ret
=
ERROR_SUCCESS
;
HRGN
tmp_rgn
=
0
;
i
f
(
!
init_dib_info_from_bitmapinfo
(
&
dib
,
info
,
bits
,
default_color_table
))
return
ERROR_BAD_FORMAT
;
i
nit_dib_info_from_bitmapinfo
(
&
dib
,
info
,
bits
,
default_color_table
)
;
switch
(
mode
)
{
...
...
dlls/gdi32/dibdrv/dc.c
View file @
cae4ef81
...
...
@@ -67,7 +67,7 @@ static void init_bit_fields(dib_info *dib, const DWORD *bit_fields)
calc_shift_and_len
(
dib
->
blue_mask
,
&
dib
->
blue_shift
,
&
dib
->
blue_len
);
}
static
BOOL
init_dib_info
(
dib_info
*
dib
,
const
BITMAPINFOHEADER
*
bi
,
const
DWORD
*
bit_fields
,
static
void
init_dib_info
(
dib_info
*
dib
,
const
BITMAPINFOHEADER
*
bi
,
const
DWORD
*
bit_fields
,
const
RGBQUAD
*
color_table
,
void
*
bits
,
enum
dib_info_flags
flags
)
{
dib
->
bit_count
=
bi
->
biBitCount
;
...
...
@@ -134,10 +134,6 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
case
1
:
dib
->
funcs
=
&
funcs_1
;
break
;
default:
TRACE
(
"bpp %d not supported, will forward to graphics driver.
\n
"
,
dib
->
bit_count
);
return
FALSE
;
}
if
(
color_table
&&
bi
->
biClrUsed
)
...
...
@@ -155,14 +151,11 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
dib
->
color_table
=
NULL
;
dib
->
color_table_size
=
0
;
}
return
TRUE
;
}
BOOL
init_dib_info_from_bitmapinfo
(
dib_info
*
dib
,
const
BITMAPINFO
*
info
,
void
*
bits
,
enum
dib_info_flags
flags
)
void
init_dib_info_from_bitmapinfo
(
dib_info
*
dib
,
const
BITMAPINFO
*
info
,
void
*
bits
,
enum
dib_info_flags
flags
)
{
return
init_dib_info
(
dib
,
&
info
->
bmiHeader
,
(
const
DWORD
*
)
info
->
bmiColors
,
info
->
bmiColors
,
bits
,
flags
);
init_dib_info
(
dib
,
&
info
->
bmiHeader
,
(
const
DWORD
*
)
info
->
bmiColors
,
info
->
bmiColors
,
bits
,
flags
);
}
BOOL
init_dib_info_from_bitmapobj
(
dib_info
*
dib
,
BITMAPOBJ
*
bmp
,
enum
dib_info_flags
flags
)
...
...
@@ -179,10 +172,11 @@ BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_f
bmp
->
bitmap
.
bmHeight
*
width_bytes
);
if
(
!
bmp
->
bitmap
.
bmBits
)
return
FALSE
;
}
return
init_dib_info_from_bitmapinfo
(
dib
,
&
info
,
bmp
->
bitmap
.
bmBits
,
flags
);
init_dib_info_from_bitmapinfo
(
dib
,
&
info
,
bmp
->
bitmap
.
bmBits
,
flags
);
}
return
init_dib_info
(
dib
,
&
bmp
->
dib
->
dsBmih
,
bmp
->
dib
->
dsBitfields
,
bmp
->
color_table
,
bmp
->
dib
->
dsBm
.
bmBits
,
flags
);
else
init_dib_info
(
dib
,
&
bmp
->
dib
->
dsBmih
,
bmp
->
dib
->
dsBitfields
,
bmp
->
color_table
,
bmp
->
dib
->
dsBm
.
bmBits
,
flags
);
return
TRUE
;
}
static
void
clear_dib_info
(
dib_info
*
dib
)
...
...
@@ -227,10 +221,8 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
dib_info
src_dib
,
dst_dib
;
DWORD
ret
;
if
(
!
init_dib_info_from_bitmapinfo
(
&
src_dib
,
src_info
,
src_bits
,
default_color_table
)
)
return
ERROR_BAD_FORMAT
;
if
(
!
init_dib_info_from_bitmapinfo
(
&
dst_dib
,
dst_info
,
dst_bits
,
default_color_table
)
)
return
ERROR_BAD_FORMAT
;
init_dib_info_from_bitmapinfo
(
&
src_dib
,
src_info
,
src_bits
,
default_color_table
);
init_dib_info_from_bitmapinfo
(
&
dst_dib
,
dst_info
,
dst_bits
,
default_color_table
);
__TRY
{
...
...
@@ -336,7 +328,6 @@ static BOOL dibdrv_DeleteDC( PHYSDEV dev )
TRACE
(
"(%p)
\n
"
,
dev
);
DeleteObject
(
pdev
->
clip
);
free_pattern_brush
(
pdev
);
free_dib_info
(
&
pdev
->
dib
);
HeapFree
(
GetProcessHeap
(),
0
,
pdev
);
return
TRUE
;
}
...
...
@@ -365,15 +356,19 @@ static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
PHYSDEV
next
=
GET_NEXT_PHYSDEV
(
dev
,
pSelectBitmap
);
dibdrv_physdev
*
pdev
=
get_dibdrv_pdev
(
dev
);
BITMAPOBJ
*
bmp
=
GDI_GetObjPtr
(
bitmap
,
OBJ_BITMAP
);
dib_info
dib
;
TRACE
(
"(%p, %p)
\n
"
,
dev
,
bitmap
);
if
(
!
bmp
)
return
0
;
free_dib_info
(
&
pdev
->
dib
);
if
(
!
init_dib_info_from_bitmapobj
(
&
dib
,
bmp
,
default_color_table
))
{
GDI_ReleaseObj
(
bitmap
);
return
0
;
}
pdev
->
dib
=
dib
;
pdev
->
defer
=
0
;
if
(
!
init_dib_info_from_bitmapobj
(
&
pdev
->
dib
,
bmp
,
default_color_table
))
pdev
->
defer
|=
DEFER_FORMAT
;
GDI_ReleaseObj
(
bitmap
);
return
next
->
funcs
->
pSelectBitmap
(
next
,
bitmap
);
...
...
dlls/gdi32/dibdrv/dibdrv.h
View file @
cae4ef81
...
...
@@ -111,7 +111,6 @@ typedef struct dibdrv_physdev
struct
intensity_range
glyph_intensities
[
17
];
}
dibdrv_physdev
;
#define DEFER_FORMAT 1
#define DEFER_PEN 2
#define DEFER_BRUSH 4
...
...
@@ -224,8 +223,7 @@ extern void get_rop_codes(INT rop, struct rop_codes *codes) DECLSPEC_HIDDEN;
extern
void
calc_and_xor_masks
(
INT
rop
,
DWORD
color
,
DWORD
*
and
,
DWORD
*
xor
)
DECLSPEC_HIDDEN
;
extern
void
update_brush_rop
(
dibdrv_physdev
*
pdev
,
INT
rop
)
DECLSPEC_HIDDEN
;
extern
void
reset_dash_origin
(
dibdrv_physdev
*
pdev
)
DECLSPEC_HIDDEN
;
extern
BOOL
init_dib_info_from_bitmapinfo
(
dib_info
*
dib
,
const
BITMAPINFO
*
info
,
void
*
bits
,
enum
dib_info_flags
flags
)
DECLSPEC_HIDDEN
;
extern
void
init_dib_info_from_bitmapinfo
(
dib_info
*
dib
,
const
BITMAPINFO
*
info
,
void
*
bits
,
enum
dib_info_flags
flags
)
DECLSPEC_HIDDEN
;
extern
BOOL
init_dib_info_from_bitmapobj
(
dib_info
*
dib
,
BITMAPOBJ
*
bmp
,
enum
dib_info_flags
flags
)
DECLSPEC_HIDDEN
;
extern
void
free_dib_info
(
dib_info
*
dib
)
DECLSPEC_HIDDEN
;
extern
void
free_pattern_brush
(
dibdrv_physdev
*
pdev
)
DECLSPEC_HIDDEN
;
...
...
@@ -252,10 +250,10 @@ static inline int edge_coord( int y, int x1, int y1, int x2, int y2 )
static
inline
BOOL
defer_pen
(
dibdrv_physdev
*
pdev
)
{
return
pdev
->
defer
&
(
DEFER_FORMAT
|
DEFER_PEN
)
;
return
pdev
->
defer
&
DEFER_PEN
;
}
static
inline
BOOL
defer_brush
(
dibdrv_physdev
*
pdev
)
{
return
pdev
->
defer
&
(
DEFER_FORMAT
|
DEFER_BRUSH
)
;
return
pdev
->
defer
&
DEFER_BRUSH
;
}
dlls/gdi32/dibdrv/graphics.c
View file @
cae4ef81
...
...
@@ -254,7 +254,7 @@ BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits
assert
(
info
->
bmiHeader
.
biBitCount
>
8
);
/* mono and indexed formats don't support anti-aliasing */
i
f
(
!
init_dib_info_from_bitmapinfo
(
&
dib
,
info
,
bits
->
ptr
,
0
))
return
FALSE
;
i
nit_dib_info_from_bitmapinfo
(
&
dib
,
info
,
bits
->
ptr
,
0
)
;
fg
=
make_rgb_colorref
(
hdc
,
&
dib
,
GetTextColor
(
hdc
),
&
got_pixel
,
&
fg_pixel
);
if
(
!
got_pixel
)
fg_pixel
=
dib
.
funcs
->
colorref_to_pixel
(
&
dib
,
fg
);
...
...
@@ -325,7 +325,6 @@ BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits
y
+=
metrics
.
gmCellIncY
;
}
}
free_dib_info
(
&
dib
);
return
TRUE
;
}
...
...
dlls/gdi32/dibdrv/objects.c
View file @
cae4ef81
...
...
@@ -1541,8 +1541,6 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, BOOL *needs_reselect )
pdev
->
brush_dib
.
funcs
->
convert_to
(
&
pdev
->
brush_dib
,
&
pattern
,
&
rect
);
}
free_dib_info
(
&
pattern
);
return
TRUE
;
}
...
...
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