42 #include <private/qt_mac_p.h> 50 #if defined(Q_WS_MAC32) && !defined(QT_MAC_USE_COCOA) 51 #define RGN_CACHE_SIZE 200 53 static bool rgncache_init =
false;
54 static int rgncache_used;
55 static RgnHandle rgncache[RGN_CACHE_SIZE];
56 static void qt_mac_cleanup_rgncache()
58 rgncache_init =
false;
59 for(
int i = 0; i < RGN_CACHE_SIZE; ++i) {
62 DisposeRgn(rgncache[i]);
75 for(
int i = 0; i < RGN_CACHE_SIZE; ++i)
78 }
else if(rgncache_used) {
79 for(
int i = 0; i < RGN_CACHE_SIZE; ++i) {
96 if(rgncache_init && rgncache_used < RGN_CACHE_SIZE) {
97 for(
int i = 0; i < RGN_CACHE_SIZE; ++i) {
109 static OSStatus qt_mac_get_rgn_rect(UInt16 msg,
RgnHandle,
const Rect *rect,
void *reg)
111 if(msg == kQDRegionToRectsMsgParse) {
112 QRect rct(rect->left, rect->top, (rect->right - rect->left), (rect->bottom - rect->top));
121 return QRegion::fromQDRgn(rgn);
128 OSStatus oss = QDRegionToRects(rgn, kQDParseRegionFromTopLeft, qt_mac_get_rgn_rect, (
void *)&ret);
150 qMax(SHRT_MIN, qt_r->
x()),
151 qMax(SHRT_MIN, qt_r->
y()),
154 UnionRgn(rgnHandle, tmp_rgn, rgnHandle);
170 RgnHandle QRegion::toQDRgnForUpdate_sys()
const 181 enum { HIViewSetNeedsDisplayInRegionOverflow = 10000 };
182 if (qt_r->
right() > HIViewSetNeedsDisplayInRegionOverflow || qt_r->
bottom() > HIViewSetNeedsDisplayInRegionOverflow) {
189 qMax(SHRT_MIN, qt_r->
x()),
190 qMax(SHRT_MIN, qt_r->
y()),
193 UnionRgn(rgnHandle, tmp_rgn, rgnHandle);
203 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) 205 const CGRect *inRect,
void *inRefcon)
212 case kHIShapeEnumerateRect:
213 *region +=
QRect(inRect->origin.x, inRect->origin.y,
214 inRect->size.width, inRect->size.height);
216 case kHIShapeEnumerateInit:
218 case kHIShapeEnumerateTerminate:
237 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) 244 HIShapeUnionWithRect(shape, &cgRect);
251 #ifndef QT_MAC_USE_COCOA 253 HIShapeUnion(qdShape, shape, shape);
259 #if !defined(Q_WS_MAC64) && !defined(QT_MAC_USE_COCOA) 265 QRegion QRegion::fromHIShapeRef(HIShapeRef shape)
270 #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) 274 HIShapeEnumerate(shape, kHIShapeParseFromTopLeft, shape2QRegionHelper, &returnRegion);
280 #if !defined(Q_WS_MAC64) && !defined(QT_MAC_USE_COCOA) 281 if (ptrHIShapeGetAsQDRgn == 0) {
288 returnRegion = QRegion::fromQDRgn(rgn);
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
int width() const
Returns the width of the rectangle.
QRegion qt_mac_convert_mac_region(RgnHandle rgn)
struct __HIShape * HIMutableShapeRef
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
const struct __HIShape * HIShapeRef
void * resolve(const char *symbol)
Returns the address of the exported symbol symbol.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
QRegion()
Constructs an empty region.
#define Q_BASIC_ATOMIC_INITIALIZER(a)
static struct QRegionData shared_empty
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
RgnHandle qt_mac_get_rgn()
#define QT_BEGIN_NAMESPACE
This macro expands to.
static PtrHIShapeGetAsQDRgn ptrHIShapeGetAsQDRgn
OSStatus(* PtrHIShapeGetAsQDRgn)(HIShapeRef, RgnHandle)
The QRegion class specifies a clip region for a painter.
struct OpaqueRgnHandle * RgnHandle
int right() const
Returns the x-coordinate of the rectangle's right edge.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QRect class defines a rectangle in the plane using integer precision.
void setLoadHints(LoadHints hints)
static const MacVersion MacintoshVersion
the version of the Macintosh operating system on which the application is run (Mac only)...
const T * constData() const
Returns a const pointer to the data stored in the vector.
void qAddPostRoutine(QtCleanUpFunction ptr)
Adds a global routine that will be called from the QApplication destructor.
The QLibrary class loads shared libraries at runtime.
void qt_mac_dispose_rgn(RgnHandle r)