Blame src/cgdebug.h

Packit Service 9ac617
//
Packit Service 9ac617
// "$Id: cgdebug.h 8864 2011-07-19 04:49:30Z greg.ercolano $"
Packit Service 9ac617
//
Packit Service 9ac617
// OS X Core Graphics debugging help for the Fast Light Tool Kit (FLTK).
Packit Service 9ac617
//
Packit Service 9ac617
// Copyright 1998-2010 by Bill Spitzak and others.
Packit Service 9ac617
//
Packit Service 9ac617
// This library is free software. Distribution and use rights are outlined in
Packit Service 9ac617
// the file "COPYING" which should have been included with this file.  If this
Packit Service 9ac617
// file is missing or damaged, see the license at:
Packit Service 9ac617
//
Packit Service 9ac617
//     http://www.fltk.org/COPYING.php
Packit Service 9ac617
//
Packit Service 9ac617
// Please report all bugs and problems on the following page:
Packit Service 9ac617
//
Packit Service 9ac617
//     http://www.fltk.org/str.php
Packit Service 9ac617
//
Packit Service 9ac617
Packit Service 9ac617
// This file allows easier debugging of Mac OS X Core Graphics 
Packit Service 9ac617
// code. This file is normally not included into any FLTK builds,
Packit Service 9ac617
// but since it has proven to be tremendously useful in debugging
Packit Service 9ac617
// the FLTK port to "Quartz", I decided to add this file in case
Packit Service 9ac617
// more bugs show up.
Packit Service 9ac617
//
Packit Service 9ac617
// This header is activated by adding the following
Packit Service 9ac617
// line to "config.h"
Packit Service 9ac617
//   #include "src/cgdebug.h"
Packit Service 9ac617
//
Packit Service 9ac617
// Running "./configure" will remove this line from "config.h".
Packit Service 9ac617
//
Packit Service 9ac617
// When used erreanously, Core Graphics prints warnings to 
Packit Service 9ac617
// stderr. This is helpful, however it is not possible to 
Packit Service 9ac617
// associate a line number or source file with the warning message.
Packit Service 9ac617
// This headr file outputs a trace of CG calls, interweaveing
Packit Service 9ac617
// them with CG warnings.
Packit Service 9ac617
//
Packit Service 9ac617
// Matthias
Packit Service 9ac617
Packit Service 9ac617
#ifndef CGDEBUG
Packit Service 9ac617
#define CGDEBUG
Packit Service 9ac617
Packit Service 9ac617
#include <stdio.h>
Packit Service 9ac617
#include <Carbon/Carbon.h>
Packit Service 9ac617
Packit Service 9ac617
//+BitmapContextCreate
Packit Service 9ac617
//+BitmapContextGetData
Packit Service 9ac617
// ClipCGContextToRegion
Packit Service 9ac617
// QDBeginCGContext
Packit Service 9ac617
// QDEndCGContext
Packit Service 9ac617
Packit Service 9ac617
//+AddArc
Packit Service 9ac617
//+AddLineToPoint
Packit Service 9ac617
// ClipToRect
Packit Service 9ac617
// ClosePath
Packit Service 9ac617
//+ConcatCTM
Packit Service 9ac617
//+DrawImage
Packit Service 9ac617
// FillPath
Packit Service 9ac617
// FillRect
Packit Service 9ac617
// Flush
Packit Service 9ac617
//+GetCTM
Packit Service 9ac617
// MoveToPoint
Packit Service 9ac617
//+Release
Packit Service 9ac617
// RestoreGState
Packit Service 9ac617
// SaveGState
Packit Service 9ac617
//+ScaleCTM
Packit Service 9ac617
//+SetLineCap
Packit Service 9ac617
//+SetLineDash
Packit Service 9ac617
//+SetLineJoin
Packit Service 9ac617
//+SetLineWidth
Packit Service 9ac617
//+SetRGBFillColor
Packit Service 9ac617
//+SetRGBStrokeColor
Packit Service 9ac617
//+SetShouldAntialias
Packit Service 9ac617
//+SetTextMatrix
Packit Service 9ac617
//+StrokePath
Packit Service 9ac617
//+TranslateCTM
Packit Service 9ac617
Packit Service 9ac617
inline OSStatus dbgLocation(const char *file, int line) 
Packit Service 9ac617
{
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", file, line);
Packit Service 9ac617
  return 0;
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
inline OSStatus dbgEndl()     
Packit Service 9ac617
{
Packit Service 9ac617
  fprintf(stderr, "\n");
Packit Service 9ac617
  return 0;
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
Packit Service 9ac617
inline void dbgCGContextClipToRect(CGContextRef a, CGRect b)
Packit Service 9ac617
{
Packit Service 9ac617
  CGContextClipToRect(a, b);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define CGContextClipToRect(a, b) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgCGContextClipToRect(a, b); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
inline void dbgCGContextFillRect(CGContextRef a, CGRect b)
Packit Service 9ac617
{
Packit Service 9ac617
  CGContextFillRect(a, b);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define CGContextFillRect(a, b) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgCGContextFillRect(a, b); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
inline OSStatus dbgQDEndCGContext(CGrafPtr a, CGContextRef *b) 
Packit Service 9ac617
{
Packit Service 9ac617
  return QDEndCGContext(a, b);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define QDEndCGContext(a, b) ( \
Packit Service 9ac617
  dbgLocation(__FILE__, __LINE__) + \
Packit Service 9ac617
  dbgQDEndCGContext(a, b) + \
Packit Service 9ac617
  dbgEndl() )
Packit Service 9ac617
Packit Service 9ac617
inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b) 
Packit Service 9ac617
{
Packit Service 9ac617
  return QDBeginCGContext(a, b);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define QDBeginCGContext(a, b) ( \
Packit Service 9ac617
  dbgLocation(__FILE__, __LINE__) + \
Packit Service 9ac617
  dbgQDBeginCGContext(a, b) + \
Packit Service 9ac617
  dbgEndl() )
Packit Service 9ac617
Packit Service 9ac617
inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c) 
Packit Service 9ac617
{
Packit Service 9ac617
  ClipCGContextToRegion(a, b, c);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define ClipCGContextToRegion(a, b, c) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgClipCGContextToRegion(a, b, c); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
inline void dbgCGContextMoveToPoint(CGContextRef context, float x, float y)
Packit Service 9ac617
{
Packit Service 9ac617
  CGContextMoveToPoint(context, x, y);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define CGContextMoveToPoint(a, b, c) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgCGContextMoveToPoint(a, b, c); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
inline void dbgCGContextFillPath(CGContextRef context)
Packit Service 9ac617
{ 
Packit Service 9ac617
  CGContextFillPath(context);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define CGContextFillPath(a) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgCGContextFillPath(a); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
inline void dbgCGContextClosePath(CGContextRef context)
Packit Service 9ac617
{ 
Packit Service 9ac617
  CGContextClosePath(context);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define CGContextClosePath(a) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgCGContextClosePath(a); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
inline void dbgCGContextFlush(CGContextRef context)
Packit Service 9ac617
{ 
Packit Service 9ac617
  CGContextFlush(context);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define CGContextFlush(a) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgCGContextFlush(a); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
inline void dbgCGContextSaveGState(CGContextRef context)
Packit Service 9ac617
{ 
Packit Service 9ac617
  CGContextSaveGState(context);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define CGContextSaveGState(a) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgCGContextSaveGState(a); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
inline void dbgCGContextRestoreGState(CGContextRef context)
Packit Service 9ac617
{ 
Packit Service 9ac617
  CGContextRestoreGState(context);
Packit Service 9ac617
}
Packit Service 9ac617
Packit Service 9ac617
#define CGContextRestoreGState(a) { \
Packit Service 9ac617
  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
Packit Service 9ac617
  dbgCGContextRestoreGState(a); \
Packit Service 9ac617
  fprintf(stderr, "\n"); }
Packit Service 9ac617
Packit Service 9ac617
Packit Service 9ac617
#endif
Packit Service 9ac617
Packit Service 9ac617
//
Packit Service 9ac617
// End of "$Id: cgdebug.h 8864 2011-07-19 04:49:30Z greg.ercolano $".
Packit Service 9ac617
//
Packit Service 9ac617