regband.cxx (9f62ea84) | regband.cxx (e6f63103) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 45 unchanged lines hidden (view full) --- 54 mnYTop = nTop; 55 mnYBottom = nBottom; 56 57 // initialize lists 58 mpNextBand = NULL; 59 mpPrevBand = NULL; 60 mpFirstSep = NULL; 61 mpFirstBandPoint = NULL; | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 45 unchanged lines hidden (view full) --- 54 mnYTop = nTop; 55 mnYBottom = nBottom; 56 57 // initialize lists 58 mpNextBand = NULL; 59 mpPrevBand = NULL; 60 mpFirstSep = NULL; 61 mpFirstBandPoint = NULL; |
62 mbTouched = sal_False; | 62 mbTouched = false; |
63} 64 65// ----------------------------------------------------------------------- 66 67ImplRegionBand::ImplRegionBand( 68 const ImplRegionBand& rRegionBand, 69 const bool bIgnorePoints) 70{ --- 132 unchanged lines hidden (view full) --- 203 mpFirstBandPoint = NULL; 204} 205 206// ----------------------------------------------------------------------- 207// 208// generate separations from lines and process union with existing 209// separations 210 | 63} 64 65// ----------------------------------------------------------------------- 66 67ImplRegionBand::ImplRegionBand( 68 const ImplRegionBand& rRegionBand, 69 const bool bIgnorePoints) 70{ --- 132 unchanged lines hidden (view full) --- 203 mpFirstBandPoint = NULL; 204} 205 206// ----------------------------------------------------------------------- 207// 208// generate separations from lines and process union with existing 209// separations 210 |
211sal_Bool ImplRegionBand::InsertPoint( long nX, long nLineId, 212 sal_Bool bEndPoint, LineType eLineType ) | 211bool ImplRegionBand::InsertPoint( long nX, long nLineId, 212 bool bEndPoint, LineType eLineType ) |
213{ 214 if ( !mpFirstBandPoint ) 215 { 216 mpFirstBandPoint = new ImplRegionBandPoint; 217 mpFirstBandPoint->mnX = nX; 218 mpFirstBandPoint->mnLineId = nLineId; 219 mpFirstBandPoint->mbEndPoint = bEndPoint; 220 mpFirstBandPoint->meLineType = eLineType; 221 mpFirstBandPoint->mpNextBandPoint = NULL; | 213{ 214 if ( !mpFirstBandPoint ) 215 { 216 mpFirstBandPoint = new ImplRegionBandPoint; 217 mpFirstBandPoint->mnX = nX; 218 mpFirstBandPoint->mnLineId = nLineId; 219 mpFirstBandPoint->mbEndPoint = bEndPoint; 220 mpFirstBandPoint->meLineType = eLineType; 221 mpFirstBandPoint->mpNextBandPoint = NULL; |
222 return sal_True; | 222 return true; |
223 } 224 225 // look if line allready touched the band 226 ImplRegionBandPoint* pRegionBandPoint = mpFirstBandPoint; 227 ImplRegionBandPoint* pLastTestedRegionBandPoint = NULL; 228 while( pRegionBandPoint ) 229 { 230 if ( pRegionBandPoint->mnLineId == nLineId ) 231 { 232 if ( bEndPoint ) 233 { 234 if( !pRegionBandPoint->mbEndPoint ) 235 { 236 // remove old band point 237 if( !mpFirstBandPoint->mpNextBandPoint ) 238 { 239 // if we've only got one point => replace first point 240 pRegionBandPoint->mnX = nX; | 223 } 224 225 // look if line allready touched the band 226 ImplRegionBandPoint* pRegionBandPoint = mpFirstBandPoint; 227 ImplRegionBandPoint* pLastTestedRegionBandPoint = NULL; 228 while( pRegionBandPoint ) 229 { 230 if ( pRegionBandPoint->mnLineId == nLineId ) 231 { 232 if ( bEndPoint ) 233 { 234 if( !pRegionBandPoint->mbEndPoint ) 235 { 236 // remove old band point 237 if( !mpFirstBandPoint->mpNextBandPoint ) 238 { 239 // if we've only got one point => replace first point 240 pRegionBandPoint->mnX = nX; |
241 pRegionBandPoint->mbEndPoint = sal_True; 242 return sal_True; | 241 pRegionBandPoint->mbEndPoint = true; 242 return true; |
243 } 244 else 245 { 246 // remove current point 247 if( !pLastTestedRegionBandPoint ) 248 { 249 // remove and delete old first point 250 ImplRegionBandPoint* pSaveBandPoint = mpFirstBandPoint; --- 7 unchanged lines hidden (view full) --- 258 delete pRegionBandPoint; 259 } 260 261 break; 262 } 263 } 264 } 265 else | 243 } 244 else 245 { 246 // remove current point 247 if( !pLastTestedRegionBandPoint ) 248 { 249 // remove and delete old first point 250 ImplRegionBandPoint* pSaveBandPoint = mpFirstBandPoint; --- 7 unchanged lines hidden (view full) --- 258 delete pRegionBandPoint; 259 } 260 261 break; 262 } 263 } 264 } 265 else |
266 return sal_False; | 266 return false; |
267 } 268 269 // use next element 270 pLastTestedRegionBandPoint = pRegionBandPoint; 271 pRegionBandPoint = pRegionBandPoint->mpNextBandPoint; 272 } 273 274 // search appropriate position and insert point into the list --- 14 unchanged lines hidden (view full) --- 289 pNewRegionBandPoint->mpNextBandPoint = pRegionBandPoint; 290 291 // connections to the new point 292 if ( !pLastTestedRegionBandPoint ) 293 mpFirstBandPoint = pNewRegionBandPoint; 294 else 295 pLastTestedRegionBandPoint->mpNextBandPoint = pNewRegionBandPoint; 296 | 267 } 268 269 // use next element 270 pLastTestedRegionBandPoint = pRegionBandPoint; 271 pRegionBandPoint = pRegionBandPoint->mpNextBandPoint; 272 } 273 274 // search appropriate position and insert point into the list --- 14 unchanged lines hidden (view full) --- 289 pNewRegionBandPoint->mpNextBandPoint = pRegionBandPoint; 290 291 // connections to the new point 292 if ( !pLastTestedRegionBandPoint ) 293 mpFirstBandPoint = pNewRegionBandPoint; 294 else 295 pLastTestedRegionBandPoint->mpNextBandPoint = pNewRegionBandPoint; 296 |
297 return sal_True; | 297 return true; |
298 } 299 300 // use next element 301 pLastTestedRegionBandPoint = pRegionBandPoint; 302 pRegionBandPoint = pRegionBandPoint->mpNextBandPoint; 303 } 304 305 // not inserted -> add to the end of the list 306 pNewRegionBandPoint = new ImplRegionBandPoint; 307 pNewRegionBandPoint->mnX = nX; 308 pNewRegionBandPoint->mnLineId = nLineId; 309 pNewRegionBandPoint->mbEndPoint = bEndPoint; 310 pNewRegionBandPoint->meLineType = eLineType; 311 pNewRegionBandPoint->mpNextBandPoint = NULL; 312 313 // connections to the new point 314 pLastTestedRegionBandPoint->mpNextBandPoint = pNewRegionBandPoint; 315 | 298 } 299 300 // use next element 301 pLastTestedRegionBandPoint = pRegionBandPoint; 302 pRegionBandPoint = pRegionBandPoint->mpNextBandPoint; 303 } 304 305 // not inserted -> add to the end of the list 306 pNewRegionBandPoint = new ImplRegionBandPoint; 307 pNewRegionBandPoint->mnX = nX; 308 pNewRegionBandPoint->mnLineId = nLineId; 309 pNewRegionBandPoint->mbEndPoint = bEndPoint; 310 pNewRegionBandPoint->meLineType = eLineType; 311 pNewRegionBandPoint->mpNextBandPoint = NULL; 312 313 // connections to the new point 314 pLastTestedRegionBandPoint->mpNextBandPoint = pNewRegionBandPoint; 315 |
316 return sal_True; | 316 return true; |
317} 318 319// ----------------------------------------------------------------------- 320 321void ImplRegionBand::MoveX( long nHorzMove ) 322{ 323 // move all x-separations 324 ImplRegionBandSep* pSep = mpFirstSep; --- 17 unchanged lines hidden (view full) --- 342 pSep = pSep->mpNextSep; 343 } 344} 345 346// ----------------------------------------------------------------------- 347// 348// combine overlaping sparations 349 | 317} 318 319// ----------------------------------------------------------------------- 320 321void ImplRegionBand::MoveX( long nHorzMove ) 322{ 323 // move all x-separations 324 ImplRegionBandSep* pSep = mpFirstSep; --- 17 unchanged lines hidden (view full) --- 342 pSep = pSep->mpNextSep; 343 } 344} 345 346// ----------------------------------------------------------------------- 347// 348// combine overlaping sparations 349 |
350sal_Bool ImplRegionBand::OptimizeBand() | 350bool ImplRegionBand::OptimizeBand() |
351{ 352 ImplRegionBandSep* pPrevSep = 0; 353 ImplRegionBandSep* pSep = mpFirstSep; 354 while ( pSep ) 355 { 356 // remove? 357 if ( pSep->mbRemoved || (pSep->mnXRight < pSep->mnXLeft) ) 358 { --- 21 unchanged lines hidden (view full) --- 380 continue; 381 } 382 } 383 384 pPrevSep = pSep; 385 pSep = pSep->mpNextSep; 386 } 387 | 351{ 352 ImplRegionBandSep* pPrevSep = 0; 353 ImplRegionBandSep* pSep = mpFirstSep; 354 while ( pSep ) 355 { 356 // remove? 357 if ( pSep->mbRemoved || (pSep->mnXRight < pSep->mnXLeft) ) 358 { --- 21 unchanged lines hidden (view full) --- 380 continue; 381 } 382 } 383 384 pPrevSep = pSep; 385 pSep = pSep->mpNextSep; 386 } 387 |
388 return sal_True; | 388 return true; |
389} 390 391// ----------------------------------------------------------------------- 392 393void ImplRegionBand::Union( long nXLeft, long nXRight ) 394{ 395 DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Union(): nxLeft > nXRight" ); 396 397 // band empty? -> add element 398 if ( !mpFirstSep ) 399 { 400 mpFirstSep = new ImplRegionBandSep; 401 mpFirstSep->mnXLeft = nXLeft; 402 mpFirstSep->mnXRight = nXRight; | 389} 390 391// ----------------------------------------------------------------------- 392 393void ImplRegionBand::Union( long nXLeft, long nXRight ) 394{ 395 DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Union(): nxLeft > nXRight" ); 396 397 // band empty? -> add element 398 if ( !mpFirstSep ) 399 { 400 mpFirstSep = new ImplRegionBandSep; 401 mpFirstSep->mnXLeft = nXLeft; 402 mpFirstSep->mnXRight = nXRight; |
403 mpFirstSep->mbRemoved = sal_False; | 403 mpFirstSep->mbRemoved = false; |
404 mpFirstSep->mpNextSep = NULL; 405 return; 406 } 407 408 // process real union 409 ImplRegionBandSep* pNewSep; 410 ImplRegionBandSep* pPrevSep = 0; 411 ImplRegionBandSep* pSep = mpFirstSep; --- 4 unchanged lines hidden (view full) --- 416 return; 417 418 // new separation completly left? -> new separation! 419 if ( nXRight < pSep->mnXLeft ) 420 { 421 pNewSep = new ImplRegionBandSep; 422 pNewSep->mnXLeft = nXLeft; 423 pNewSep->mnXRight = nXRight; | 404 mpFirstSep->mpNextSep = NULL; 405 return; 406 } 407 408 // process real union 409 ImplRegionBandSep* pNewSep; 410 ImplRegionBandSep* pPrevSep = 0; 411 ImplRegionBandSep* pSep = mpFirstSep; --- 4 unchanged lines hidden (view full) --- 416 return; 417 418 // new separation completly left? -> new separation! 419 if ( nXRight < pSep->mnXLeft ) 420 { 421 pNewSep = new ImplRegionBandSep; 422 pNewSep->mnXLeft = nXLeft; 423 pNewSep->mnXRight = nXRight; |
424 pNewSep->mbRemoved = sal_False; | 424 pNewSep->mbRemoved = false; |
425 426 pNewSep->mpNextSep = pSep; 427 if ( pSep == mpFirstSep ) 428 mpFirstSep = pNewSep; 429 else 430 pPrevSep->mpNextSep = pNewSep; 431 break; 432 } --- 10 unchanged lines hidden (view full) --- 443 } 444 445 // not inserted, but last element? -> add to the end of the list 446 if ( !pSep->mpNextSep && (nXLeft > pSep->mnXRight) ) 447 { 448 pNewSep = new ImplRegionBandSep; 449 pNewSep->mnXLeft = nXLeft; 450 pNewSep->mnXRight = nXRight; | 425 426 pNewSep->mpNextSep = pSep; 427 if ( pSep == mpFirstSep ) 428 mpFirstSep = pNewSep; 429 else 430 pPrevSep->mpNextSep = pNewSep; 431 break; 432 } --- 10 unchanged lines hidden (view full) --- 443 } 444 445 // not inserted, but last element? -> add to the end of the list 446 if ( !pSep->mpNextSep && (nXLeft > pSep->mnXRight) ) 447 { 448 pNewSep = new ImplRegionBandSep; 449 pNewSep->mnXLeft = nXLeft; 450 pNewSep->mnXRight = nXRight; |
451 pNewSep->mbRemoved = sal_False; | 451 pNewSep->mbRemoved = false; |
452 453 pSep->mpNextSep = pNewSep; 454 pNewSep->mpNextSep = NULL; 455 break; 456 } 457 458 pPrevSep = pSep; 459 pSep = pSep->mpNextSep; --- 4 unchanged lines hidden (view full) --- 464 465// ----------------------------------------------------------------------- 466 467void ImplRegionBand::Intersect( long nXLeft, long nXRight ) 468{ 469 DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Intersect(): nxLeft > nXRight" ); 470 471 // band has been touched | 452 453 pSep->mpNextSep = pNewSep; 454 pNewSep->mpNextSep = NULL; 455 break; 456 } 457 458 pPrevSep = pSep; 459 pSep = pSep->mpNextSep; --- 4 unchanged lines hidden (view full) --- 464 465// ----------------------------------------------------------------------- 466 467void ImplRegionBand::Intersect( long nXLeft, long nXRight ) 468{ 469 DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Intersect(): nxLeft > nXRight" ); 470 471 // band has been touched |
472 mbTouched = sal_True; | 472 mbTouched = true; |
473 474 // band empty? -> nothing to do 475 if ( !mpFirstSep ) 476 return; 477 478 // process real intersection 479 ImplRegionBandSep* pSep = mpFirstSep; 480 while ( pSep ) 481 { 482 // new separation completly outside? -> remove separation 483 if ( (nXRight < pSep->mnXLeft) || (nXLeft > pSep->mnXRight) ) 484 // will be removed from the optimizer | 473 474 // band empty? -> nothing to do 475 if ( !mpFirstSep ) 476 return; 477 478 // process real intersection 479 ImplRegionBandSep* pSep = mpFirstSep; 480 while ( pSep ) 481 { 482 // new separation completly outside? -> remove separation 483 if ( (nXRight < pSep->mnXLeft) || (nXLeft > pSep->mnXRight) ) 484 // will be removed from the optimizer |
485 pSep->mbRemoved = sal_True; | 485 pSep->mbRemoved = true; |
486 487 // new separation overlaping from left? -> reduce right boundary 488 if ( (nXLeft <= pSep->mnXLeft) && 489 (nXRight <= pSep->mnXRight) && 490 (nXRight >= pSep->mnXLeft) ) 491 pSep->mnXRight = nXRight; 492 493 // new separation overlaping from right? -> reduce right boundary --- 17 unchanged lines hidden (view full) --- 511 512// ----------------------------------------------------------------------- 513 514void ImplRegionBand::Exclude( long nXLeft, long nXRight ) 515{ 516 DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Exclude(): nxLeft > nXRight" ); 517 518 // band has been touched | 486 487 // new separation overlaping from left? -> reduce right boundary 488 if ( (nXLeft <= pSep->mnXLeft) && 489 (nXRight <= pSep->mnXRight) && 490 (nXRight >= pSep->mnXLeft) ) 491 pSep->mnXRight = nXRight; 492 493 // new separation overlaping from right? -> reduce right boundary --- 17 unchanged lines hidden (view full) --- 511 512// ----------------------------------------------------------------------- 513 514void ImplRegionBand::Exclude( long nXLeft, long nXRight ) 515{ 516 DBG_ASSERT( nXLeft <= nXRight, "ImplRegionBand::Exclude(): nxLeft > nXRight" ); 517 518 // band has been touched |
519 mbTouched = sal_True; | 519 mbTouched = true; |
520 521 // band empty? -> nothing to do 522 if ( !mpFirstSep ) 523 return; 524 525 // process real exclusion 526 ImplRegionBandSep* pNewSep; 527 ImplRegionBandSep* pPrevSep = 0; 528 ImplRegionBandSep* pSep = mpFirstSep; 529 while ( pSep ) 530 { | 520 521 // band empty? -> nothing to do 522 if ( !mpFirstSep ) 523 return; 524 525 // process real exclusion 526 ImplRegionBandSep* pNewSep; 527 ImplRegionBandSep* pPrevSep = 0; 528 ImplRegionBandSep* pSep = mpFirstSep; 529 while ( pSep ) 530 { |
531 sal_Bool bSepProcessed = sal_False; | 531 bool bSepProcessed = false; |
532 533 // new separation completely overlapping? -> remove separation 534 if ( (nXLeft <= pSep->mnXLeft) && (nXRight >= pSep->mnXRight) ) 535 { 536 // will be removed from the optimizer | 532 533 // new separation completely overlapping? -> remove separation 534 if ( (nXLeft <= pSep->mnXLeft) && (nXRight >= pSep->mnXRight) ) 535 { 536 // will be removed from the optimizer |
537 pSep->mbRemoved = sal_True; 538 bSepProcessed = sal_True; | 537 pSep->mbRemoved = true; 538 bSepProcessed = true; |
539 } 540 541 // new separation overlaping from left? -> reduce boundary 542 if ( !bSepProcessed ) 543 { 544 if ( (nXRight >= pSep->mnXLeft) && (nXLeft <= pSep->mnXLeft) ) 545 { 546 pSep->mnXLeft = nXRight+1; | 539 } 540 541 // new separation overlaping from left? -> reduce boundary 542 if ( !bSepProcessed ) 543 { 544 if ( (nXRight >= pSep->mnXLeft) && (nXLeft <= pSep->mnXLeft) ) 545 { 546 pSep->mnXLeft = nXRight+1; |
547 bSepProcessed = sal_True; | 547 bSepProcessed = true; |
548 } 549 } 550 551 // new separation overlaping from right? -> reduce boundary 552 if ( !bSepProcessed ) 553 { 554 if ( (nXLeft <= pSep->mnXRight) && (nXRight > pSep->mnXRight) ) 555 { 556 pSep->mnXRight = nXLeft-1; | 548 } 549 } 550 551 // new separation overlaping from right? -> reduce boundary 552 if ( !bSepProcessed ) 553 { 554 if ( (nXLeft <= pSep->mnXRight) && (nXRight > pSep->mnXRight) ) 555 { 556 pSep->mnXRight = nXLeft-1; |
557 bSepProcessed = sal_True; | 557 bSepProcessed = true; |
558 } 559 } 560 561 // new separation within the actual one? -> reduce boundary 562 // and add new entry for reminder 563 if ( !bSepProcessed ) 564 { 565 if ( (nXLeft >= pSep->mnXLeft) && (nXRight <= pSep->mnXRight) ) 566 { 567 pNewSep = new ImplRegionBandSep; 568 pNewSep->mnXLeft = pSep->mnXLeft; 569 pNewSep->mnXRight = nXLeft-1; | 558 } 559 } 560 561 // new separation within the actual one? -> reduce boundary 562 // and add new entry for reminder 563 if ( !bSepProcessed ) 564 { 565 if ( (nXLeft >= pSep->mnXLeft) && (nXRight <= pSep->mnXRight) ) 566 { 567 pNewSep = new ImplRegionBandSep; 568 pNewSep->mnXLeft = pSep->mnXLeft; 569 pNewSep->mnXRight = nXLeft-1; |
570 pNewSep->mbRemoved = sal_False; | 570 pNewSep->mbRemoved = false; |
571 572 pSep->mnXLeft = nXRight+1; 573 574 // connections from the new separation 575 pNewSep->mpNextSep = pSep; 576 577 // connections to the new separation 578 if ( pSep == mpFirstSep ) --- 63 unchanged lines hidden (view full) --- 642 // 643 644 // band empty? -> add element 645 if ( !mpFirstSep ) 646 { 647 mpFirstSep = new ImplRegionBandSep; 648 mpFirstSep->mnXLeft = nXLeft; 649 mpFirstSep->mnXRight = nXRight; | 571 572 pSep->mnXLeft = nXRight+1; 573 574 // connections from the new separation 575 pNewSep->mpNextSep = pSep; 576 577 // connections to the new separation 578 if ( pSep == mpFirstSep ) --- 63 unchanged lines hidden (view full) --- 642 // 643 644 // band empty? -> add element 645 if ( !mpFirstSep ) 646 { 647 mpFirstSep = new ImplRegionBandSep; 648 mpFirstSep->mnXLeft = nXLeft; 649 mpFirstSep->mnXRight = nXRight; |
650 mpFirstSep->mbRemoved = sal_False; | 650 mpFirstSep->mbRemoved = false; |
651 mpFirstSep->mpNextSep = NULL; 652 return; 653 } 654 655 // process real xor 656 ImplRegionBandSep* pNewSep; 657 ImplRegionBandSep* pPrevSep = 0; 658 ImplRegionBandSep* pSep = mpFirstSep; --- 12 unchanged lines hidden (view full) --- 671 { 672 // #2 673 674 // add _before_ current bandSep 675 pNewSep = new ImplRegionBandSep; 676 pNewSep->mnXLeft = nXLeft; 677 pNewSep->mnXRight = nXRight; 678 pNewSep->mpNextSep = pSep; | 651 mpFirstSep->mpNextSep = NULL; 652 return; 653 } 654 655 // process real xor 656 ImplRegionBandSep* pNewSep; 657 ImplRegionBandSep* pPrevSep = 0; 658 ImplRegionBandSep* pSep = mpFirstSep; --- 12 unchanged lines hidden (view full) --- 671 { 672 // #2 673 674 // add _before_ current bandSep 675 pNewSep = new ImplRegionBandSep; 676 pNewSep->mnXLeft = nXLeft; 677 pNewSep->mnXRight = nXRight; 678 pNewSep->mpNextSep = pSep; |
679 pNewSep->mbRemoved = sal_False; | 679 pNewSep->mbRemoved = false; |
680 681 // connections from the new separation 682 pNewSep->mpNextSep = pSep; 683 684 // connections to the new separation 685 if ( pSep == mpFirstSep ) 686 mpFirstSep = pNewSep; 687 else 688 pPrevSep->mpNextSep = pNewSep; 689 pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop 690 break; 691 } 692 else if( nXLeft == nOldLeft && nXRight == nOldRight ) 693 { 694 // #3 | 680 681 // connections from the new separation 682 pNewSep->mpNextSep = pSep; 683 684 // connections to the new separation 685 if ( pSep == mpFirstSep ) 686 mpFirstSep = pNewSep; 687 else 688 pPrevSep->mpNextSep = pNewSep; 689 pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop 690 break; 691 } 692 else if( nXLeft == nOldLeft && nXRight == nOldRight ) 693 { 694 // #3 |
695 pSep->mbRemoved = sal_True; | 695 pSep->mbRemoved = true; |
696 pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop 697 break; 698 } 699 else if( nXLeft != nOldLeft && nXRight == nOldRight ) 700 { 701 // # 5b, 8 702 if( nXLeft < nOldLeft ) 703 { --- 16 unchanged lines hidden (view full) --- 720 // # 6b, 9 721 722 if( nXRight > nOldRight ) 723 { 724 nXLeft = nOldRight+1; // 6b 725 726 // cannot break here, simply mark segment as removed, 727 // and go on with adapted nXLeft/nXRight | 696 pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop 697 break; 698 } 699 else if( nXLeft != nOldLeft && nXRight == nOldRight ) 700 { 701 // # 5b, 8 702 if( nXLeft < nOldLeft ) 703 { --- 16 unchanged lines hidden (view full) --- 720 // # 6b, 9 721 722 if( nXRight > nOldRight ) 723 { 724 nXLeft = nOldRight+1; // 6b 725 726 // cannot break here, simply mark segment as removed, 727 // and go on with adapted nXLeft/nXRight |
728 pSep->mbRemoved = sal_True; | 728 pSep->mbRemoved = true; |
729 } 730 else 731 { 732 pSep->mnXLeft = nXRight+1; // 9 733 734 pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop 735 break; 736 } --- 63 unchanged lines hidden (view full) --- 800 if( bDone ) 801 { 802 // add behind current bandSep 803 pNewSep = new ImplRegionBandSep; 804 805 pNewSep->mnXLeft = nXLeft; 806 pNewSep->mnXRight = nXRight; 807 pNewSep->mpNextSep = pSep->mpNextSep; | 729 } 730 else 731 { 732 pSep->mnXLeft = nXRight+1; // 9 733 734 pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop 735 break; 736 } --- 63 unchanged lines hidden (view full) --- 800 if( bDone ) 801 { 802 // add behind current bandSep 803 pNewSep = new ImplRegionBandSep; 804 805 pNewSep->mnXLeft = nXLeft; 806 pNewSep->mnXRight = nXRight; 807 pNewSep->mpNextSep = pSep->mpNextSep; |
808 pNewSep->mbRemoved = sal_False; | 808 pNewSep->mbRemoved = false; |
809 810 // connections from the new separation 811 pSep->mpNextSep = pNewSep; 812 813 pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop 814 break; 815 } 816 } --- 5 unchanged lines hidden (view full) --- 822 823 // new separation completely right of existing bandSeps ? 824 if( pPrevSep && nXLeft >= pPrevSep->mnXRight ) 825 { 826 pNewSep = new ImplRegionBandSep; 827 pNewSep->mnXLeft = nXLeft; 828 pNewSep->mnXRight = nXRight; 829 pNewSep->mpNextSep = NULL; | 809 810 // connections from the new separation 811 pSep->mpNextSep = pNewSep; 812 813 pPrevSep = NULL; // do not run accidentally into the "right" case when breaking the loop 814 break; 815 } 816 } --- 5 unchanged lines hidden (view full) --- 822 823 // new separation completely right of existing bandSeps ? 824 if( pPrevSep && nXLeft >= pPrevSep->mnXRight ) 825 { 826 pNewSep = new ImplRegionBandSep; 827 pNewSep->mnXLeft = nXLeft; 828 pNewSep->mnXRight = nXRight; 829 pNewSep->mpNextSep = NULL; |
830 pNewSep->mbRemoved = sal_False; | 830 pNewSep->mbRemoved = false; |
831 832 // connections from the new separation 833 pPrevSep->mpNextSep = pNewSep; 834 } 835 836 OptimizeBand(); 837} 838 839// ----------------------------------------------------------------------- 840 | 831 832 // connections from the new separation 833 pPrevSep->mpNextSep = pNewSep; 834 } 835 836 OptimizeBand(); 837} 838 839// ----------------------------------------------------------------------- 840 |
841sal_Bool ImplRegionBand::IsInside( long nX ) | 841bool ImplRegionBand::IsInside( long nX ) |
842{ 843 ImplRegionBandSep* pSep = mpFirstSep; 844 while ( pSep ) 845 { 846 if ( (pSep->mnXLeft <= nX) && (pSep->mnXRight >= nX) ) | 842{ 843 ImplRegionBandSep* pSep = mpFirstSep; 844 while ( pSep ) 845 { 846 if ( (pSep->mnXLeft <= nX) && (pSep->mnXRight >= nX) ) |
847 return sal_True; | 847 return true; |
848 849 pSep = pSep->mpNextSep; 850 } 851 | 848 849 pSep = pSep->mpNextSep; 850 } 851 |
852 return sal_False; | 852 return false; |
853} 854 855// ----------------------------------------------------------------------- 856 | 853} 854 855// ----------------------------------------------------------------------- 856 |
857sal_Bool ImplRegionBand::IsOver( long nLeft, long nRight ) | 857bool ImplRegionBand::IsOver( long nLeft, long nRight ) |
858{ 859 ImplRegionBandSep* pSep = mpFirstSep; 860 while ( pSep ) 861 { 862 if ( (pSep->mnXLeft < nRight) && (pSep->mnXRight > nLeft) ) | 858{ 859 ImplRegionBandSep* pSep = mpFirstSep; 860 while ( pSep ) 861 { 862 if ( (pSep->mnXLeft < nRight) && (pSep->mnXRight > nLeft) ) |
863 return sal_True; | 863 return true; |
864 865 pSep = pSep->mpNextSep; 866 } 867 | 864 865 pSep = pSep->mpNextSep; 866 } 867 |
868 return sal_False; | 868 return false; |
869} 870 871// ----------------------------------------------------------------------- 872 | 869} 870 871// ----------------------------------------------------------------------- 872 |
873sal_Bool ImplRegionBand::IsInside( long nLeft, long nRight ) | 873bool ImplRegionBand::IsInside( long nLeft, long nRight ) |
874{ 875 ImplRegionBandSep* pSep = mpFirstSep; 876 while ( pSep ) 877 { 878 if ( (pSep->mnXLeft >= nLeft) && (nRight <= pSep->mnXRight) ) | 874{ 875 ImplRegionBandSep* pSep = mpFirstSep; 876 while ( pSep ) 877 { 878 if ( (pSep->mnXLeft >= nLeft) && (nRight <= pSep->mnXRight) ) |
879 return sal_True; | 879 return true; |
880 881 pSep = pSep->mpNextSep; 882 } 883 | 880 881 pSep = pSep->mpNextSep; 882 } 883 |
884 return sal_False; | 884 return false; |
885} 886 887// ----------------------------------------------------------------------- 888 889long ImplRegionBand::GetXLeftBoundary() const 890{ 891 DBG_ASSERT( mpFirstSep != NULL, "ImplRegionBand::XLeftBoundary -> no separation in band!" ); 892 --- 10 unchanged lines hidden (view full) --- 903 ImplRegionBandSep* pSep = mpFirstSep; 904 while ( pSep->mpNextSep ) 905 pSep = pSep->mpNextSep; 906 return pSep->mnXRight; 907} 908 909// ----------------------------------------------------------------------- 910 | 885} 886 887// ----------------------------------------------------------------------- 888 889long ImplRegionBand::GetXLeftBoundary() const 890{ 891 DBG_ASSERT( mpFirstSep != NULL, "ImplRegionBand::XLeftBoundary -> no separation in band!" ); 892 --- 10 unchanged lines hidden (view full) --- 903 ImplRegionBandSep* pSep = mpFirstSep; 904 while ( pSep->mpNextSep ) 905 pSep = pSep->mpNextSep; 906 return pSep->mnXRight; 907} 908 909// ----------------------------------------------------------------------- 910 |
911sal_Bool ImplRegionBand::operator==( const ImplRegionBand& rRegionBand ) const | 911bool ImplRegionBand::operator==( const ImplRegionBand& rRegionBand ) const |
912{ 913 ImplRegionBandSep* pOwnRectBandSep = mpFirstSep; 914 ImplRegionBandSep* pSecondRectBandSep = rRegionBand.mpFirstSep; 915 while ( pOwnRectBandSep && pSecondRectBandSep ) 916 { 917 // get boundaries of current rectangle 918 long nOwnXLeft = pOwnRectBandSep->mnXLeft; 919 long nSecondXLeft = pSecondRectBandSep->mnXLeft; 920 if ( nOwnXLeft != nSecondXLeft ) | 912{ 913 ImplRegionBandSep* pOwnRectBandSep = mpFirstSep; 914 ImplRegionBandSep* pSecondRectBandSep = rRegionBand.mpFirstSep; 915 while ( pOwnRectBandSep && pSecondRectBandSep ) 916 { 917 // get boundaries of current rectangle 918 long nOwnXLeft = pOwnRectBandSep->mnXLeft; 919 long nSecondXLeft = pSecondRectBandSep->mnXLeft; 920 if ( nOwnXLeft != nSecondXLeft ) |
921 return sal_False; | 921 return false; |
922 923 long nOwnXRight = pOwnRectBandSep->mnXRight; 924 long nSecondXRight = pSecondRectBandSep->mnXRight; 925 if ( nOwnXRight != nSecondXRight ) | 922 923 long nOwnXRight = pOwnRectBandSep->mnXRight; 924 long nSecondXRight = pSecondRectBandSep->mnXRight; 925 if ( nOwnXRight != nSecondXRight ) |
926 return sal_False; | 926 return false; |
927 928 // get next separation from current band 929 pOwnRectBandSep = pOwnRectBandSep->mpNextSep; 930 931 // get next separation from current band 932 pSecondRectBandSep = pSecondRectBandSep->mpNextSep; 933 } 934 935 // differnt number of separations? 936 if ( pOwnRectBandSep || pSecondRectBandSep ) | 927 928 // get next separation from current band 929 pOwnRectBandSep = pOwnRectBandSep->mpNextSep; 930 931 // get next separation from current band 932 pSecondRectBandSep = pSecondRectBandSep->mpNextSep; 933 } 934 935 // differnt number of separations? 936 if ( pOwnRectBandSep || pSecondRectBandSep ) |
937 return sal_False; | 937 return false; |
938 | 938 |
939 return sal_True; | 939 return true; |
940} 941 942// ----------------------------------------------------------------------- 943 944ImplRegionBand* ImplRegionBand::SplitBand (const sal_Int32 nY) 945{ 946 OSL_ASSERT(nY>mnYTop); 947 OSL_ASSERT(nY<=mnYBottom); --- 18 unchanged lines hidden --- | 940} 941 942// ----------------------------------------------------------------------- 943 944ImplRegionBand* ImplRegionBand::SplitBand (const sal_Int32 nY) 945{ 946 OSL_ASSERT(nY>mnYTop); 947 OSL_ASSERT(nY<=mnYBottom); --- 18 unchanged lines hidden --- |