summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qpdf/QOutputDev.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/qpdf/QOutputDev.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/QOutputDev.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/unsupported/qpdf/QOutputDev.cpp b/noncore/unsupported/qpdf/QOutputDev.cpp
index 022d938..487177c 100644
--- a/noncore/unsupported/qpdf/QOutputDev.cpp
+++ b/noncore/unsupported/qpdf/QOutputDev.cpp
@@ -533,129 +533,129 @@ void QOutputDev::doClip ( GfxState *state, bool winding )
533 } 533 }
534 j += len; 534 j += len;
535 } 535 }
536 536
537 if ( m_painter && m_painter-> hasClipping ( )) 537 if ( m_painter && m_painter-> hasClipping ( ))
538 region &= m_painter-> clipRegion ( ); 538 region &= m_painter-> clipRegion ( );
539 539
540 //m_painter-> setClipRegion ( region ); 540 //m_painter-> setClipRegion ( region );
541 //m_painter-> setClipping ( true ); 541 //m_painter-> setClipping ( true );
542 542
543 //m_painter-> fillRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( ), red ); 543 //m_painter-> fillRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( ), red );
544 //m_painter-> drawText ( points [0]. x ( ) + 10, points [0]. y ( ) + 10, "Bla bla" ); 544 //m_painter-> drawText ( points [0]. x ( ) + 10, points [0]. y ( ) + 10, "Bla bla" );
545 qApp-> processEvents ( ); 545 qApp-> processEvents ( );
546} 546}
547 547
548// 548//
549// Transform points in the path and convert curves to line segments. 549// Transform points in the path and convert curves to line segments.
550// Builds a set of subpaths and returns the number of subpaths. 550// Builds a set of subpaths and returns the number of subpaths.
551// If <fillHack> is set, close any unclosed subpaths and activate a 551// If <fillHack> is set, close any unclosed subpaths and activate a
552// kludge for polygon fills: First, it divides up the subpaths into 552// kludge for polygon fills: First, it divides up the subpaths into
553// non-overlapping polygons by simply comparing bounding rectangles. 553// non-overlapping polygons by simply comparing bounding rectangles.
554// Then it connects subaths within a single compound polygon to a single 554// Then it connects subaths within a single compound polygon to a single
555// point so that X can fill the polygon (sort of). 555// point so that X can fill the polygon (sort of).
556// 556//
557int QOutputDev::convertPath ( GfxState *state, QPointArray &points, QArray<int> &lengths ) 557int QOutputDev::convertPath ( GfxState *state, QPointArray &points, QArray<int> &lengths )
558{ 558{
559 GfxPath *path = state-> getPath ( ); 559 GfxPath *path = state-> getPath ( );
560 int n = path-> getNumSubpaths ( ); 560 int n = path-> getNumSubpaths ( );
561 561
562 lengths. resize ( n ); 562 lengths. resize ( n );
563 563
564 // do each subpath 564 // do each subpath
565 for ( int i = 0; i < n; i++ ) { 565 for ( int i = 0; i < n; i++ ) {
566 // transform the points 566 // transform the points
567 lengths [i] = convertSubpath ( state, path-> getSubpath ( i ), points ); 567 lengths [i] = convertSubpath ( state, path-> getSubpath ( i ), points );
568 } 568 }
569 569
570 return n; 570 return n;
571} 571}
572 572
573// 573//
574// Transform points in a single subpath and convert curves to line 574// Transform points in a single subpath and convert curves to line
575// segments. 575// segments.
576// 576//
577int QOutputDev::convertSubpath ( GfxState *state, GfxSubpath *subpath, QPointArray &points ) 577int QOutputDev::convertSubpath ( GfxState *state, GfxSubpath *subpath, QPointArray &points )
578{ 578{
579 int oldcnt = points. count ( ); 579 int oldcnt = points. count ( );
580 580
581 fp_t x0, y0, x1, y1, x2, y2, x3, y3; 581 fp_t x0, y0, x1, y1, x2, y2, x3, y3;
582 582
583 int m = subpath-> getNumPoints ( ); 583 int m = subpath-> getNumPoints ( );
584 int i = 0; 584 int i = 0;
585 585
586 while ( i < m ) { 586 while ( i < m ) {
587 if ( i >= 1 && subpath-> getCurve ( i )) { 587 if ( i >= 1 && subpath-> getCurve ( i )) {
588 state-> transform ( subpath-> getX ( i - 1 ), subpath-> getY ( i - 1 ), &x0, &y0 ); 588 state-> transform ( subpath-> getX ( i - 1 ), subpath-> getY ( i - 1 ), &x0, &y0 );
589 state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 ); 589 state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 );
590 state-> transform ( subpath-> getX ( i + 1 ), subpath-> getY ( i + 1 ), &x2, &y2 ); 590 state-> transform ( subpath-> getX ( i + 1 ), subpath-> getY ( i + 1 ), &x2, &y2 );
591 state-> transform ( subpath-> getX ( i + 2 ), subpath-> getY ( i + 2 ), &x3, &y3 ); 591 state-> transform ( subpath-> getX ( i + 2 ), subpath-> getY ( i + 2 ), &x3, &y3 );
592 592
593 QPointArray tmp; 593 QPointArray tmp;
594 tmp. setPoints ( 4, lrint ( x0 ), lrint ( y0 ), lrint ( x1 ), lrint ( y1 ), 594 tmp. setPoints ( 4, lrint ( x0 ), lrint ( y0 ), lrint ( x1 ), lrint ( y1 ),
595 lrint ( x2 ), lrint ( y2 ), lrint ( x3 ), lrint ( y3 )); 595 lrint ( x2 ), lrint ( y2 ), lrint ( x3 ), lrint ( y3 ));
596 596
597#if QT_VERSION < 300 597#if QT_VERSION < 0x030000
598 tmp = tmp. quadBezier ( ); 598 tmp = tmp. quadBezier ( );
599 599
600 for ( uint loop = 0; loop < tmp. count ( ); loop++ ) { 600 for ( uint loop = 0; loop < tmp. count ( ); loop++ ) {
601 QPoint p = tmp. point ( loop ); 601 QPoint p = tmp. point ( loop );
602 points. putPoints ( points. count ( ), 1, p. x ( ), p. y ( )); 602 points. putPoints ( points. count ( ), 1, p. x ( ), p. y ( ));
603 } 603 }
604#else 604#else
605 tmp = tmp. cubicBezier ( ); 605 tmp = tmp. cubicBezier ( );
606 points. putPoints ( points. count ( ), tmp. count ( ), tmp ); 606 points. putPoints ( points. count ( ), tmp. count ( ), tmp );
607#endif 607#endif
608 608
609 i += 3; 609 i += 3;
610 } 610 }
611 else { 611 else {
612 state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 ); 612 state-> transform ( subpath-> getX ( i ), subpath-> getY ( i ), &x1, &y1 );
613 613
614 points. putPoints ( points. count ( ), 1, lrint ( x1 ), lrint ( y1 )); 614 points. putPoints ( points. count ( ), 1, lrint ( x1 ), lrint ( y1 ));
615 ++i; 615 ++i;
616 } 616 }
617 } 617 }
618 return points. count ( ) - oldcnt; 618 return points. count ( ) - oldcnt;
619} 619}
620 620
621 621
622void QOutputDev::beginString ( GfxState *state, GString */*s*/ ) 622void QOutputDev::beginString ( GfxState *state, GString */*s*/ )
623{ 623{
624 m_text-> beginString ( state ); 624 m_text-> beginString ( state );
625} 625}
626 626
627void QOutputDev::endString ( GfxState */*state*/ ) 627void QOutputDev::endString ( GfxState */*state*/ )
628{ 628{
629 m_text-> endString ( ); 629 m_text-> endString ( );
630} 630}
631 631
632void QOutputDev::drawChar ( GfxState *state, fp_t x, fp_t y, 632void QOutputDev::drawChar ( GfxState *state, fp_t x, fp_t y,
633 fp_t dx, fp_t dy, fp_t originX, fp_t originY, 633 fp_t dx, fp_t dy, fp_t originX, fp_t originY,
634 CharCode code, Unicode *u, int uLen ) 634 CharCode code, Unicode *u, int uLen )
635{ 635{
636 fp_t x1, y1, dx1, dy1; 636 fp_t x1, y1, dx1, dy1;
637 637
638 if ( uLen > 0 ) 638 if ( uLen > 0 )
639 m_text-> addChar ( state, x, y, dx, dy, u, uLen ); 639 m_text-> addChar ( state, x, y, dx, dy, u, uLen );
640 640
641 // check for invisible text -- this is used by Acrobat Capture 641 // check for invisible text -- this is used by Acrobat Capture
642 if (( state-> getRender ( ) & 3 ) == 3 ) { 642 if (( state-> getRender ( ) & 3 ) == 3 ) {
643 return; 643 return;
644 } 644 }
645 645
646 x -= originX; 646 x -= originX;
647 y -= originY; 647 y -= originY;
648 state-> transform ( x, y, &x1, &y1 ); 648 state-> transform ( x, y, &x1, &y1 );
649 state-> transformDelta ( dx, dy, &dx1, &dy1 ); 649 state-> transformDelta ( dx, dy, &dx1, &dy1 );
650 650
651 651
652 if ( uLen > 0 ) { 652 if ( uLen > 0 ) {
653 QString str; 653 QString str;
654 QFontMetrics fm = m_painter-> fontMetrics ( ); 654 QFontMetrics fm = m_painter-> fontMetrics ( );
655 655
656 for ( int i = 0; i < uLen; i++ ) { 656 for ( int i = 0; i < uLen; i++ ) {
657 QChar c = QChar ( u [i] ); 657 QChar c = QChar ( u [i] );
658 658
659 if ( fm. inFont ( c )) { 659 if ( fm. inFont ( c )) {
660 str [i] = QChar ( u [i] ); 660 str [i] = QChar ( u [i] );
661 } 661 }