00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef CGDEBUG
00040 #define CGDEBUG
00041
00042 #include <stdio.h>
00043 #include <Carbon/Carbon.h>
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 inline OSStatus dbgLocation(const char *file, int line)
00078 {
00079 fprintf(stderr, "%s:%d ", file, line);
00080 return 0;
00081 }
00082
00083 inline OSStatus dbgEndl()
00084 {
00085 fprintf(stderr, "\n");
00086 return 0;
00087 }
00088
00089
00090 inline void dbgCGContextClipToRect(CGContextRef a, CGRect b)
00091 {
00092 CGContextClipToRect(a, b);
00093 }
00094
00095 #define CGContextClipToRect(a, b) { \
00096 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00097 dbgCGContextClipToRect(a, b); \
00098 fprintf(stderr, "\n"); }
00099
00100 inline void dbgCGContextFillRect(CGContextRef a, CGRect b)
00101 {
00102 CGContextFillRect(a, b);
00103 }
00104
00105 #define CGContextFillRect(a, b) { \
00106 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00107 dbgCGContextFillRect(a, b); \
00108 fprintf(stderr, "\n"); }
00109
00110 inline OSStatus dbgQDEndCGContext(CGrafPtr a, CGContextRef *b)
00111 {
00112 return QDEndCGContext(a, b);
00113 }
00114
00115 #define QDEndCGContext(a, b) ( \
00116 dbgLocation(__FILE__, __LINE__) + \
00117 dbgQDEndCGContext(a, b) + \
00118 dbgEndl() )
00119
00120 inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b)
00121 {
00122 return QDBeginCGContext(a, b);
00123 }
00124
00125 #define QDBeginCGContext(a, b) ( \
00126 dbgLocation(__FILE__, __LINE__) + \
00127 dbgQDBeginCGContext(a, b) + \
00128 dbgEndl() )
00129
00130 inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c)
00131 {
00132 ClipCGContextToRegion(a, b, c);
00133 }
00134
00135 #define ClipCGContextToRegion(a, b, c) { \
00136 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00137 dbgClipCGContextToRegion(a, b, c); \
00138 fprintf(stderr, "\n"); }
00139
00140 inline void dbgCGContextMoveToPoint(CGContextRef context, float x, float y)
00141 {
00142 CGContextMoveToPoint(context, x, y);
00143 }
00144
00145 #define CGContextMoveToPoint(a, b, c) { \
00146 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00147 dbgCGContextMoveToPoint(a, b, c); \
00148 fprintf(stderr, "\n"); }
00149
00150 inline void dbgCGContextFillPath(CGContextRef context)
00151 {
00152 CGContextFillPath(context);
00153 }
00154
00155 #define CGContextFillPath(a) { \
00156 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00157 dbgCGContextFillPath(a); \
00158 fprintf(stderr, "\n"); }
00159
00160 inline void dbgCGContextClosePath(CGContextRef context)
00161 {
00162 CGContextClosePath(context);
00163 }
00164
00165 #define CGContextClosePath(a) { \
00166 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00167 dbgCGContextClosePath(a); \
00168 fprintf(stderr, "\n"); }
00169
00170 inline void dbgCGContextFlush(CGContextRef context)
00171 {
00172 CGContextFlush(context);
00173 }
00174
00175 #define CGContextFlush(a) { \
00176 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00177 dbgCGContextFlush(a); \
00178 fprintf(stderr, "\n"); }
00179
00180 inline void dbgCGContextSaveGState(CGContextRef context)
00181 {
00182 CGContextSaveGState(context);
00183 }
00184
00185 #define CGContextSaveGState(a) { \
00186 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00187 dbgCGContextSaveGState(a); \
00188 fprintf(stderr, "\n"); }
00189
00190 inline void dbgCGContextRestoreGState(CGContextRef context)
00191 {
00192 CGContextRestoreGState(context);
00193 }
00194
00195 #define CGContextRestoreGState(a) { \
00196 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
00197 dbgCGContextRestoreGState(a); \
00198 fprintf(stderr, "\n"); }
00199
00200
00201 #endif
00202
00203
00204
00205
00206