Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qrasterizer.cpp

    r2 r561  
    22**
    33** 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])
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    311311void qScanConvert(QScanConverter &d, T allVertical)
    312312{
    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(), );
    314314    int line = 0;
    315315    for (int y = d.m_lines.first().top; y <= d.m_bottom; ++y) {
     
    320320                d.m_active.resize(d.m_active.size() + 1);
    321321                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)
    323323                    d.m_active.at(j+1) = d.m_active.at(j);
    324324                d.m_active.at(j+1) = l;
     
    335335                QScanConverter::Line *l = d.m_active.at(i);
    336336                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)
    338338                    d.m_active.at(j+1) = d.m_active.at(j);
    339339                d.m_active.at(j+1) = l;
     
    437437{
    438438    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;
    441442    }
    442443}
     
    692693}
    693694
    694 static inline qreal qRoundF(qreal v)
     695static inline qreal qF(qreal v)
    695696{
    696697#ifdef QT_USE_MATH_H_FLOATS
    697698    if (sizeof(qreal) == sizeof(float))
    698         return floorf(v + 0.5);
     699        return floorf(v);
    699700    else
    700701#endif
    701         return floor(v + 0.5);
     702        return floor(v);
    702703}
    703704
    704705void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap)
    705706{
    706     if (a == b || width == 0)
     707    if (a == b || width == 0)
    707708        return;
     709
     710
    708711
    709712    QPointF pa = a;
    710713    QPointF pb = b;
    711714
    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;
    713716    if (squareCap)
    714717        offs += QPointF(offs.y(), offs.x());
     
    759762
    760763        // snap to grid to prevent large slopes
    761         pa.rx() = qRoundF(pa.rx() * gridResolution) * reciprocal;
    762         pa.ry() = qRoundF(pa.ry() * gridResolution) * reciprocal;
    763         pb.rx() = qRoundF(pb.rx() * gridResolution) * reciprocal;
    764         pb.ry() = qRoundF(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;
    765768
    766769        // old delta
Note: See TracChangeset for help on using the changeset viewer.