Tweak themes for more color consistency.
[ntk.git] / src / cgdebug.h
blob469beb58df658ea63ce80dba0adfb3c89c67feb6
1 //
2 // "$Id: cgdebug.h 7913 2010-11-29 18:18:27Z greg.ercolano $"
3 //
4 // OS X Core Graphics debugging help for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 // This file allows easier debugging of Mac OS X Core Graphics
29 // code. This file is normally not included into any FLTK builds,
30 // but since it has proven to be tremendously useful in debugging
31 // the FLTK port to "Quartz", I decided to add this file in case
32 // more bugs show up.
34 // This header is activated by adding the following
35 // line to "config.h"
36 // #include "src/cgdebug.h"
38 // Running "./configure" will remove this line from "config.h".
40 // When used erreanously, Core Graphics prints warnings to
41 // stderr. This is helpful, however it is not possible to
42 // associate a line number or source file with the warning message.
43 // This headr file outputs a trace of CG calls, interweaveing
44 // them with CG warnings.
46 // Matthias
48 #ifndef CGDEBUG
49 #define CGDEBUG
51 #include <stdio.h>
52 #include <Carbon/Carbon.h>
54 //+BitmapContextCreate
55 //+BitmapContextGetData
56 // ClipCGContextToRegion
57 // QDBeginCGContext
58 // QDEndCGContext
60 //+AddArc
61 //+AddLineToPoint
62 // ClipToRect
63 // ClosePath
64 //+ConcatCTM
65 //+DrawImage
66 // FillPath
67 // FillRect
68 // Flush
69 //+GetCTM
70 // MoveToPoint
71 //+Release
72 // RestoreGState
73 // SaveGState
74 //+ScaleCTM
75 //+SetLineCap
76 //+SetLineDash
77 //+SetLineJoin
78 //+SetLineWidth
79 //+SetRGBFillColor
80 //+SetRGBStrokeColor
81 //+SetShouldAntialias
82 //+SetTextMatrix
83 //+StrokePath
84 //+TranslateCTM
86 inline OSStatus dbgLocation(const char *file, int line)
88 fprintf(stderr, "%s:%d ", file, line);
89 return 0;
92 inline OSStatus dbgEndl()
94 fprintf(stderr, "\n");
95 return 0;
99 inline void dbgCGContextClipToRect(CGContextRef a, CGRect b)
101 CGContextClipToRect(a, b);
104 #define CGContextClipToRect(a, b) { \
105 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
106 dbgCGContextClipToRect(a, b); \
107 fprintf(stderr, "\n"); }
109 inline void dbgCGContextFillRect(CGContextRef a, CGRect b)
111 CGContextFillRect(a, b);
114 #define CGContextFillRect(a, b) { \
115 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
116 dbgCGContextFillRect(a, b); \
117 fprintf(stderr, "\n"); }
119 inline OSStatus dbgQDEndCGContext(CGrafPtr a, CGContextRef *b)
121 return QDEndCGContext(a, b);
124 #define QDEndCGContext(a, b) ( \
125 dbgLocation(__FILE__, __LINE__) + \
126 dbgQDEndCGContext(a, b) + \
127 dbgEndl() )
129 inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b)
131 return QDBeginCGContext(a, b);
134 #define QDBeginCGContext(a, b) ( \
135 dbgLocation(__FILE__, __LINE__) + \
136 dbgQDBeginCGContext(a, b) + \
137 dbgEndl() )
139 inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c)
141 ClipCGContextToRegion(a, b, c);
144 #define ClipCGContextToRegion(a, b, c) { \
145 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
146 dbgClipCGContextToRegion(a, b, c); \
147 fprintf(stderr, "\n"); }
149 inline void dbgCGContextMoveToPoint(CGContextRef context, float x, float y)
151 CGContextMoveToPoint(context, x, y);
154 #define CGContextMoveToPoint(a, b, c) { \
155 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
156 dbgCGContextMoveToPoint(a, b, c); \
157 fprintf(stderr, "\n"); }
159 inline void dbgCGContextFillPath(CGContextRef context)
161 CGContextFillPath(context);
164 #define CGContextFillPath(a) { \
165 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
166 dbgCGContextFillPath(a); \
167 fprintf(stderr, "\n"); }
169 inline void dbgCGContextClosePath(CGContextRef context)
171 CGContextClosePath(context);
174 #define CGContextClosePath(a) { \
175 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
176 dbgCGContextClosePath(a); \
177 fprintf(stderr, "\n"); }
179 inline void dbgCGContextFlush(CGContextRef context)
181 CGContextFlush(context);
184 #define CGContextFlush(a) { \
185 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
186 dbgCGContextFlush(a); \
187 fprintf(stderr, "\n"); }
189 inline void dbgCGContextSaveGState(CGContextRef context)
191 CGContextSaveGState(context);
194 #define CGContextSaveGState(a) { \
195 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
196 dbgCGContextSaveGState(a); \
197 fprintf(stderr, "\n"); }
199 inline void dbgCGContextRestoreGState(CGContextRef context)
201 CGContextRestoreGState(context);
204 #define CGContextRestoreGState(a) { \
205 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
206 dbgCGContextRestoreGState(a); \
207 fprintf(stderr, "\n"); }
210 #endif
213 // End of "$Id: cgdebug.h 7913 2010-11-29 18:18:27Z greg.ercolano $".