Alexandre Julliard : gdi32: Map all the points at once in PolyPolyline, similarly to what PolyPolygon does.
Alexandre Julliard
julliard at winehq.org
Fri Apr 13 11:03:21 CDT 2012
Module: wine
Branch: master
Commit: ea5fa7ddbef2ac8bbbfc12fee12a1761573d99a7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ea5fa7ddbef2ac8bbbfc12fee12a1761573d99a7
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Apr 13 13:39:06 2012 +0200
gdi32: Map all the points at once in PolyPolyline, similarly to what PolyPolygon does.
---
dlls/gdi32/dibdrv/graphics.c | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index 5cffeac..d29c405 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -949,19 +949,21 @@ BOOL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts, DWORD
BOOL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWORD polylines )
{
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
- DWORD max_points = 0, i;
+ DWORD total, pos, i;
POINT *points;
BOOL ret = TRUE;
HRGN outline = 0;
- for (i = 0; i < polylines; i++)
+ for (i = total = 0; i < polylines; i++)
{
if (counts[i] < 2) return FALSE;
- max_points = max( counts[i], max_points );
+ total += counts[i];
}
- points = HeapAlloc( GetProcessHeap(), 0, max_points * sizeof(*pt) );
+ points = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*pt) );
if (!points) return FALSE;
+ memcpy( points, pt, total * sizeof(*pt) );
+ LPtoDP( dev->hdc, points, total );
if (pdev->pen_uses_region && !(outline = CreateRectRgn( 0, 0, 0, 0 )))
{
@@ -969,14 +971,11 @@ BOOL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO
return FALSE;
}
- for (i = 0; i < polylines; i++)
+ for (i = pos = 0; i < polylines; i++)
{
- memcpy( points, pt, counts[i] * sizeof(*pt) );
- pt += counts[i];
- LPtoDP( dev->hdc, points, counts[i] );
-
reset_dash_origin( pdev );
- pdev->pen_lines( pdev, counts[i], points, FALSE, outline );
+ pdev->pen_lines( pdev, counts[i], points + pos, FALSE, outline );
+ pos += counts[i];
}
if (outline)
More information about the wine-cvs
mailing list