pairs: allocate and manipulate dest polygon buffer directly
This commit is contained in:
parent
8f4104a9ab
commit
cabcf6cd29
@ -1757,10 +1757,10 @@ def arrayToQPath(x, y, connect='all', finiteCheck=True):
|
|||||||
if qt6:
|
if qt6:
|
||||||
if n % 2 == 1:
|
if n % 2 == 1:
|
||||||
arr = arr[:-1]
|
arr = arr[:-1]
|
||||||
nans = np.broadcast_to(np.nan, (n // 2, 1))
|
polygon = create_qpolygonf(n // 2 * 3)
|
||||||
xs = np.column_stack([arr['x'].reshape((-1, 2)), nans]).ravel()
|
dst = ndarray_from_qpolygonf(polygon).reshape((-1, 6)) # x0, y0, x1, y1, nan, nan
|
||||||
ys = np.column_stack([arr['y'].reshape((-1, 2)), nans]).ravel()
|
dst[:, :4] = np.frombuffer(arr, dtype=np.double).reshape((-1, 4)) # x0, y0, x1, y1
|
||||||
polygon = arrayToQPolygonF(xs, ys)
|
dst[:, 4:] = np.nan
|
||||||
path.addPolygon(polygon)
|
path.addPolygon(polygon)
|
||||||
return path
|
return path
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user