Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (16 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/qvectorpath_p.h

    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**
     
    5656#include <QtGui/qpaintengine.h>
    5757
    58 #include "qpaintengine_p.h"
    59 #include "qstroker_p.h"
    60 #include "qpainter_p.h"
     58#include
     59#include
     60#include
    6161
    6262
     
    6767QT_MODULE(Gui)
    6868
     69
    6970
    70 #define QVECTORPATH_NO_CACHE
     71typedef void (*qvectorpath_cache_cleanup)(QPaintEngineEx *engine, void *data);
    7172
    7273struct QRealRect {
     
    7879public:
    7980    enum Hint {
    80         // Basic shapes...
    81         LinesHint               = 0x0001, // Just plain lines...
    82         RectangleHint           = 0x0002,
    83         ConvexPolygonHint       = 0x0003, // Convex polygon...
    84         NonISectPolygonHint     = 0x0004, // concave polygon, but not intersecting..
    85         NonCurvedShapeHint      = 0x0005, // Generic polygon, possibly self-intersecting...
    86         CurvedShapeHint         = 0x0006, // Generic vector path..
    87         EllipseHint             = 0x0007,
    88         ShapeHintMask           = 0x000f,
     81        // Shape hints, in 0x000000ff, access using shape()
     82        AreaShapeMask           = 0x0001,       // shape covers an area
     83        NonConvexShapeMask      = 0x0002,       // shape is not convex
     84        CurvedShapeMask         = 0x0004,       // shape contains curves...
     85        LinesShapeMask          = 0x0008,
     86        RectangleShapeMask      = 0x0010,
     87        ShapeMask               = 0x001f,
     88
     89        // Shape hints merged into basic shapes..
     90        LinesHint               = LinesShapeMask,
     91        RectangleHint           = AreaShapeMask | RectangleShapeMask,
     92        EllipseHint             = AreaShapeMask | CurvedShapeMask,
     93        ConvexPolygonHint       = AreaShapeMask,
     94        PolygonHint             = AreaShapeMask | NonConvexShapeMask,
     95        RoundedRectHint         = AreaShapeMask | CurvedShapeMask,
     96        ArbitraryShapeHint      = AreaShapeMask | NonConvexShapeMask | CurvedShapeMask,
    8997
    9098        // Other hints
    91         CacheHint               = 0x0100,
    92         ControlPointRect        = 0x0200, // Set if the control point rect has been calculated...
     99        IsCachedHint            = 0x0100, // Set if the cache hint is set
     100        ShouldUseCacheHint      = 0x0200, // Set if the path should be cached when possible..
     101        ControlPointRect        = 0x0400, // Set if the control point rect has been calculated...
    93102
    94103        // Shape rendering specifiers...
    95104        OddEvenFill             = 0x1000,
    96105        WindingFill             = 0x2000,
    97         ImplicitClose           = 0x4000,
     106        ImplicitClose           = 0x4000
    98107    };
    99108
     
    102111                int count,
    103112                const QPainterPath::ElementType *elements = 0,
    104                 uint hints = CurvedShapeHint)
     113                uint hints = ShapeHint)
    105114        : m_elements(elements),
    106115          m_points(points),
    107116          m_count(count),
    108117          m_hints(hints)
    109 #ifndef QVECTORPATH_NO_CACHE
    110         , m_cache(0)
    111 #endif
    112118    {
    113119    }
    114120
    115     const QRealRect &controlPointRect() const;
     121    ;
    116122
    117     inline Hint shape() const { return (Hint) (m_hints & ShapeHintMask); }
     123   
    118124
    119     inline bool hasCacheHint() const { return m_hints & CacheHint; }
     125    inline Hint shape() const { return (Hint) (m_hints & ShapeMask); }
     126    inline bool isConvex() const { return (m_hints & NonConvexShapeMask) == 0; }
     127    inline bool isCurved() const { return m_hints & CurvedShapeMask; }
     128
     129    inline bool isCacheable() const { return m_hints & ShouldUseCacheHint; }
    120130    inline bool hasImplicitClose() const { return m_hints & ImplicitClose; }
    121131    inline bool hasWindingFill() const { return m_hints & WindingFill; }
    122132
     133
    123134    inline uint hints() const { return m_hints; }
    124135
     
    128139
    129140    inline int elementCount() const { return m_count; }
     141
    130142
    131143    static inline uint polygonFlags(QPaintEngine::PolygonDrawMode mode);
    132144
    133 private:
    134     Q_DISABLE_COPY(QVectorPath)
    135 
    136 #ifndef QVECTORPATH_NO_CACHE
    137145    struct CacheEntry {
    138         void *engine;
    139         int id;
    140         void *extra;
     146        *engine;
     147        ;
     148        ;
    141149        CacheEntry *next;
    142150    };
    143151
    144     void addCacheData(CacheEntry *d) {
    145         d->next = m_cache;
    146         m_cache = d;
     152    CacheEntry *addCacheData(QPaintEngineEx *engine, void *data, qvectorpath_cache_cleanup cleanup) const;
     153    inline CacheEntry *lookupCacheData(QPaintEngineEx *engine) const {
     154        Q_ASSERT(m_hints & ShouldUseCacheHint);
     155        CacheEntry *e = m_cache;
     156        while (e) {
     157            if (e->engine == engine)
     158                return e;
     159            e = e->next;
     160        }
     161        return 0;
    147162    }
    148163
    149     CacheEntry *m_cache;
    150 #endif
     164
     165private:
     166    Q_DISABLE_COPY(QVectorPath)
    151167
    152168    const QPainterPath::ElementType *m_elements;
     
    156172    mutable uint m_hints;
    157173    mutable QRealRect m_cp_rect;
     174
     175
    158176};
    159177
Note: See TracChangeset for help on using the changeset viewer.