FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

cgdebug.h
1 //
2 // "$Id: cgdebug.h 8864 2011-07-19 04:49:30Z 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. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18
19 // This file allows easier debugging of Mac OS X Core Graphics
20 // code. This file is normally not included into any FLTK builds,
21 // but since it has proven to be tremendously useful in debugging
22 // the FLTK port to "Quartz", I decided to add this file in case
23 // more bugs show up.
24 //
25 // This header is activated by adding the following
26 // line to "config.h"
27 // #include "src/cgdebug.h"
28 //
29 // Running "./configure" will remove this line from "config.h".
30 //
31 // When used erreanously, Core Graphics prints warnings to
32 // stderr. This is helpful, however it is not possible to
33 // associate a line number or source file with the warning message.
34 // This headr file outputs a trace of CG calls, interweaveing
35 // them with CG warnings.
36 //
37 // Matthias
38
39 #ifndef CGDEBUG
40 #define CGDEBUG
41
42 #include <stdio.h>
43 #include <Carbon/Carbon.h>
44
45 //+BitmapContextCreate
46 //+BitmapContextGetData
47 // ClipCGContextToRegion
48 // QDBeginCGContext
49 // QDEndCGContext
50
51 //+AddArc
52 //+AddLineToPoint
53 // ClipToRect
54 // ClosePath
55 //+ConcatCTM
56 //+DrawImage
57 // FillPath
58 // FillRect
59 // Flush
60 //+GetCTM
61 // MoveToPoint
62 //+Release
63 // RestoreGState
64 // SaveGState
65 //+ScaleCTM
66 //+SetLineCap
67 //+SetLineDash
68 //+SetLineJoin
69 //+SetLineWidth
70 //+SetRGBFillColor
71 //+SetRGBStrokeColor
72 //+SetShouldAntialias
73 //+SetTextMatrix
74 //+StrokePath
75 //+TranslateCTM
76
77 inline OSStatus dbgLocation(const char *file, int line)
78 {
79 fprintf(stderr, "%s:%d ", file, line);
80 return 0;
81 }
82
83 inline OSStatus dbgEndl()
84 {
85 fprintf(stderr, "\n");
86 return 0;
87 }
88
89
90 inline void dbgCGContextClipToRect(CGContextRef a, CGRect b)
91 {
92 CGContextClipToRect(a, b);
93 }
94
95 #define CGContextClipToRect(a, b) { \
96 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
97 dbgCGContextClipToRect(a, b); \
98 fprintf(stderr, "\n"); }
99
100 inline void dbgCGContextFillRect(CGContextRef a, CGRect b)
101 {
102 CGContextFillRect(a, b);
103 }
104
105 #define CGContextFillRect(a, b) { \
106 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
107 dbgCGContextFillRect(a, b); \
108 fprintf(stderr, "\n"); }
109
110 inline OSStatus dbgQDEndCGContext(CGrafPtr a, CGContextRef *b)
111 {
112 return QDEndCGContext(a, b);
113 }
114
115 #define QDEndCGContext(a, b) ( \
116 dbgLocation(__FILE__, __LINE__) + \
117 dbgQDEndCGContext(a, b) + \
118 dbgEndl() )
119
120 inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b)
121 {
122 return QDBeginCGContext(a, b);
123 }
124
125 #define QDBeginCGContext(a, b) ( \
126 dbgLocation(__FILE__, __LINE__) + \
127 dbgQDBeginCGContext(a, b) + \
128 dbgEndl() )
129
130 inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c)
131 {
132 ClipCGContextToRegion(a, b, c);
133 }
134
135 #define ClipCGContextToRegion(a, b, c) { \
136 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
137 dbgClipCGContextToRegion(a, b, c); \
138 fprintf(stderr, "\n"); }
139
140 inline void dbgCGContextMoveToPoint(CGContextRef context, float x, float y)
141 {
142 CGContextMoveToPoint(context, x, y);
143 }
144
145 #define CGContextMoveToPoint(a, b, c) { \
146 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
147 dbgCGContextMoveToPoint(a, b, c); \
148 fprintf(stderr, "\n"); }
149
150 inline void dbgCGContextFillPath(CGContextRef context)
151 {
152 CGContextFillPath(context);
153 }
154
155 #define CGContextFillPath(a) { \
156 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
157 dbgCGContextFillPath(a); \
158 fprintf(stderr, "\n"); }
159
160 inline void dbgCGContextClosePath(CGContextRef context)
161 {
162 CGContextClosePath(context);
163 }
164
165 #define CGContextClosePath(a) { \
166 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
167 dbgCGContextClosePath(a); \
168 fprintf(stderr, "\n"); }
169
170 inline void dbgCGContextFlush(CGContextRef context)
171 {
172 CGContextFlush(context);
173 }
174
175 #define CGContextFlush(a) { \
176 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
177 dbgCGContextFlush(a); \
178 fprintf(stderr, "\n"); }
179
180 inline void dbgCGContextSaveGState(CGContextRef context)
181 {
182 CGContextSaveGState(context);
183 }
184
185 #define CGContextSaveGState(a) { \
186 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
187 dbgCGContextSaveGState(a); \
188 fprintf(stderr, "\n"); }
189
190 inline void dbgCGContextRestoreGState(CGContextRef context)
191 {
192 CGContextRestoreGState(context);
193 }
194
195 #define CGContextRestoreGState(a) { \
196 fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
197 dbgCGContextRestoreGState(a); \
198 fprintf(stderr, "\n"); }
199
200
201 #endif
202
203 //
204 // End of "$Id: cgdebug.h 8864 2011-07-19 04:49:30Z greg.ercolano $".
205 //
206
- © 1998-2012 by Bill Spitzak and others.