summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Fl_Bitmap.cxx2
-rw-r--r--src/Fl_Double_Window.cxx2
-rw-r--r--src/Fl_Image.cxx2
-rw-r--r--src/Fl_get_system_colors.cxx9
-rw-r--r--src/Fl_mac.cxx6
-rw-r--r--src/cgdebug.h203
-rw-r--r--src/fl_draw_image_mac.cxx2
-rw-r--r--src/fl_draw_pixmap.cxx2
-rw-r--r--src/fl_font_mac.cxx6
-rw-r--r--test/fractals.cxx8
10 files changed, 223 insertions, 19 deletions
diff --git a/src/Fl_Bitmap.cxx b/src/Fl_Bitmap.cxx
index 46425e98d..ae49d934e 100644
--- a/src/Fl_Bitmap.cxx
+++ b/src/Fl_Bitmap.cxx
@@ -396,7 +396,7 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
#elif defined(__APPLE_QUARTZ__)
if (!id) id = fl_create_bitmask(w(), h(), array);
if (id && fl_gc) {
- CGRect rect = { X, Y, W, H };
+ CGRect rect = { { X, Y }, { W, H } };
Fl_X::q_begin_image(rect, cx, cy, w(), h());
CGContextDrawImage(fl_gc, rect, (CGImageRef)id);
Fl_X::q_end_image();
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx
index add438801..e1fa64e67 100644
--- a/src/Fl_Double_Window.cxx
+++ b/src/Fl_Double_Window.cxx
@@ -202,7 +202,7 @@ void fl_copy_offscreen(int x,int y,int w,int h,Fl_Offscreen osrc,int srcx,int sr
CGImageRef img = CGImageCreate( sw, sh, 8, 4*8, 4*sw, lut, alpha,
src_bytes, 0L, false, kCGRenderingIntentDefault);
// fl_push_clip();
- CGRect rect = { x, y, w, h };
+ CGRect rect = { { x, y }, { w, h } };
Fl_X::q_begin_image(rect, srcx, srcy, sw, sh);
CGContextDrawImage(fl_gc, rect, img);
Fl_X::q_end_image();
diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx
index 329a71288..cd992e9fc 100644
--- a/src/Fl_Image.cxx
+++ b/src/Fl_Image.cxx
@@ -397,7 +397,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
}
#elif defined(__APPLE_QUARTZ__)
if (id && fl_gc) {
- CGRect rect = { X, Y, W, H };
+ CGRect rect = { { X, Y }, { W, H } };
Fl_X::q_begin_image(rect, cx, cy, w(), h());
CGContextDrawImage(fl_gc, rect, (CGImageRef)id);
Fl_X::q_end_image();
diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx
index 67a8802e9..24fae8714 100644
--- a/src/Fl_get_system_colors.cxx
+++ b/src/Fl_get_system_colors.cxx
@@ -165,10 +165,17 @@ void Fl::get_system_colors()
{
fl_open_display();
+ OSStatus err;
if (!fl_bg2_set) background2(0xff, 0xff, 0xff);
if (!fl_fg_set) foreground(0, 0, 0);
if (!fl_bg_set) background(0xd8, 0xd8, 0xd8);
- set_selection_color(0x00, 0x00, 0x80);
+
+ RGBColor c;
+ err = GetThemeBrushAsColor(kThemeBrushPrimaryHighlightColor, 24, true, &c);
+ if (err)
+ set_selection_color(0x00, 0x00, 0x80);
+ else
+ set_selection_color(c.red, c.green, c.blue);
}
#else
diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx
index a73c493ea..5a7db50ac 100644
--- a/src/Fl_mac.cxx
+++ b/src/Fl_mac.cxx
@@ -2066,15 +2066,15 @@ void Fl_Window::make_current()
DiffRgn( fl_window_region, r, fl_window_region );
DisposeRgn( r );
}
-
- fl_clip_region( 0 );
- SetPortClipRegion( GetWindowPort(i->xid), fl_window_region );
+
#ifdef __APPLE_QUARTZ__
QDBeginCGContext(GetWindowPort(i->xid), &i->gc);
fl_gc = i->gc;
CGContextSaveGState(fl_gc);
Fl_X::q_fill_context();
#endif
+ fl_clip_region( 0 );
+ SetPortClipRegion( GetWindowPort(i->xid), fl_window_region );
return;
}
diff --git a/src/cgdebug.h b/src/cgdebug.h
new file mode 100644
index 000000000..3d11158ff
--- /dev/null
+++ b/src/cgdebug.h
@@ -0,0 +1,203 @@
+//
+// "$Id:$"
+//
+// OS X Core Graphics debugging help for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2005 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+// This file allows easier debugging of Mac OS X Core Graphics
+// code. This file is normally not included into any FLTK builds,
+// but since it has proven to be tremendously useful in debugging
+// the FLTK port to "Quartz", I decided to add this file in case
+// more bugs show up.
+//
+// This header is activated by adding the following
+// line to "config.h"
+// #include "src/cgdebug.h"
+//
+// Running "./configure" will remove this line from "config.h".
+//
+// When used erreanously, Core Graphics prints warnings to
+// stderr. This is helpful, however it is not possible to
+// associate a line number or source file with the warning message.
+// This headr file outputs a trace of CG calls, interweaveing
+// them with CG warnings.
+//
+// Matthias
+
+#ifndef CGDEBUG
+#define CGDEBUG
+
+#include <stdio.h>
+#include <Carbon/Carbon.h>
+
+//+BitmapContextCreate
+//+BitmapContextGetData
+// ClipCGContextToRegion
+// QDBeginCGContext
+// QDEndCGContext
+
+//+AddArc
+//+AddLineToPoint
+// ClipToRect
+// ClosePath
+//+ConcatCTM
+//+DrawImage
+// FillPath
+// FillRect
+// Flush
+//+GetCTM
+// MoveToPoint
+//+Release
+// RestoreGState
+// SaveGState
+//+ScaleCTM
+//+SetLineCap
+//+SetLineDash
+//+SetLineJoin
+//+SetLineWidth
+//+SetRGBFillColor
+//+SetRGBStrokeColor
+//+SetShouldAntialias
+//+SetTextMatrix
+//+StrokePath
+//+TranslateCTM
+
+
+inline void dbgCGContextClipToRect(CGContextRef a, CGRect b)
+{
+ CGContextClipToRect(a, b);
+}
+
+#define CGContextClipToRect(a, b) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgCGContextClipToRect(a, b); \
+ fprintf(stderr, "\n"); }
+
+inline void dbgCGContextFillRect(CGContextRef a, CGRect b)
+{
+ CGContextFillRect(a, b);
+}
+
+#define CGContextFillRect(a, b) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgCGContextFillRect(a, b); \
+ fprintf(stderr, "\n"); }
+
+inline OSStatus dbgQDEndCGContext(CGrafPtr a, CGContextRef *b)
+{
+ return QDEndCGContext(a, b);
+}
+
+#define QDEndCGContext(a, b) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgQDEndCGContext(a, b); \
+ fprintf(stderr, "\n"); }
+
+inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b)
+{
+ return QDBeginCGContext(a, b);
+}
+
+#define QDBeginCGContext(a, b) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgQDBeginCGContext(a, b); \
+ fprintf(stderr, "\n"); }
+
+inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c)
+{
+ ClipCGContextToRegion(a, b, c);
+}
+
+#define ClipCGContextToRegion(a, b, c) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgClipCGContextToRegion(a, b, c); \
+ fprintf(stderr, "\n"); }
+
+inline void dbgCGContextMoveToPoint(CGContextRef context, float x, float y)
+{
+ CGContextMoveToPoint(context, x, y);
+}
+
+#define CGContextMoveToPoint(a, b, c) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgCGContextMoveToPoint(a, b, c); \
+ fprintf(stderr, "\n"); }
+
+inline void dbgCGContextFillPath(CGContextRef context)
+{
+ CGContextFillPath(context);
+}
+
+#define CGContextFillPath(a) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgCGContextFillPath(a); \
+ fprintf(stderr, "\n"); }
+
+inline void dbgCGContextClosePath(CGContextRef context)
+{
+ CGContextClosePath(context);
+}
+
+#define CGContextClosePath(a) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgCGContextClosePath(a); \
+ fprintf(stderr, "\n"); }
+
+inline void dbgCGContextFlush(CGContextRef context)
+{
+ CGContextFlush(context);
+}
+
+#define CGContextFlush(a) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgCGContextFlush(a); \
+ fprintf(stderr, "\n"); }
+
+inline void dbgCGContextSaveGState(CGContextRef context)
+{
+ CGContextSaveGState(context);
+}
+
+#define CGContextSaveGState(a) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgCGContextSaveGState(a); \
+ fprintf(stderr, "\n"); }
+
+inline void dbgCGContextRestoreGState(CGContextRef context)
+{
+ CGContextRestoreGState(context);
+}
+
+#define CGContextRestoreGState(a) { \
+ fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+ dbgCGContextRestoreGState(a); \
+ fprintf(stderr, "\n"); }
+
+
+#endif
+
+//
+// End of "$Id:$".
+//
+
diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx
index e9c3344de..c0f8a451f 100644
--- a/src/fl_draw_image_mac.cxx
+++ b/src/fl_draw_image_mac.cxx
@@ -185,7 +185,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
src, 0L, false, kCGRenderingIntentDefault);
// draw the image into the destination context
if (img) {
- CGRect rect = { X, Y, W, H };
+ CGRect rect = { { X, Y }, { W, H } };
Fl_X::q_begin_image(rect, 0, 0, W, H);
CGContextDrawImage(fl_gc, rect, img);
Fl_X::q_end_image();
diff --git a/src/fl_draw_pixmap.cxx b/src/fl_draw_pixmap.cxx
index a1fb81d8a..c242b7324 100644
--- a/src/fl_draw_pixmap.cxx
+++ b/src/fl_draw_pixmap.cxx
@@ -322,7 +322,7 @@ int fl_draw_pixmap(const char*const* di, int x, int y, Fl_Color bg) {
src, 0L, false, kCGRenderingIntentDefault);
CGColorSpaceRelease(lut);
CGDataProviderRelease(src);
- CGRect rect = { x, y, d.w, d.h };
+ CGRect rect = { { x, y} , { d.w, d.h } };
Fl_X::q_begin_image(rect, x, y, d.w, d.h);
CGContextDrawImage(fl_gc, rect, img);
Fl_X::q_end_image();
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index d34d4debf..b35aaebdb 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -27,12 +27,6 @@
#include <config.h>
-//: MeasureText, FontMetrics, WidthTabHandle, GetSysFont, SysFontSize
-//: TextSize, TextFont
-//: GetFNum (theName: Str255; VAR familyID: Integer);
-//: FUNCTION FMSwapFont (inRec: FMInput): FMOutPtr;
-//: SetFractEnable
-
Fl_FontSize::Fl_FontSize(const char* name, int Size) {
next = 0;
# if HAVE_GL
diff --git a/test/fractals.cxx b/test/fractals.cxx
index 65869eef8..8eea74504 100644
--- a/test/fractals.cxx
+++ b/test/fractals.cxx
@@ -95,7 +95,7 @@ typedef enum { NOTALLOWED, MOUNTAIN, TREE, ISLAND, BIGMTN, STEM, LEAF,
#define MAXLEVEL 8
int Rebuild = 1, /* Rebuild display list in next display? */
- Fract = TREE, /* What fractal are we building */
+ fractal = TREE, /* What fractal are we building */
Level = 4; /* levels of recursion for fractals */
int DrawAxes = 0;
@@ -642,11 +642,11 @@ void display(void)
glLoadIdentity();
if (Rebuild) {
- Create(Fract);
+ Create(fractal);
Rebuild = 0;
}
- glCallList(Fract);
+ glCallList(fractal);
if (DrawAxes)
glCallList(AXES);
@@ -713,7 +713,7 @@ void setlevel(int value)
void choosefract(int value)
{
- Fract = value;
+ fractal = value;
Rebuild = 1;
glutPostRedisplay();
}