Changeset 561 for trunk/src/gui/painting/qpaintengine_mac_p.h
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/gui/painting/qpaintengine_mac_p.h (modified) (6 diffs)
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/qpaintengine_mac_p.h
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 ** … … 59 59 #include "private/qpolygonclipper_p.h" 60 60 #include "QtCore/qhash.h" 61 #ifndef QT_MAC_NO_QUICKDRAW62 #include <private/qwidget_p.h>63 #endif64 61 65 62 typedef struct CGColorSpace *CGColorSpaceRef; … … 69 66 extern int qt_defaultDpiX(); 70 67 extern int qt_defaultDpiY(); 71 72 #ifndef QT_MAC_NO_QUICKDRAW73 class QMacSavedPortInfo74 {75 RgnHandle clip;76 GWorldPtr world;77 GDHandle handle;78 PenState pen; //go pennstate79 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 bool97 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 bool106 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 bool116 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.cpp122 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 gworld126 return ret;127 }128 129 inline void130 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 first148 } 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 #else160 class QMacSavedPortInfo161 {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 #endif173 68 174 69 class QCoreGraphicsPaintEnginePrivate; … … 234 129 friend class QMacPrintEnginePrivate; 235 130 friend void qt_mac_display_change_callbk(CGDirectDisplayID, CGDisplayChangeSummaryFlags, void *); 131 132 236 133 QCoreGraphicsPaintEngine(QPaintEnginePrivate &dptr); 237 134
Note:
See TracChangeset
for help on using the changeset viewer.
