Changeset 561 for trunk/src/gui/painting/qrasterizer.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/painting/qrasterizer.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 311 311 void qScanConvert(QScanConverter &d, T allVertical) 312 312 { 313 qSort(d.m_lines.data(), d.m_lines.data() + d.m_lines.size(), topOrder);313 qSort(d.m_lines.data(), d.m_lines.data() + d.m_lines.size(), ); 314 314 int line = 0; 315 315 for (int y = d.m_lines.first().top; y <= d.m_bottom; ++y) { … … 320 320 d.m_active.resize(d.m_active.size() + 1); 321 321 int j; 322 for (j = d.m_active.size() - 2; j >= 0 && xOrder(l, d.m_active.at(j)); --j)322 for (j = d.m_active.size() - 2; j >= 0 && (l, d.m_active.at(j)); --j) 323 323 d.m_active.at(j+1) = d.m_active.at(j); 324 324 d.m_active.at(j+1) = l; … … 335 335 QScanConverter::Line *l = d.m_active.at(i); 336 336 int j; 337 for (j = i-1; j >= 0 && xOrder(l, d.m_active.at(j)); --j)337 for (j = i-1; j >= 0 && (l, d.m_active.at(j)); --j) 338 338 d.m_active.at(j+1) = d.m_active.at(j); 339 339 d.m_active.at(j+1) = l; … … 437 437 { 438 438 if (m_alloc < size) { 439 m_alloc = qMax(size, 2 * m_alloc); 440 m_intersections = (Intersection *)realloc(m_intersections, m_alloc * sizeof(Intersection)); 439 int newAlloc = qMax(size, 2 * m_alloc); 440 m_intersections = q_check_ptr((Intersection *)realloc(m_intersections, newAlloc * sizeof(Intersection))); 441 m_alloc = newAlloc; 441 442 } 442 443 } … … 692 693 } 693 694 694 static inline qreal q RoundF(qreal v)695 static inline qreal qF(qreal v) 695 696 { 696 697 #ifdef QT_USE_MATH_H_FLOATS 697 698 if (sizeof(qreal) == sizeof(float)) 698 return floorf(v + 0.5);699 return floorf(v); 699 700 else 700 701 #endif 701 return floor(v + 0.5);702 return floor(v); 702 703 } 703 704 704 705 void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) 705 706 { 706 if (a == b || width == 0 )707 if (a == b || width == 0) 707 708 return; 709 710 708 711 709 712 QPointF pa = a; 710 713 QPointF pb = b; 711 714 712 QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; 715 QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; 713 716 if (squareCap) 714 717 offs += QPointF(offs.y(), offs.x()); … … 759 762 760 763 // snap to grid to prevent large slopes 761 pa.rx() = q RoundF(pa.rx() * gridResolution) * reciprocal;762 pa.ry() = q RoundF(pa.ry() * gridResolution) * reciprocal;763 pb.rx() = q RoundF(pb.rx() * gridResolution) * reciprocal;764 pb.ry() = q RoundF(pb.ry() * gridResolution) * reciprocal;764 pa.rx() = qF(pa.rx() * gridResolution) * reciprocal; 765 pa.ry() = qF(pa.ry() * gridResolution) * reciprocal; 766 pb.rx() = qF(pb.rx() * gridResolution) * reciprocal; 767 pb.ry() = qF(pb.ry() * gridResolution) * reciprocal; 765 768 766 769 // old delta
Note:
See TracChangeset
for help on using the changeset viewer.