View | Details | Raw Unified | Return to issue 119118
Collapse All | Expand All

(-)b2dsvgpolypolygon.cxx.orig (-30 / +41 lines)
Lines 271-279 Link Here
271
            o_rPolyPolygon.clear();
271
            o_rPolyPolygon.clear();
272
            const sal_Int32 nLen(rSvgDStatement.getLength());
272
            const sal_Int32 nLen(rSvgDStatement.getLength());
273
            sal_Int32 nPos(0);
273
            sal_Int32 nPos(0);
274
            bool bIsClosed(false);
275
            double nLastX( 0.0 );
274
            double nLastX( 0.0 );
276
            double nLastY( 0.0 );
275
            double nLastY( 0.0 );
276
            bool bhasCloseAsPredecessor(false);
277
			B2DPolygon aCurrPoly;
277
			B2DPolygon aCurrPoly;
278
278
279
			// skip initial whitespace
279
			// skip initial whitespace
Lines 290-300 Link Here
290
                    case 'z' :
290
                    case 'z' :
291
                    case 'Z' :
291
                    case 'Z' :
292
                    {
292
                    {
293
                        B2DPoint aSubpathStart=aCurrPoly.getB2DPoint(0);
294
                        nLastX = aSubpathStart.getX();
295
                        nLastY = aSubpathStart.getY();
296
                        if(aCurrPoly.count() && !bhasCloseAsPredecessor)
297
                        {
298
                            closeWithGeometryChange(aCurrPoly);
299
                            o_rPolyPolygon.append(aCurrPoly);
300
                        }
301
                        aCurrPoly.clear();
302
                        // add current point as start of new subpath, it may
303
                        // happen that there is no following moveto
304
                        aCurrPoly.append(aSubpathStart);
305
                        // remember, that aCurrPoly already append in case z,Z
306
                        bhasCloseAsPredecessor = true;
293
                        nPos++;
307
                        nPos++;
294
                        lcl_skipSpaces(nPos, rSvgDStatement, nLen);
308
                        lcl_skipSpaces(nPos, rSvgDStatement, nLen);
295
309
296
                        // remember closed state of current polygon
297
                        bIsClosed = true;
298
                        break;
310
                        break;
299
                    }
311
                    }
300
				
312
				
Lines 302-336 Link Here
302
                    case 'M' :
314
                    case 'M' :
303
                    {
315
                    {
304
                        bMoveTo = true;
316
                        bMoveTo = true;
305
                        // FALLTHROUGH intended
317
                        if('m' == aCurrChar)
318
                        {
319
                            bRelative = true;
320
                        }
321
                        
322
                        // new polygon start, finish old one
323
                        if (!bhasCloseAsPredecessor && aCurrPoly.count())
324
                        {
325
                            o_rPolyPolygon.append(aCurrPoly);
326
                        }
327
328
                        // start new polygon
329
                        aCurrPoly.clear();
330
331
                        // FALLTHROUGH intended, line commands after moveto without l or L character
306
                    }
332
                    }
307
                    case 'l' :
333
                    case 'l' :
308
                    case 'L' :
334
                    case 'L' :
309
                    {
335
                    {
310
                        if('m' == aCurrChar || 'l' == aCurrChar)
336
                        if('l' == aCurrChar)
311
						{
337
						{
312
                            bRelative = true;
338
                            bRelative = true;
313
						}
339
						}
314
340
315
                        if(bMoveTo)
316
                        {
317
							// new polygon start, finish old one
318
                            if(aCurrPoly.count())
319
                            {
320
								// add current polygon
321
								if(bIsClosed)
322
								{
323
									closeWithGeometryChange(aCurrPoly);
324
								}
325
                                
326
								o_rPolyPolygon.append(aCurrPoly);
327
                                
328
								// reset import values
329
								bIsClosed = false;
330
                                aCurrPoly.clear();
331
                            }
332
                        }
333
334
                        nPos++;
341
                        nPos++;
335
                        lcl_skipSpaces(nPos, rSvgDStatement, nLen);
342
                        lcl_skipSpaces(nPos, rSvgDStatement, nLen);
336
343
Lines 354-359 Link Here
354
                            // add point
361
                            // add point
355
                            aCurrPoly.append(B2DPoint(nX, nY));
362
                            aCurrPoly.append(B2DPoint(nX, nY));
356
                        }
363
                        }
364
                        bhasCloseAsPredecessor = false;
357
                        break;
365
                        break;
358
                    }
366
                    }
359
367
Lines 384-389 Link Here
384
                            // add point
392
                            // add point
385
                            aCurrPoly.append(B2DPoint(nX, nY));
393
                            aCurrPoly.append(B2DPoint(nX, nY));
386
                        }
394
                        }
395
                        bhasCloseAsPredecessor = false;
387
                        break;
396
                        break;
388
                    }
397
                    }
389
				
398
				
Lines 414-419 Link Here
414
                            // add point
423
                            // add point
415
                            aCurrPoly.append(B2DPoint(nX, nY));
424
                            aCurrPoly.append(B2DPoint(nX, nY));
416
                        }
425
                        }
426
                        bhasCloseAsPredecessor = false;
417
                        break;
427
                        break;
418
                    }
428
                    }
419
				
429
				
Lines 473-478 Link Here
473
                            nLastX = nX;
483
                            nLastX = nX;
474
                            nLastY = nY;
484
                            nLastY = nY;
475
                        }
485
                        }
486
                        bhasCloseAsPredecessor = false;
476
                        break;
487
                        break;
477
                    }
488
                    }
478
				
489
				
Lines 522-527 Link Here
522
                            nLastX = nX;
533
                            nLastX = nX;
523
                            nLastY = nY;
534
                            nLastY = nY;
524
                        }
535
                        }
536
                        bhasCloseAsPredecessor = false;
525
                        break;
537
                        break;
526
                    }
538
                    }
527
				
539
				
Lines 573-578 Link Here
573
                            nLastX = nX;
585
                            nLastX = nX;
574
                            nLastY = nY;
586
                            nLastY = nY;
575
                        }
587
                        }
588
                        bhasCloseAsPredecessor = false;
576
                        break;
589
                        break;
577
                    }
590
                    }
578
				
591
				
Lines 648-653 Link Here
648
                            nLastX = nX;
661
                            nLastX = nX;
649
                            nLastY = nY;
662
                            nLastY = nY;
650
                        }
663
                        }
664
                        bhasCloseAsPredecessor = false;
651
                        break;
665
                        break;
652
                    }
666
                    }
653
667
Lines 823-828 Link Here
823
                            nLastX = nX;
837
                            nLastX = nX;
824
                            nLastY = nY;
838
                            nLastY = nY;
825
                        }
839
                        }
840
                        bhasCloseAsPredecessor = false;
826
                        break;
841
                        break;
827
                    }
842
                    }
828
843
Lines 831-849 Link Here
831
                        OSL_ENSURE(false, "importFromSvgD(): skipping tags in svg:d element (unknown)!");
846
                        OSL_ENSURE(false, "importFromSvgD(): skipping tags in svg:d element (unknown)!");
832
                        OSL_TRACE("importFromSvgD(): skipping tags in svg:d element (unknown: \"%c\")!", aCurrChar);
847
                        OSL_TRACE("importFromSvgD(): skipping tags in svg:d element (unknown: \"%c\")!", aCurrChar);
833
                        ++nPos;
848
                        ++nPos;
849
                        bhasCloseAsPredecessor = false;
834
                        break;
850
                        break;
835
                    }
851
                    }
836
                }
852
                }
837
            }
853
            }
838
854
839
            if(aCurrPoly.count())
855
            if(aCurrPoly.count() && !bhasCloseAsPredecessor)
840
            {
856
            {
841
                // end-process last poly
857
                // end-process last poly
842
				if(bIsClosed)
843
				{
844
					closeWithGeometryChange(aCurrPoly);
845
				}
846
847
				o_rPolyPolygon.append(aCurrPoly);
858
				o_rPolyPolygon.append(aCurrPoly);
848
            }
859
            }
849
860

Return to issue 119118