@@ -323,13 +323,17 @@ PATH_ReserveEntries(
323323 pPointsNew = (POINT * )ExAllocatePoolWithTag (PagedPool , numEntriesToAllocate * sizeof (POINT ), TAG_PATH );
324324 if (!pPointsNew )
325325 return FALSE;
326+ else
327+ memset (pPointsNew , 0 , numEntriesToAllocate * sizeof (POINT ));
326328
327329 pFlagsNew = (BYTE * )ExAllocatePoolWithTag (PagedPool , numEntriesToAllocate * sizeof (BYTE ), TAG_PATH );
328330 if (!pFlagsNew )
329331 {
330332 ExFreePoolWithTag (pPointsNew , TAG_PATH );
331333 return FALSE;
332334 }
335+ else
336+ memset (pFlagsNew , 0 , numEntriesToAllocate * sizeof (BYTE ));
333337
334338 /* Copy old arrays to new arrays and discard old arrays */
335339 if (pPath -> pPoints )
@@ -461,15 +465,25 @@ PATH_CheckRect(
461465/* add a number of points, converting them to device coords */
462466/* return a pointer to the first type byte so it can be fixed up if necessary */
463467static BYTE * add_log_points ( DC * dc , PPATH path , const POINT * points ,
464- DWORD count , BYTE type )
468+ DWORD count , BYTE type , BOOL bExtraPt )
465469{
466470 BYTE * ret ;
467471
468472 if (!PATH_ReserveEntries ( path , path -> numEntriesUsed + count )) return NULL ;
469473
470474 ret = & path -> pFlags [path -> numEntriesUsed ];
471- memcpy ( & path -> pPoints [path -> numEntriesUsed ], points , count * sizeof (* points ) );
472- IntLPtoDP ( dc , & path -> pPoints [path -> numEntriesUsed ], count );
475+
476+ if (bExtraPt && path -> numEntriesUsed == 1 )
477+ {
478+ memcpy ( & path -> pPoints [0 ], points , (count + 1 ) * sizeof (* points ) );
479+ IntLPtoDP ( dc , & path -> pPoints [0 ], count + 1 );
480+ }
481+ else
482+ {
483+ memcpy ( & path -> pPoints [path -> numEntriesUsed ], points , count * sizeof (* points ) );
484+ IntLPtoDP ( dc , & path -> pPoints [path -> numEntriesUsed ], count );
485+ }
486+
473487 memset ( ret , type , count );
474488 path -> numEntriesUsed += count ;
475489 return ret ;
@@ -531,10 +545,10 @@ static void close_figure( PPATH path )
531545
532546/* add a number of points, starting a new stroke if necessary */
533547static BOOL add_log_points_new_stroke ( DC * dc , PPATH path , const POINT * points ,
534- DWORD count , BYTE type )
548+ DWORD count , BYTE type , BOOL bExtraPt )
535549{
536550 if (!start_new_stroke ( path )) return FALSE;
537- if (!add_log_points ( dc , path , points , count , type )) return FALSE;
551+ if (!add_log_points ( dc , path , points , count , type , bExtraPt )) return FALSE;
538552 update_current_pos ( path );
539553
540554 TRACE ("ALPNS : Pos X %d Y %d\n" ,path -> pos .x , path -> pos .y );
@@ -612,7 +626,7 @@ PATH_LineTo(
612626 }
613627 }
614628 }
615- Ret = add_log_points_new_stroke ( dc , pPath , & point , 1 , PT_LINETO );
629+ Ret = add_log_points_new_stroke ( dc , pPath , & point , 1 , PT_LINETO , FALSE );
616630 PATH_UnlockPath (pPath );
617631 return Ret ;
618632}
@@ -1143,7 +1157,7 @@ PATH_PolyBezierTo(
11431157 pPath = PATH_LockPath (dc -> dclevel .hPath );
11441158 if (!pPath ) return FALSE;
11451159
1146- ret = add_log_points_new_stroke ( dc , pPath , pts , cbPoints , PT_BEZIERTO );
1160+ ret = add_log_points_new_stroke ( dc , pPath , pts , cbPoints , PT_BEZIERTO , TRUE );
11471161
11481162 PATH_UnlockPath (pPath );
11491163 return ret ;
@@ -1166,7 +1180,7 @@ PATH_PolyBezier(
11661180 pPath = PATH_LockPath (dc -> dclevel .hPath );
11671181 if (!pPath ) return FALSE;
11681182
1169- type = add_log_points ( dc , pPath , pts , cbPoints , PT_BEZIERTO );
1183+ type = add_log_points ( dc , pPath , pts , cbPoints , PT_BEZIERTO , FALSE );
11701184 if (!type ) return FALSE;
11711185
11721186 type [0 ] = PT_MOVETO ;
@@ -1217,7 +1231,7 @@ PATH_PolyDraw(
12171231 break ;
12181232 case PT_LINETO :
12191233 case PT_LINETO | PT_CLOSEFIGURE :
1220- if (!add_log_points_new_stroke ( dc , pPath , & pts [i ], 1 , PT_LINETO ))
1234+ if (!add_log_points_new_stroke ( dc , pPath , & pts [i ], 1 , PT_LINETO , FALSE ))
12211235 {
12221236 PATH_UnlockPath (pPath );
12231237 return FALSE;
@@ -1227,7 +1241,7 @@ PATH_PolyDraw(
12271241 if ((i + 2 < cbPoints ) && (types [i + 1 ] == PT_BEZIERTO ) &&
12281242 (types [i + 2 ] & ~PT_CLOSEFIGURE ) == PT_BEZIERTO )
12291243 {
1230- if (!add_log_points_new_stroke ( dc , pPath , & pts [i ], 3 , PT_BEZIERTO ))
1244+ if (!add_log_points_new_stroke ( dc , pPath , & pts [i ], 3 , PT_BEZIERTO , FALSE ))
12311245 {
12321246 PATH_UnlockPath (pPath );
12331247 return FALSE;
@@ -1278,7 +1292,10 @@ PATH_PolylineTo(
12781292 pPath = PATH_LockPath (dc -> dclevel .hPath );
12791293 if (!pPath ) return FALSE;
12801294
1281- ret = add_log_points_new_stroke ( dc , pPath , pts , cbPoints , PT_LINETO );
1295+ if (pPath -> newStroke )
1296+ cbPoints -- ;
1297+
1298+ ret = add_log_points_new_stroke ( dc , pPath , pts , cbPoints , PT_LINETO , TRUE);
12821299 PATH_UnlockPath (pPath );
12831300 return ret ;
12841301}
@@ -1316,7 +1333,7 @@ PATH_PolyPolygon(
13161333 count += counts [poly ];
13171334 }
13181335
1319- type = add_log_points ( dc , pPath , pts , count , PT_LINETO );
1336+ type = add_log_points ( dc , pPath , pts , count , PT_LINETO , FALSE );
13201337 if (!type )
13211338 {
13221339 PATH_UnlockPath (pPath );
0 commit comments