Project

General

Profile

Bug #1236 » wt-bug-1236-fix.diff

Boris Nagaev, 04/01/2013 03:54 PM

View differences:

src/Wt/WRasterImage.C
654 654
{
655 655
  internalInit();
656 656

  
657
  // map point (1, 1) to convert device 0.5 to relative coordinates
658
  double test_x, test_y;
659
  painter()->combinedTransform().inverted().map(1, 1, &test_x, &test_y);
660
  double shift = std::sqrt(test_x * test_x + test_y * test_y);
661

  
657 662
  const std::vector<WPainterPath::Segment>& segments = path.segments();
658 663

  
659 664
  if (segments.size() > 0
660 665
      && segments[0].type() != WPainterPath::Segment::MoveTo)
661
    DrawPathMoveToAbsolute(context_, -0.5, -0.5);
666
    DrawPathMoveToAbsolute(context_, -shift, -shift);
662 667

  
663 668
  for (unsigned i = 0; i < segments.size(); ++i) {
664 669
    const WPainterPath::Segment s = segments[i];
665 670

  
666 671
    switch (s.type()) {
667 672
    case WPainterPath::Segment::MoveTo:
668
      DrawPathMoveToAbsolute(context_, s.x() - 0.5, s.y() - 0.5);
673
      DrawPathMoveToAbsolute(context_, s.x() - shift, s.y() - shift);
669 674
      break;
670 675
    case WPainterPath::Segment::LineTo:
671
      DrawPathLineToAbsolute(context_, s.x() - 0.5, s.y() - 0.5);
676
      DrawPathLineToAbsolute(context_, s.x() - shift, s.y() - shift);
672 677
      break;
673 678
    case WPainterPath::Segment::CubicC1: {
674 679
      const double x1 = s.x();
......
678 683
      const double x3 = segments[i+2].x();
679 684
      const double y3 = segments[i+2].y();
680 685

  
681
      DrawPathCurveToAbsolute(context_, x1 - 0.5, y1 - 0.5,
682
			      x2 - 0.5, y2 - 0.5,
683
			      x3 - 0.5, y3 - 0.5);
686
      DrawPathCurveToAbsolute(context_, x1 - shift, y1 - shift,
687
			      x2 - shift, y2 - shift,
688
			      x3 - shift, y3 - shift);
684 689

  
685 690
      i += 2;
686 691
      break;
......
708 713
      const int fs = (deltaTheta > 0 ? 1 : 0);
709 714

  
710 715
      if (!fequal(current.x(), x1) || !fequal(current.y(), y1))
711
	DrawPathLineToAbsolute(context_, x1 - 0.5, y1 - 0.5);
716
	DrawPathLineToAbsolute(context_, x1 - shift, y1 - shift);
712 717

  
713 718
      DrawPathEllipticArcAbsolute(context_, rx, ry, 0, fa, fs,
714
				  x2 - 0.5, y2 - 0.5);
719
				  x2 - shift, y2 - shift);
715 720

  
716 721
      i += 2;
717 722
      break;
......
725 730
      const double x2 = segments[i+1].x();
726 731
      const double y2 = segments[i+1].y();
727 732

  
728
      DrawPathCurveToQuadraticBezierAbsolute(context_, x1 - 0.5, y1 - 0.5,
729
					     x2 - 0.5, y2 - 0.5);
733
      DrawPathCurveToQuadraticBezierAbsolute(context_, x1 - shift, y1 - shift,
734
					     x2 - shift, y2 - shift);
730 735

  
731 736
      i += 1;
732 737

  
(3-3/3)