FLTK 1.3.2

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

- File List
- File Members

cgdebug.h

    00001 //
    00002 // "$Id: cgdebug.h 8864 2011-07-19 04:49:30Z greg.ercolano $"
    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. Distribution and use rights are outlined in
    00009 // the file "COPYING" which should have been included with this file.  If this
    00010 // file is missing or damaged, see the license at:
    00011 //
    00012 //     http://www.fltk.org/COPYING.php
    00013 //
    00014 // Please report all bugs and problems on the following page:
    00015 //
    00016 //     http://www.fltk.org/str.php
    00017 //
    00018
    00019 // This file allows easier debugging of Mac OS X Core Graphics
    00020 // code. This file is normally not included into any FLTK builds,
    00021 // but since it has proven to be tremendously useful in debugging
    00022 // the FLTK port to "Quartz", I decided to add this file in case
    00023 // more bugs show up.
    00024 //
    00025 // This header is activated by adding the following
    00026 // line to "config.h"
    00027 //   #include "src/cgdebug.h"
    00028 //
    00029 // Running "./configure" will remove this line from "config.h".
    00030 //
    00031 // When used erreanously, Core Graphics prints warnings to
    00032 // stderr. This is helpful, however it is not possible to
    00033 // associate a line number or source file with the warning message.
    00034 // This headr file outputs a trace of CG calls, interweaveing
    00035 // them with CG warnings.
    00036 //
    00037 // Matthias
    00038
    00039 #ifndef CGDEBUG
    00040 #define CGDEBUG
    00041
    00042 #include <stdio.h>
    00043 #include <Carbon/Carbon.h>
    00044
    00045 //+BitmapContextCreate
    00046 //+BitmapContextGetData
    00047 // ClipCGContextToRegion
    00048 // QDBeginCGContext
    00049 // QDEndCGContext
    00050
    00051 //+AddArc
    00052 //+AddLineToPoint
    00053 // ClipToRect
    00054 // ClosePath
    00055 //+ConcatCTM
    00056 //+DrawImage
    00057 // FillPath
    00058 // FillRect
    00059 // Flush
    00060 //+GetCTM
    00061 // MoveToPoint
    00062 //+Release
    00063 // RestoreGState
    00064 // SaveGState
    00065 //+ScaleCTM
    00066 //+SetLineCap
    00067 //+SetLineDash
    00068 //+SetLineJoin
    00069 //+SetLineWidth
    00070 //+SetRGBFillColor
    00071 //+SetRGBStrokeColor
    00072 //+SetShouldAntialias
    00073 //+SetTextMatrix
    00074 //+StrokePath
    00075 //+TranslateCTM
    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 // End of "$Id: cgdebug.h 8864 2011-07-19 04:49:30Z greg.ercolano $".
    00205 //
    00206