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/qpaintengine_mac_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**
     
    5959#include "private/qpolygonclipper_p.h"
    6060#include "QtCore/qhash.h"
    61 #ifndef QT_MAC_NO_QUICKDRAW
    62 #include <private/qwidget_p.h>
    63 #endif
    6461
    6562typedef struct CGColorSpace *CGColorSpaceRef;
     
    6966extern int qt_defaultDpiX();
    7067extern int qt_defaultDpiY();
    71 
    72 #ifndef QT_MAC_NO_QUICKDRAW
    73 class QMacSavedPortInfo
    74 {
    75     RgnHandle clip;
    76     GWorldPtr world;
    77     GDHandle handle;
    78     PenState pen; //go pennstate
    79     RGBColor back, fore;
    80     bool valid_gworld;
    81     void init();
    82 
    83 public:
    84     inline QMacSavedPortInfo() { init(); }
    85     inline QMacSavedPortInfo(QPaintDevice *pd) { init(); setPaintDevice(pd); }
    86     inline QMacSavedPortInfo(QPaintDevice *pd, const QRect &r)
    87         { init(); setPaintDevice(pd); setClipRegion(r); }
    88     inline QMacSavedPortInfo(QPaintDevice *pd, const QRegion &r)
    89         { init(); setPaintDevice(pd); setClipRegion(r); }
    90     ~QMacSavedPortInfo();
    91     static inline bool setClipRegion(const QRect &r);
    92     static inline bool setClipRegion(const QRegion &r);
    93     static inline bool setPaintDevice(QPaintDevice *);
    94 };
    95 
    96 inline bool
    97 QMacSavedPortInfo::setClipRegion(const QRect &rect)
    98 {
    99     Rect r;
    100     SetRect(&r, rect.x(), rect.y(), rect.right()+1, rect.bottom()+1);
    101     ClipRect(&r);
    102     return true;
    103 }
    104 
    105 inline bool
    106 QMacSavedPortInfo::setClipRegion(const QRegion &r)
    107 {
    108     if(r.isEmpty())
    109         return setClipRegion(QRect());
    110     QMacSmartQuickDrawRegion rgn(r.toQDRgn());
    111     SetClip(rgn);
    112     return true;
    113 }
    114 
    115 inline bool
    116 QMacSavedPortInfo::setPaintDevice(QPaintDevice *pd)
    117 {
    118     if(!pd)
    119         return false;
    120     bool ret = true;
    121     extern GrafPtr qt_mac_qd_context(const QPaintDevice *); // qpaintdevice_mac.cpp
    122     if(pd->devType() == QInternal::Widget)
    123         SetPortWindowPort(qt_mac_window_for(static_cast<QWidget*>(pd)));
    124     else if(pd->devType() == QInternal::Pixmap || pd->devType() == QInternal::Printer)
    125         SetGWorld((GrafPtr)qt_mac_qd_context(pd), 0); //set the gworld
    126     return ret;
    127 }
    128 
    129 inline void
    130 QMacSavedPortInfo::init()
    131 {
    132     GetBackColor(&back);
    133     GetForeColor(&fore);
    134     GetGWorld(&world, &handle);
    135     valid_gworld = true;
    136     clip = NewRgn();
    137     GetClip(clip);
    138     GetPenState(&pen);
    139 }
    140 
    141 inline QMacSavedPortInfo::~QMacSavedPortInfo()
    142 {
    143     bool set_state = false;
    144     if(valid_gworld) {
    145         set_state = IsValidPort(world);
    146         if(set_state)
    147             SetGWorld(world,handle); //always do this one first
    148     } else {
    149         setPaintDevice(qt_mac_safe_pdev);
    150     }
    151     if(set_state) {
    152         SetClip(clip);
    153         SetPenState(&pen);
    154         RGBForeColor(&fore);
    155         RGBBackColor(&back);
    156     }
    157     DisposeRgn(clip);
    158 }
    159 #else
    160 class QMacSavedPortInfo
    161 {
    162 public:
    163     inline QMacSavedPortInfo() { }
    164     inline QMacSavedPortInfo(QPaintDevice *) { }
    165     inline QMacSavedPortInfo(QPaintDevice *, const QRect &) { }
    166     inline QMacSavedPortInfo(QPaintDevice *, const QRegion &) { }
    167     ~QMacSavedPortInfo() { }
    168     static inline bool setClipRegion(const QRect &) { return false; }
    169     static inline bool setClipRegion(const QRegion &) { return false; }
    170     static inline bool setPaintDevice(QPaintDevice *) { return false; }
    171 };
    172 #endif
    17368
    17469class QCoreGraphicsPaintEnginePrivate;
     
    234129    friend class QMacPrintEnginePrivate;
    235130    friend void qt_mac_display_change_callbk(CGDirectDisplayID, CGDisplayChangeSummaryFlags, void *);
     131
     132
    236133    QCoreGraphicsPaintEngine(QPaintEnginePrivate &dptr);
    237134
Note: See TracChangeset for help on using the changeset viewer.