Author: manolo
Date: 2010-03-03 09:38:28 -0800 (Wed, 03 Mar 2010)
New Revision: 7205
Log:
Replaced use of global fl_isprintcontext by better Fl_Device::current()->type()
Modified:
branches/branch-1.3-Fl_Printer/FL/mac.H
branches/branch-1.3-Fl_Printer/FL/win32.H
branches/branch-1.3-Fl_Printer/src/Fl.cxx
branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx
branches/branch-1.3-Fl_Printer/src/Fl_Gl_Printer.cxx
branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm
branches/branch-1.3-Fl_Printer/src/Fl_cocoa.mm
branches/branch-1.3-Fl_Printer/src/Fl_win32.cxx
branches/branch-1.3-Fl_Printer/src/fl_draw_image_win32.cxx
branches/branch-1.3-Fl_Printer/src/fl_font_win32.cxx
branches/branch-1.3-Fl_Printer/src/fl_line_style.cxx
branches/branch-1.3-Fl_Printer/src/fl_rect.cxx
Modified: branches/branch-1.3-Fl_Printer/FL/mac.H
===================================================================
--- branches/branch-1.3-Fl_Printer/FL/mac.H 2010-03-03 16:38:57 UTC (rev
7204)
+++ branches/branch-1.3-Fl_Printer/FL/mac.H 2010-03-03 17:38:28 UTC (rev
7205)
@@ -79,16 +79,13 @@
int count;
CGRect *rects;
} *Fl_Region; // a region is the union of a series of rectangles
-extern bool fl_isprintcontext;
-// so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes
-#define FL_CGRECTMAKE_COCOA(x,y,w,h) \
-(fl_isprintcontext ? CGRectMake(x, y, w-1.5 , h-1.5 ) : CGRectMake(x, y, w > 0
? w - 0.9 : 0, h > 0 ? h - 0.9 : 0) )
+extern CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h);
inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
Fl_Region R = (Fl_Region)malloc(sizeof(*R));
R->count = 1;
R->rects = (CGRect *)malloc(sizeof(CGRect));
- *(R->rects) = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ *(R->rects) = fl_cgrectmake_cocoa(x, y, w, h);
return R;
}
inline void XDestroyRegion(Fl_Region r) {
Modified: branches/branch-1.3-Fl_Printer/FL/win32.H
===================================================================
--- branches/branch-1.3-Fl_Printer/FL/win32.H 2010-03-03 16:38:57 UTC (rev
7204)
+++ branches/branch-1.3-Fl_Printer/FL/win32.H 2010-03-03 17:38:28 UTC (rev
7205)
@@ -45,18 +45,15 @@
#define VK_APPS 0x5D
#endif
+#include <FL/Fl_Device.H>
+
// some random X equivalents
typedef HWND Window;
typedef POINT XPoint;
struct XRectangle {int x, y, width, height;};
typedef HRGN Fl_Region;
FL_EXPORT void fl_clip_region(Fl_Region);
-extern Fl_Region fl_win_makecliprectregion(int x, int y, int w, int h);
-extern BOOL fl_isprintcontext;
-inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
- if (!fl_isprintcontext) return CreateRectRgn(x,y,x+w,y+h);
- return fl_win_makecliprectregion(x, y, w, h);
-}
+extern Fl_Region XRectangleRegion(int x, int y, int w, int h);
inline void XDestroyRegion(Fl_Region r) {DeleteObject(r);}
inline void XClipBox(Fl_Region r,XRectangle* rect) {
RECT win_rect; GetRgnBox(r,&win_rect);
Modified: branches/branch-1.3-Fl_Printer/src/Fl.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl.cxx 2010-03-03 16:38:57 UTC (rev
7204)
+++ branches/branch-1.3-Fl_Printer/src/Fl.cxx 2010-03-03 17:38:28 UTC (rev
7205)
@@ -1474,7 +1474,7 @@
XDestroyRegion(R);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- CGRect arg = FL_CGRECTMAKE_COCOA(X, Y, W, H);
+ CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H);
int j; // don't add a rectangle totally inside the Fl_Region
for(j = 0; j < i->region->count; j++) {
if(CGRectContainsRect(i->region->rects[j], arg)) break;
Modified: branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx 2010-03-03
16:38:57 UTC (rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/Fl_GDI_Printer.cxx 2010-03-03
17:38:28 UTC (rev 7205)
@@ -165,7 +165,6 @@
origin(0, 0);
image_list_ = NULL;
fl_clip_region(0);
- fl_isprintcontext = true;
}
return rsult;
}
@@ -202,7 +201,6 @@
{
int rsult;
- fl_isprintcontext = false;
rsult = 0;
if (hPr != NULL) {
prerr = EndPage (hPr);
Modified: branches/branch-1.3-Fl_Printer/src/Fl_Gl_Printer.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_Gl_Printer.cxx 2010-03-03
16:38:57 UTC (rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/Fl_Gl_Printer.cxx 2010-03-03
17:38:28 UTC (rev 7205)
@@ -49,7 +49,6 @@
glPopClientAttrib();
fl_gc = save_gc;
#ifdef WIN32
- fl_isprintcontext = true;
fl_draw_image(baseAddress + (glw->h() - 1) * mByteWidth, x, y , glw->w(),
glw->h(), bytesperpixel, - mByteWidth);
#elif defined(__APPLE__)
CGColorSpaceRef cSpace = CGColorSpaceCreateWithName
(kCGColorSpaceGenericRGB);
Modified: branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm 2010-03-03
16:38:57 UTC (rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/Fl_Quartz_Printer.mm 2010-03-03
17:38:28 UTC (rev 7205)
@@ -239,7 +239,6 @@
CGContextSaveGState(fl_gc);
fl_line_style(FL_SOLID);
fl_window = (void *)1; // TODO: something better
- fl_isprintcontext = true;
fl_clip_region(0);
return status != noErr;
}
@@ -249,7 +248,6 @@
CGContextFlush(fl_gc);
CGContextRestoreGState(fl_gc);
CGContextRestoreGState(fl_gc);
- fl_isprintcontext = false;
OSStatus status = PMSessionEndPageNoDialog(printSession);
delete_image_list();
return status != noErr;
Modified: branches/branch-1.3-Fl_Printer/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_cocoa.mm 2010-03-03 16:38:57 UTC
(rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/Fl_cocoa.mm 2010-03-03 17:38:28 UTC
(rev 7205)
@@ -170,7 +170,6 @@
Window fl_window;
Fl_Window *Fl_Window::current_;
//EventRef fl_os_event; // last (mouse) event
-bool fl_isprintcontext = false;
// forward declarations of variables in this file
static int got_events = 0;
@@ -2392,7 +2391,6 @@
[[(NSWindow*)i->xid contentView] lockFocus];
i->gc = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
fl_gc = i->gc;
- fl_isprintcontext = false;
Fl_Region fl_window_region = XRectangleRegion(0,0,w(),h());
if ( ! this->window() ) {
for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext ) { // clip-out all
sub-windows
@@ -2783,7 +2781,7 @@
Fl_Region outr = (Fl_Region)malloc(sizeof(*outr));
outr->rects = (CGRect*)malloc(4 * r->count * sizeof(CGRect));
outr->count = 0;
- CGRect rect = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ CGRect rect = fl_cgrectmake_cocoa(x, y, w, h);
for( int i = 0; i < r->count; i++) {
CGRect A = r->rects[i];
CGRect test = CGRectIntersection(A, rect);
@@ -2828,7 +2826,7 @@
*/
{
if (current == NULL) return XRectangleRegion(x,y,w,h);
- CGRect r = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ CGRect r = fl_cgrectmake_cocoa(x, y, w, h);
Fl_Region outr = (Fl_Region)malloc(sizeof(*outr));
outr->count = current->count;
outr->rects =(CGRect*)malloc(outr->count * sizeof(CGRect));
@@ -3490,6 +3488,12 @@
return (WindowRef)[(FLWindow*)Fl_X::i(w)->xid windowRef];
}
+// so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes
+CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h) {
+ if (Fl_Device::current()->type() == Fl_Device::quartz_printer) return
CGRectMake(x, y, w-1.5 , h-1.5 );
+ return CGRectMake(x, y, w > 0 ? w - 0.9 : 0, h > 0 ? h - 0.9 : 0);
+}
+
#endif // FL_DOXYGEN
//
Modified: branches/branch-1.3-Fl_Printer/src/Fl_win32.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/Fl_win32.cxx 2010-03-03 16:38:57 UTC
(rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/Fl_win32.cxx 2010-03-03 17:38:28 UTC
(rev 7205)
@@ -1790,7 +1790,6 @@
// the current window handle, initially set to -1 so we can correctly
// allocate fl_GetDC(0)
HWND fl_window = NULL;
-BOOL fl_isprintcontext = false; // true when fl_gc is a print context
// Here we ensure only one GetDC is ever in place.
HDC fl_GetDC(HWND w) {
@@ -1801,7 +1800,6 @@
fl_gc = GetDC(w);
fl_save_dc(w, fl_gc);
fl_window = w;
- fl_isprintcontext = false;
// calling GetDC seems to always reset these: (?)
SetTextAlign(fl_gc, TA_BASELINE|TA_LEFT);
SetBkMode(fl_gc, TRANSPARENT);
@@ -1923,9 +1921,9 @@
} while(t);
}
-Fl_Region fl_win_makecliprectregion(int x, int y, int w, int h)
-{
- // beacuse rotation may apply, the rectangle becomes a polygon in device
coords
+Fl_Region XRectangleRegion(int x, int y, int w, int h) {
+ if (Fl_Device::current()->type() < 256) return CreateRectRgn(x,y,x+w,y+h);
+ // because rotation may apply, the rectangle becomes a polygon in device
coords
POINT pt[4] = { {x, y}, {x + w, y}, {x + w, y + h}, {x, y + h} };
LPtoDP(fl_gc, pt, 4);
return CreatePolygonRgn(pt, 4, ALTERNATE);
Modified: branches/branch-1.3-Fl_Printer/src/fl_draw_image_win32.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/fl_draw_image_win32.cxx 2010-03-03
16:38:57 UTC (rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/fl_draw_image_win32.cxx 2010-03-03
17:38:28 UTC (rev 7205)
@@ -254,7 +254,7 @@
}
}
}
- if(fl_isprintcontext) {
+ if(Fl_Device::current()->type() == Fl_Device::gdi_printer) {
// if print context, device and logical units are not equal, so
SetDIBitsToDevice
// does not do the expected job, whereas StretchDIBits does it.
StretchDIBits(fl_gc, x, y+j-k, w, k, 0, 0, w, k,
Modified: branches/branch-1.3-Fl_Printer/src/fl_font_win32.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/fl_font_win32.cxx 2010-03-03
16:38:57 UTC (rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/fl_font_win32.cxx 2010-03-03
17:38:28 UTC (rev 7205)
@@ -247,7 +247,7 @@
// if printer context, extents shd be converted to logical coords
#define EXTENTS_UPDATE(x,y,w,h) \
- if (fl_isprintcontext) { on_printer_extents_update(x,y,w,h); }
+ if (Fl_Device::current()->type() == Fl_Device::gdi_printer) {
on_printer_extents_update(x,y,w,h); }
static unsigned short *ext_buff = NULL; // UTF-16 converted version of input
UTF-8 string
static unsigned wc_len = 0; // current string buffer dimension
Modified: branches/branch-1.3-Fl_Printer/src/fl_line_style.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/fl_line_style.cxx 2010-03-03
16:38:57 UTC (rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/fl_line_style.cxx 2010-03-03
17:38:28 UTC (rev 7205)
@@ -144,7 +144,7 @@
fl_quartz_line_width_ = (float)width;
fl_quartz_line_cap_ = Cap[(style>>8)&3];
// when printing kCGLineCapSquare seems better for solid lines
- if (fl_isprintcontext && style == FL_SOLID) fl_quartz_line_cap_ =
kCGLineCapSquare;
+ if (Fl_Device::current()->type() == quartz_printer && style == FL_SOLID)
fl_quartz_line_cap_ = kCGLineCapSquare;
fl_quartz_line_join_ = Join[(style>>12)&3];
char *d = dashes;
static CGFloat pattern[16];
Modified: branches/branch-1.3-Fl_Printer/src/fl_rect.cxx
===================================================================
--- branches/branch-1.3-Fl_Printer/src/fl_rect.cxx 2010-03-03 16:38:57 UTC
(rev 7204)
+++ branches/branch-1.3-Fl_Printer/src/fl_rect.cxx 2010-03-03 17:38:28 UTC
(rev 7205)
@@ -43,7 +43,10 @@
#ifdef __APPLE_QUARTZ__
extern float fl_quartz_line_width_;
+#ifdef __APPLE_COCOA__
+#define USINGQUARTZPRINTER (Fl_Device::current()->type() == quartz_printer)
#endif
+#endif
/**
Draws a 1-pixel border \e inside the given bounding box
@@ -61,14 +64,14 @@
LineTo(fl_gc, x, y);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
CGRect rect = CGRectMake(x, y, w-1, h-1);
CGContextStrokeRect(fl_gc, rect);
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -91,14 +94,14 @@
FillRect(fl_gc, &rect, fl_brush());
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
CGRect rect = CGRectMake(x, y, w-1, h-1);
CGContextFillRect(fl_gc, rect);
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -117,7 +120,7 @@
MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1+1, y);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -125,7 +128,7 @@
CGContextAddLineToPoint(fl_gc, x1, y);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -151,7 +154,7 @@
LineTo(fl_gc, x1, y2);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -160,7 +163,7 @@
CGContextAddLineToPoint(fl_gc, x1, y2);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -189,7 +192,7 @@
LineTo(fl_gc, x3, y2);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -199,7 +202,7 @@
CGContextAddLineToPoint(fl_gc, x3, y2);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -220,7 +223,7 @@
MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -228,7 +231,7 @@
CGContextAddLineToPoint(fl_gc, x, y1);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -254,7 +257,7 @@
LineTo(fl_gc, x2, y1);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -263,7 +266,7 @@
CGContextAddLineToPoint(fl_gc, x2, y1);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -292,7 +295,7 @@
LineTo(fl_gc, x2, y3);
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, false);
#endif
@@ -302,7 +305,7 @@
CGContextAddLineToPoint(fl_gc, x2, y3);
CGContextStrokePath(fl_gc);
#ifdef __APPLE_COCOA__
- if (fl_isprintcontext || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
#else
if (fl_quartz_line_width_==1.0f) CGContextSetShouldAntialias(fl_gc, true);
#endif
@@ -735,7 +738,7 @@
#elif defined(WIN32)
if (!r) return 1;
RECT rect;
- if (fl_isprintcontext) { // in case of print context, convert coords from
logical to device
+ if (Fl_Device::current()->type() == Fl_Device::gdi_printer) { // in case of
print context, convert coords from logical to device
POINT pt[2] = { {x, y}, {x + w, y + h} };
LPtoDP(fl_gc, pt, 2);
rect.left = pt[0].x; rect.top = pt[0].y; rect.right = pt[1].x; rect.bottom
= pt[1].y;
@@ -747,7 +750,7 @@
#elif defined(__APPLE_QUARTZ__)
if (!r) return 1;
#ifdef __APPLE_COCOA__
- CGRect arg = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
for(int i = 0; i < r->count; i++) {
CGRect test = CGRectIntersection(r->rects[i], arg);
if( ! CGRectIsEmpty(test)) return 1;
@@ -817,7 +820,7 @@
} else { // partial intersection
RECT rect;
GetRgnBox(temp, &rect);
- if(fl_isprintcontext) { // if print context, convert coords from device to
logical
+ if(Fl_Device::current()->type() == Fl_Device::gdi_printer) { // if print
context, convert coords from device to logical
POINT pt[2] = { {rect.left, rect.top}, {rect.right, rect.bottom} };
DPtoLP(fl_gc, pt, 2);
X = pt[0].x; Y = pt[0].y; W = pt[1].x - X; H = pt[1].y - Y;
@@ -832,7 +835,7 @@
return ret;
#elif defined(__APPLE_QUARTZ__)
#ifdef __APPLE_COCOA__
- CGRect arg = FL_CGRECTMAKE_COCOA(x, y, w, h);
+ CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
CGRect u = CGRectMake(0,0,0,0);
CGRect test;
for(int i = 0; i < r->count; i++) {
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit