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
574a07e4
Commit
574a07e4
authored
May 22, 2012
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a helper function to allocate the brush bits.
parent
b708b401
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
35 deletions
+22
-35
objects.c
dlls/gdi32/dibdrv/objects.c
+22
-35
No files found.
dlls/gdi32/dibdrv/objects.c
View file @
574a07e4
...
...
@@ -1732,17 +1732,28 @@ static BOOL solid_brush(dibdrv_physdev *pdev, dib_brush *brush, dib_info *dib,
return
TRUE
;
}
static
void
free_pattern_brush_bits
(
dib_brush
*
brush
)
static
BOOL
alloc_brush_mask_bits
(
dib_brush
*
brush
)
{
DWORD
size
=
brush
->
dib
.
height
*
abs
(
brush
->
dib
.
stride
);
assert
(
brush
->
masks
.
and
==
NULL
);
assert
(
brush
->
masks
.
xor
==
NULL
);
assert
(
brush
->
dib
.
stride
>
0
);
if
(
!
(
brush
->
masks
.
and
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
size
)))
return
FALSE
;
brush
->
masks
.
xor
=
(
char
*
)
brush
->
masks
.
and
+
size
;
return
TRUE
;
}
static
void
free_brush_mask_bits
(
dib_brush
*
brush
)
{
HeapFree
(
GetProcessHeap
(),
0
,
brush
->
masks
.
and
);
HeapFree
(
GetProcessHeap
(),
0
,
brush
->
masks
.
xor
);
brush
->
masks
.
and
=
NULL
;
brush
->
masks
.
xor
=
NULL
;
brush
->
masks
.
and
=
brush
->
masks
.
xor
=
NULL
;
}
void
free_pattern_brush
(
dib_brush
*
brush
)
{
free_
pattern_brush
_bits
(
brush
);
free_
brush_mask
_bits
(
brush
);
free_dib_info
(
&
brush
->
dib
);
}
...
...
@@ -1752,20 +1763,10 @@ static BOOL create_pattern_brush_bits( dib_brush *brush )
DWORD
*
brush_bits
=
brush
->
dib
.
bits
.
ptr
;
DWORD
*
and_bits
,
*
xor_bits
;
assert
(
brush
->
masks
.
and
==
NULL
);
assert
(
brush
->
masks
.
xor
==
NULL
);
assert
(
brush
->
dib
.
stride
>
0
);
and_bits
=
brush
->
masks
.
and
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
xor_bits
=
brush
->
masks
.
xor
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
alloc_brush_mask_bits
(
brush
))
return
FALSE
;
if
(
!
and_bits
||
!
xor_bits
)
{
ERR
(
"Failed to create pattern brush bits
\n
"
);
free_pattern_brush_bits
(
brush
);
return
FALSE
;
}
and_bits
=
brush
->
masks
.
and
;
xor_bits
=
brush
->
masks
.
xor
;
while
(
size
)
{
...
...
@@ -1790,12 +1791,8 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL
{
dib_info
hatch
;
rop_mask
fg_mask
,
bg_mask
;
DWORD
size
;
BOOL
ret
;
assert
(
brush
->
masks
.
and
==
NULL
);
assert
(
brush
->
masks
.
xor
==
NULL
);
/* Just initialise brush dib with the color / sizing info. We don't
need the bits as we'll calculate the rop masks straight from
the hatch patterns. */
...
...
@@ -1809,17 +1806,7 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL
brush
->
dib
.
rect
.
right
=
8
;
brush
->
dib
.
rect
.
bottom
=
8
;
size
=
brush
->
dib
.
height
*
brush
->
dib
.
stride
;
brush
->
masks
.
and
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
brush
->
masks
.
xor
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
brush
->
masks
.
and
||
!
brush
->
masks
.
xor
)
{
ERR
(
"Failed to create pattern brush bits
\n
"
);
free_pattern_brush_bits
(
brush
);
return
FALSE
;
}
if
(
!
alloc_brush_mask_bits
(
brush
))
return
FALSE
;
hatch
.
bit_count
=
1
;
hatch
.
height
=
hatch
.
width
=
8
;
...
...
@@ -1841,7 +1828,7 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL
*
needs_reselect
=
TRUE
;
ret
=
brush
->
dib
.
funcs
->
create_rop_masks
(
&
brush
->
dib
,
&
hatch
,
&
fg_mask
,
&
bg_mask
,
&
brush
->
masks
);
if
(
!
ret
)
free_
pattern_brush
_bits
(
brush
);
if
(
!
ret
)
free_
brush_mask
_bits
(
brush
);
return
ret
;
}
...
...
@@ -1961,7 +1948,7 @@ static BOOL pattern_brush(dibdrv_physdev *pdev, dib_brush *brush, dib_info *dib,
if
(
rop
!=
brush
->
rop
)
{
free_
pattern_brush
_bits
(
brush
);
free_
brush_mask
_bits
(
brush
);
brush
->
rop
=
rop
;
}
...
...
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