Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
9fe77b4d
Commit
9fe77b4d
authored
Aug 16, 2016
by
Huw Davies
Committed by
Alexandre Julliard
Aug 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Exponentially grow successive point buffers.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
77568fd0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
region.c
dlls/gdi32/region.c
+18
-16
No files found.
dlls/gdi32/region.c
View file @
9fe77b4d
...
@@ -173,31 +173,28 @@ static inline BOOL is_in_rect( const RECT *rect, int x, int y )
...
@@ -173,31 +173,28 @@ static inline BOOL is_in_rect( const RECT *rect, int x, int y )
}
}
/*
/*
* number of points to buffer before sending them off
* to scanlines() : Must be an even number
*/
#define NUMPTSTOBUFFER 200
/*
* used to allocate buffers for points and link
* used to allocate buffers for points and link
* the buffers together
* the buffers together
*/
*/
struct
point_block
struct
point_block
{
{
POINT
pts
[
NUMPTSTOBUFFER
];
int
count
,
size
;
int
count
;
struct
point_block
*
next
;
struct
point_block
*
next
;
POINT
pts
[
1
];
/* Variable sized array - must be last. */
};
};
static
struct
point_block
*
add_point
(
struct
point_block
*
block
,
int
x
,
int
y
)
static
struct
point_block
*
add_point
(
struct
point_block
*
block
,
int
x
,
int
y
)
{
{
if
(
block
->
count
==
NUMPTSTOBUFFER
)
if
(
block
->
count
==
block
->
size
)
{
{
struct
point_block
*
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
new
)
);
struct
point_block
*
new
;
int
size
=
block
->
size
*
2
;
new
=
HeapAlloc
(
GetProcessHeap
(),
0
,
FIELD_OFFSET
(
struct
point_block
,
pts
[
size
]
)
);
if
(
!
new
)
return
NULL
;
if
(
!
new
)
return
NULL
;
block
->
next
=
new
;
block
->
next
=
new
;
new
->
count
=
0
;
new
->
count
=
0
;
new
->
size
=
size
;
new
->
next
=
NULL
;
new
->
next
=
NULL
;
block
=
new
;
block
=
new
;
}
}
...
@@ -2676,6 +2673,9 @@ static WINEREGION *REGION_PtsToRegion( struct point_block *FirstPtBlock )
...
@@ -2676,6 +2673,9 @@ static WINEREGION *REGION_PtsToRegion( struct point_block *FirstPtBlock )
return
reg
;
return
reg
;
}
}
/* Number of points in the first point buffer. Must be an even number. */
#define NUMPTSTOBUFFER 200
/***********************************************************************
/***********************************************************************
* CreatePolyPolygonRgn (GDI32.@)
* CreatePolyPolygonRgn (GDI32.@)
*/
*/
...
@@ -2692,7 +2692,8 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
...
@@ -2692,7 +2692,8 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
EdgeTableEntry
*
pETEs
;
/* EdgeTableEntries pool */
EdgeTableEntry
*
pETEs
;
/* EdgeTableEntries pool */
ScanLineListBlock
SLLBlock
;
/* header for scanlinelist */
ScanLineListBlock
SLLBlock
;
/* header for scanlinelist */
BOOL
fixWAET
=
FALSE
;
BOOL
fixWAET
=
FALSE
;
struct
point_block
FirstPtBlock
,
*
block
;
/* PtBlock buffers */
char
first_blk_buf
[
FIELD_OFFSET
(
struct
point_block
,
pts
[
NUMPTSTOBUFFER
]
)];
struct
point_block
*
first_block
=
(
struct
point_block
*
)
first_blk_buf
,
*
block
;
struct
edge_table_entry
*
active
,
*
next
;
struct
edge_table_entry
*
active
,
*
next
;
INT
poly
,
total
;
INT
poly
,
total
;
...
@@ -2721,9 +2722,10 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
...
@@ -2721,9 +2722,10 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
REGION_CreateEdgeTable
(
Count
,
nbpolygons
,
Pts
,
&
ET
,
pETEs
,
&
SLLBlock
);
REGION_CreateEdgeTable
(
Count
,
nbpolygons
,
Pts
,
&
ET
,
pETEs
,
&
SLLBlock
);
list_init
(
&
AET
);
list_init
(
&
AET
);
pSLL
=
ET
.
scanlines
.
next
;
pSLL
=
ET
.
scanlines
.
next
;
block
=
&
FirstPtBlock
;
block
=
first_block
;
FirstPtBlock
.
count
=
0
;
first_block
->
count
=
0
;
FirstPtBlock
.
next
=
NULL
;
first_block
->
size
=
NUMPTSTOBUFFER
;
first_block
->
next
=
NULL
;
if
(
mode
!=
WINDING
)
{
if
(
mode
!=
WINDING
)
{
/*
/*
...
@@ -2802,13 +2804,13 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
...
@@ -2802,13 +2804,13 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
}
}
}
}
if
(
!
(
obj
=
REGION_PtsToRegion
(
&
FirstPtB
lock
)))
goto
done
;
if
(
!
(
obj
=
REGION_PtsToRegion
(
first_b
lock
)))
goto
done
;
if
(
!
(
hrgn
=
alloc_gdi_handle
(
obj
,
OBJ_REGION
,
&
region_funcs
)))
if
(
!
(
hrgn
=
alloc_gdi_handle
(
obj
,
OBJ_REGION
,
&
region_funcs
)))
free_region
(
obj
);
free_region
(
obj
);
done:
done:
REGION_FreeStorage
(
SLLBlock
.
next
);
REGION_FreeStorage
(
SLLBlock
.
next
);
free_point_blocks
(
FirstPtBlock
.
next
);
free_point_blocks
(
first_block
->
next
);
HeapFree
(
GetProcessHeap
(),
0
,
pETEs
);
HeapFree
(
GetProcessHeap
(),
0
,
pETEs
);
return
hrgn
;
return
hrgn
;
}
}
...
...
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