FLTK 1.3.0
|
00001 // 00002 // "$Id$" 00003 // 00004 // OS X Core Graphics debugging help for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 // USA. 00022 // 00023 // Please report all bugs and problems on the following page: 00024 // 00025 // http://www.fltk.org/str.php 00026 // 00027 00028 // This file allows easier debugging of Mac OS X Core Graphics 00029 // code. This file is normally not included into any FLTK builds, 00030 // but since it has proven to be tremendously useful in debugging 00031 // the FLTK port to "Quartz", I decided to add this file in case 00032 // more bugs show up. 00033 // 00034 // This header is activated by adding the following 00035 // line to "config.h" 00036 // #include "src/cgdebug.h" 00037 // 00038 // Running "./configure" will remove this line from "config.h". 00039 // 00040 // When used erreanously, Core Graphics prints warnings to 00041 // stderr. This is helpful, however it is not possible to 00042 // associate a line number or source file with the warning message. 00043 // This headr file outputs a trace of CG calls, interweaveing 00044 // them with CG warnings. 00045 // 00046 // Matthias 00047 00048 #ifndef CGDEBUG 00049 #define CGDEBUG 00050 00051 #include <stdio.h> 00052 #include <Carbon/Carbon.h> 00053 00054 //+BitmapContextCreate 00055 //+BitmapContextGetData 00056 // ClipCGContextToRegion 00057 // QDBeginCGContext 00058 // QDEndCGContext 00059 00060 //+AddArc 00061 //+AddLineToPoint 00062 // ClipToRect 00063 // ClosePath 00064 //+ConcatCTM 00065 //+DrawImage 00066 // FillPath 00067 // FillRect 00068 // Flush 00069 //+GetCTM 00070 // MoveToPoint 00071 //+Release 00072 // RestoreGState 00073 // SaveGState 00074 //+ScaleCTM 00075 //+SetLineCap 00076 //+SetLineDash 00077 //+SetLineJoin 00078 //+SetLineWidth 00079 //+SetRGBFillColor 00080 //+SetRGBStrokeColor 00081 //+SetShouldAntialias 00082 //+SetTextMatrix 00083 //+StrokePath 00084 //+TranslateCTM 00085 00086 inline OSStatus dbgLocation(const char *file, int line) 00087 { 00088 fprintf(stderr, "%s:%d ", file, line); 00089 return 0; 00090 } 00091 00092 inline OSStatus dbgEndl() 00093 { 00094 fprintf(stderr, "\n"); 00095 return 0; 00096 } 00097 00098 00099 inline void dbgCGContextClipToRect(CGContextRef a, CGRect b) 00100 { 00101 CGContextClipToRect(a, b); 00102 } 00103 00104 #define CGContextClipToRect(a, b) { \ 00105 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00106 dbgCGContextClipToRect(a, b); \ 00107 fprintf(stderr, "\n"); } 00108 00109 inline void dbgCGContextFillRect(CGContextRef a, CGRect b) 00110 { 00111 CGContextFillRect(a, b); 00112 } 00113 00114 #define CGContextFillRect(a, b) { \ 00115 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00116 dbgCGContextFillRect(a, b); \ 00117 fprintf(stderr, "\n"); } 00118 00119 inline OSStatus dbgQDEndCGContext(CGrafPtr a, CGContextRef *b) 00120 { 00121 return QDEndCGContext(a, b); 00122 } 00123 00124 #define QDEndCGContext(a, b) ( \ 00125 dbgLocation(__FILE__, __LINE__) + \ 00126 dbgQDEndCGContext(a, b) + \ 00127 dbgEndl() ) 00128 00129 inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b) 00130 { 00131 return QDBeginCGContext(a, b); 00132 } 00133 00134 #define QDBeginCGContext(a, b) ( \ 00135 dbgLocation(__FILE__, __LINE__) + \ 00136 dbgQDBeginCGContext(a, b) + \ 00137 dbgEndl() ) 00138 00139 inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c) 00140 { 00141 ClipCGContextToRegion(a, b, c); 00142 } 00143 00144 #define ClipCGContextToRegion(a, b, c) { \ 00145 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00146 dbgClipCGContextToRegion(a, b, c); \ 00147 fprintf(stderr, "\n"); } 00148 00149 inline void dbgCGContextMoveToPoint(CGContextRef context, float x, float y) 00150 { 00151 CGContextMoveToPoint(context, x, y); 00152 } 00153 00154 #define CGContextMoveToPoint(a, b, c) { \ 00155 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00156 dbgCGContextMoveToPoint(a, b, c); \ 00157 fprintf(stderr, "\n"); } 00158 00159 inline void dbgCGContextFillPath(CGContextRef context) 00160 { 00161 CGContextFillPath(context); 00162 } 00163 00164 #define CGContextFillPath(a) { \ 00165 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00166 dbgCGContextFillPath(a); \ 00167 fprintf(stderr, "\n"); } 00168 00169 inline void dbgCGContextClosePath(CGContextRef context) 00170 { 00171 CGContextClosePath(context); 00172 } 00173 00174 #define CGContextClosePath(a) { \ 00175 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00176 dbgCGContextClosePath(a); \ 00177 fprintf(stderr, "\n"); } 00178 00179 inline void dbgCGContextFlush(CGContextRef context) 00180 { 00181 CGContextFlush(context); 00182 } 00183 00184 #define CGContextFlush(a) { \ 00185 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00186 dbgCGContextFlush(a); \ 00187 fprintf(stderr, "\n"); } 00188 00189 inline void dbgCGContextSaveGState(CGContextRef context) 00190 { 00191 CGContextSaveGState(context); 00192 } 00193 00194 #define CGContextSaveGState(a) { \ 00195 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00196 dbgCGContextSaveGState(a); \ 00197 fprintf(stderr, "\n"); } 00198 00199 inline void dbgCGContextRestoreGState(CGContextRef context) 00200 { 00201 CGContextRestoreGState(context); 00202 } 00203 00204 #define CGContextRestoreGState(a) { \ 00205 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \ 00206 dbgCGContextRestoreGState(a); \ 00207 fprintf(stderr, "\n"); } 00208 00209 00210 #endif 00211 00212 // 00213 // End of "$Id$". 00214 // 00215