Author: manolo
Date: 2012-03-18 09:02:40 -0700 (Sun, 18 Mar 2012)
New Revision: 9292
Log:
Removed function fltk3::SurfaceDevice::to_display().
Modified:
branches/branch-3.0/include/FL/x.H
branches/branch-3.0/include/fltk3/Device.h
branches/branch-3.0/include/fltk3/Pixmap.h
branches/branch-3.0/include/fltk3/Printer.h
branches/branch-3.0/include/fltk3/x.h
branches/branch-3.0/src/fltk3/Bitmap.cxx
branches/branch-3.0/src/fltk3/Device.cxx
branches/branch-3.0/src/fltk3/DoubleWindow.cxx
branches/branch-3.0/src/fltk3/GDIPrinter.cxx
branches/branch-3.0/src/fltk3/Pixmap.cxx
branches/branch-3.0/src/fltk3/Printer.cxx
branches/branch-3.0/src/fltk3/TextDisplay.cxx
branches/branch-3.0/src/fltk3/cocoa_draw_image.cxx
branches/branch-3.0/src/fltk3/draw_pixmap.cxx
branches/branch-3.0/src/fltk3/line_style.cxx
branches/branch-3.0/src/fltk3/rect.cxx
branches/branch-3.0/src/fltk3/win32.cxx
branches/branch-3.0/src/fltk3/win32_draw_image.cxx
branches/branch-3.0/src/fltk3/win32_font.cxx
Modified: branches/branch-3.0/include/FL/x.H
===================================================================
--- branches/branch-3.0/include/FL/x.H 2012-03-17 17:35:02 UTC (rev 9291)
+++ branches/branch-3.0/include/FL/x.H 2012-03-18 16:02:40 UTC (rev 9292)
@@ -55,7 +55,7 @@
typedef ulong Fl_Offscreen;
# define fl_create_offscreen(w,h) \
XCreatePixmap(fl_display, \
- (fltk3::SurfaceDevice::to_display() ? \
+ (fltk3::SurfaceDevice::surface() ==
fltk3::DisplayDevice::display_device() ? \
fl_window : fl_xid(Fl::first_window()) ) , \
w, h, fl_visual->depth)
// begin/end are macros that save the old state in local variables:
Modified: branches/branch-3.0/include/fltk3/Device.h
===================================================================
--- branches/branch-3.0/include/fltk3/Device.h 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/include/fltk3/Device.h 2012-03-18 16:02:40 UTC (rev
9292)
@@ -386,8 +386,10 @@
This class is implemented only on the MSWindows platform.
*/
class FLTK3_EXPORT GDIGraphicsDriver : public fltk3::GraphicsDriver {
+ friend class GDIPrinterGraphicsDriver;
int numcount;
int counts[20];
+ void draw_bitmap(fltk3::Bitmap *pxm, int XP, int YP, int WP, int HP, int
cx, int cy, int to_display);
public:
void color(fltk3::Color c);
void color(uchar r, uchar g, uchar b);
@@ -396,7 +398,9 @@
void rtl_draw(const char* str, int n, int x, int y);
void font(fltk3::Font face, fltk3::Fontsize size);
void draw(fltk3::Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int
cy);
- void draw(fltk3::Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int
cy);
+ void draw(fltk3::Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int
cy) {
+ draw_bitmap(pxm, XP, YP, WP, HP, cx, cy, 1);
+ }
void draw(fltk3::RGBImage *img, int XP, int YP, int WP, int HP, int cx,
int cy);
void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int
L=0);
void draw_image(fltk3::DrawImageCb cb, void* data, int X,int Y,int W,int
H, int D=3);
@@ -442,6 +446,14 @@
void copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int
srcx,int srcy);
#endif
};
+
+ class FLTK3_EXPORT GDIPrinterGraphicsDriver : public
fltk3::GDIGraphicsDriver {
+ private:
+ void draw(fltk3::Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int
cy);
+ void draw(fltk3::Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int
cy) {
+ draw_bitmap(pxm, XP, YP, WP, HP, cx, cy, 0);
+ }
+ };
#endif
#if !(defined(__APPLE__) || defined(WIN32))
@@ -509,7 +521,6 @@
/** \brief The graphics driver in use by this surface. */
fltk3::GraphicsDriver *_driver;
static SurfaceDevice *_surface; // the surface that currently receives
graphics output
- virtual int has_display_driver();
protected:
/** \brief Constructor that sets the graphics driver to use for the
created surface. */
SurfaceDevice(fltk3::GraphicsDriver *graphics_driver) {_driver =
graphics_driver; };
@@ -521,10 +532,6 @@
inline fltk3::GraphicsDriver *driver() {return _driver; };
/** \brief the surface that currently receives graphics output */
static inline fltk3::SurfaceDevice *surface() {return _surface; };
- static int to_display();
- /** returns true if the current output surface uses the same graphics
driver
- as the platform display, and false otherwise */
- static inline int uses_display_driver() { return
fltk3::SurfaceDevice::surface()->has_display_driver(); };
/** \brief The destructor. */
virtual ~SurfaceDevice();
};
@@ -534,7 +541,6 @@
*/
class FLTK3_EXPORT DisplayDevice : public fltk3::SurfaceDevice {
static DisplayDevice *_display; // the platform display device
- int has_display_driver();
public:
/** \brief A constructor that sets the graphics driver used by the display
*/
DisplayDevice(fltk3::GraphicsDriver *graphics_driver);
Modified: branches/branch-3.0/include/fltk3/Pixmap.h
===================================================================
--- branches/branch-3.0/include/fltk3/Pixmap.h 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/include/fltk3/Pixmap.h 2012-03-18 16:02:40 UTC (rev
9292)
@@ -59,10 +59,13 @@
friend class QuartzGraphicsDriver;
friend class GDIGraphicsDriver;
+ friend class GDIPrinterGraphicsDriver;
friend class XlibGraphicsDriver;
void copy_data();
void delete_data();
void set_data(const char * const *p);
+ int prepare(int XP, int YP, int WP, int HP, int cx, int cy,
+ int &X, int &Y, int &W, int &H);
protected:
Modified: branches/branch-3.0/include/fltk3/Printer.h
===================================================================
--- branches/branch-3.0/include/fltk3/Printer.h 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/include/fltk3/Printer.h 2012-03-18 16:02:40 UTC (rev
9292)
@@ -77,7 +77,6 @@
int top_margin;
void absolute_printable_rect(int *x, int *y, int *w, int *h);
#endif
- int has_display_driver();
protected:
/** \brief The constructor */
SystemPrinter(void);
Modified: branches/branch-3.0/include/fltk3/x.h
===================================================================
--- branches/branch-3.0/include/fltk3/x.h 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/include/fltk3/x.h 2012-03-18 16:02:40 UTC (rev
9292)
@@ -102,7 +102,7 @@
}
# define fl_create_offscreen(w,h) \
XCreatePixmap(fl_display, \
- (fltk3::SurfaceDevice::to_display() ? \
+ (fltk3::SurfaceDevice::surface() ==
fltk3::DisplayDevice::display_device() ? \
fl_window : fl_xid(fltk3::first_window()) ) , \
w, h, fl_visual->depth)
// begin/end are macros that save the old state in local variables:
Modified: branches/branch-3.0/src/fltk3/Bitmap.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Bitmap.cxx 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/src/fltk3/Bitmap.cxx 2012-03-18 16:02:40 UTC (rev
9292)
@@ -288,7 +288,10 @@
}
#elif defined(WIN32)
-void fltk3::GDIGraphicsDriver::draw(fltk3::Bitmap *bm, int XP, int YP, int WP,
int HP, int cx, int cy) {
+// implements fltk3::GDIGraphicsDriver::draw(fltk3::Bitmap*,...) with an extra
parameter
+// to distinguish betwen display and printer
+void fltk3::GDIGraphicsDriver::draw_bitmap(fltk3::Bitmap *bm, int XP, int YP,
int WP, int HP, int cx, int cy,
+ int to_display) {
int X, Y, W, H;
if (!bm->array) {
bm->draw_empty(XP, YP);
@@ -304,7 +307,7 @@
HDC tempdc;
int save;
BOOL use_print_algo = false;
- if (!fltk3::SurfaceDevice::to_display()) {
+ if (!to_display) {
static HMODULE hMod = NULL;
if (!hMod) {
hMod = LoadLibrary("MSIMG32.DLL");
@@ -312,7 +315,7 @@
}
if (fl_TransparentBlt) use_print_algo = true;
}
- if (use_print_algo) { // algorithm for bitmap output to Fl_GDI_Printer
+ if (use_print_algo) { // algorithm for bitmap output to printer
fltk3::Color save_c = fltk3::color(); // save bitmap's desired color
uchar r, g, b;
fltk3::get_color(save_c, r, g, b);
Modified: branches/branch-3.0/src/fltk3/Device.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Device.cxx 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/src/fltk3/Device.cxx 2012-03-18 16:02:40 UTC (rev
9292)
@@ -41,17 +41,6 @@
_surface = this;
}
-/** returns true if the current output surface is the platform display, and
false otherwise */
-int fltk3::SurfaceDevice::to_display() {
- return fltk3::SurfaceDevice::surface() ==
fltk3::DisplayDevice::display_device();
-}
-
-// returns whether this surface uses the same graphics driver as the platform
display
-int fltk3::SurfaceDevice::has_display_driver() {
- return 0;
-}
-
-
fltk3::SurfaceDevice::~SurfaceDevice() { }
@@ -93,10 +82,6 @@
_display = this;
};
-int fltk3::DisplayDevice::has_display_driver()
-{
- return 1;
-}
//
// End of "$Id$".
//
Modified: branches/branch-3.0/src/fltk3/DoubleWindow.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/DoubleWindow.cxx 2012-03-17 17:35:02 UTC
(rev 9291)
+++ branches/branch-3.0/src/fltk3/DoubleWindow.cxx 2012-03-18 16:02:40 UTC
(rev 9292)
@@ -182,7 +182,7 @@
BOOL alpha_ok = 0;
// first try to alpha blend
// if to printer, always try alpha_blend
- if ( (!fltk3::SurfaceDevice::to_display()) || can_do_alpha_blending() ) {
+ if ( (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device()) || can_do_alpha_blending() ) {
if (fl_alpha_blend) alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc,
srcx, srcy, w, h, blendfunc);
}
// if that failed (it shouldn't), still copy the bitmap over, but now alpha
is 1
Modified: branches/branch-3.0/src/fltk3/GDIPrinter.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/GDIPrinter.cxx 2012-03-17 17:35:02 UTC
(rev 9291)
+++ branches/branch-3.0/src/fltk3/GDIPrinter.cxx 2012-03-18 16:02:40 UTC
(rev 9292)
@@ -36,7 +36,7 @@
fltk3::SystemPrinter::SystemPrinter(void) : fltk3::PagedDevice() {
hPr = NULL;
- driver(new GDIGraphicsDriver);
+ driver(new GDIPrinterGraphicsDriver);
}
fltk3::SystemPrinter::~SystemPrinter(void) {
Modified: branches/branch-3.0/src/fltk3/Pixmap.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Pixmap.cxx 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/src/fltk3/Pixmap.cxx 2012-03-18 16:02:40 UTC (rev
9292)
@@ -104,21 +104,42 @@
return 0;
}
-#ifdef __APPLE__
-void fltk3::QuartzGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int
WP, int HP, int cx, int cy) {
- int X, Y, W, H;
- if (pxm->w() < 0) pxm->measure();
- int code = start(pxm, XP, YP, WP, HP, pxm->w(), pxm->h(), cx, cy, X, Y, W,
H);
+int fltk3::Pixmap::prepare(int XP, int YP, int WP, int HP, int cx, int cy,
+ int &X, int &Y, int &W, int &H) {
+ if (w() < 0) measure();
+ int code = start(this, XP, YP, WP, HP, w(), h(), cx, cy, X, Y, W, H);
if (code) {
- if (code == 2) pxm->draw_empty(XP, YP);
- return;
+ if (code == 2) draw_empty(XP, YP);
+ return 1;
+ }
+ if (!id_) {
+#ifdef __APPLE__
+ id_ = fltk3::QuartzGraphicsDriver::create_offscreen_with_alpha(w(), h());
+#else
+ id_ = fl_create_offscreen(w(), h());
+#endif
+ fl_begin_offscreen((fltk3::Offscreen)id_);
+#ifndef __APPLE__
+ uchar *bitmap = 0;
+ fl_mask_bitmap = &bitmap;
+#endif
+ fltk3::draw_pixmap(data(), 0, 0, fltk3::BLACK);
+#ifndef __APPLE__
+ fl_mask_bitmap = 0;
+ if (bitmap) {
+ mask_ = fl_create_bitmask(w(), h(), bitmap);
+ delete[] bitmap;
}
- if (!pxm->id_) {
- pxm->id_ = create_offscreen_with_alpha(pxm->w(), pxm->h());
- fl_begin_offscreen((fltk3::Offscreen)pxm->id_);
- fltk3::draw_pixmap(pxm->data(), 0, 0, fltk3::GREEN);
+#endif
fl_end_offscreen();
- }
+ }
+ return 0;
+}
+
+#ifdef __APPLE__
+void fltk3::QuartzGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int
WP, int HP, int cx, int cy) {
+ int X, Y, W, H;
+ if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
}
@@ -128,47 +149,8 @@
void fltk3::GDIGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int
WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (pxm->w() < 0) pxm->measure();
- int code = start(pxm, XP, YP, WP, HP, pxm->w(), pxm->h(), cx, cy, X, Y, W,
H);
- if (code) {
- if (code == 2) pxm->draw_empty(XP, YP);
- return;
- }
- if (!pxm->id_) {
- pxm->id_ = fl_create_offscreen(pxm->w(), pxm->h());
- fl_begin_offscreen((fltk3::Offscreen)pxm->id_);
- uchar *bitmap = 0;
- fl_mask_bitmap = &bitmap;
- fltk3::draw_pixmap(pxm->data(), 0, 0, fltk3::BLACK);
- fl_mask_bitmap = 0;
- if (bitmap) {
- pxm->mask_ = fl_create_bitmask(pxm->w(), pxm->h(), bitmap);
- delete[] bitmap;
- }
- fl_end_offscreen();
- }
- if (!fltk3::SurfaceDevice::to_display()) {
- typedef BOOL (WINAPI* fl_transp_func)
(HDC,int,int,int,int,HDC,int,int,int,int,UINT);
- static HMODULE hMod = NULL;
- static fl_transp_func fl_TransparentBlt = NULL;
- if (!hMod) {
- hMod = LoadLibrary("MSIMG32.DLL");
- if(hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod,
"TransparentBlt");
- }
- if (fl_TransparentBlt) {
- HDC new_gc = CreateCompatibleDC(fl_gc);
- int save = SaveDC(new_gc);
- SelectObject(new_gc, (void*)pxm->id_);
- // print all of offscreen but its parts in background color
- fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, pxm->w(), pxm->h(),
win_pixmap_bg_color );
- RestoreDC(new_gc,save);
- DeleteDC(new_gc);
- }
- else {
- copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
- }
- }
- else if (pxm->mask_) {
+ if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
+ if (pxm->mask_) {
HDC new_gc = CreateCompatibleDC(fl_gc);
int save = SaveDC(new_gc);
SelectObject(new_gc, (void*)pxm->mask_);
@@ -182,28 +164,34 @@
}
}
-#else // Xlib
-void fltk3::XlibGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int
WP, int HP, int cx, int cy) {
+void fltk3::GDIPrinterGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP,
int WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (pxm->w() < 0) pxm->measure();
- int code = start(pxm, XP, YP, WP, HP, pxm->w(), pxm->h(), cx, cy, X, Y, W,
H);
- if (code) {
- if (code == 2) pxm->draw_empty(XP, YP);
- return;
+ if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
+ typedef BOOL (WINAPI* fl_transp_func)
(HDC,int,int,int,int,HDC,int,int,int,int,UINT);
+ static HMODULE hMod = NULL;
+ static fl_transp_func fl_TransparentBlt = NULL;
+ if (!hMod) {
+ hMod = LoadLibrary("MSIMG32.DLL");
+ if(hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod,
"TransparentBlt");
}
- if (!pxm->id_) {
- pxm->id_ = fl_create_offscreen(pxm->w(), pxm->h());
- fl_begin_offscreen((fltk3::Offscreen)pxm->id_);
- uchar *bitmap = 0;
- fl_mask_bitmap = &bitmap;
- fltk3::draw_pixmap(pxm->data(), 0, 0, fltk3::BLACK);
- fl_mask_bitmap = 0;
- if (bitmap) {
- pxm->mask_ = fl_create_bitmask(pxm->w(), pxm->h(), bitmap);
- delete[] bitmap;
- }
- fl_end_offscreen();
+ if (fl_TransparentBlt) {
+ HDC new_gc = CreateCompatibleDC(fl_gc);
+ int save = SaveDC(new_gc);
+ SelectObject(new_gc, (void*)pxm->id_);
+ // print all of offscreen but its parts in background color
+ fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, pxm->w(), pxm->h(),
win_pixmap_bg_color );
+ RestoreDC(new_gc,save);
+ DeleteDC(new_gc);
}
+ else {
+ copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
+ }
+}
+
+#else // Xlib
+void fltk3::XlibGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int
WP, int HP, int cx, int cy) {
+ int X, Y, W, H;
+ if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
if (pxm->mask_) {
// I can't figure out how to combine a mask with existing region,
// so cut the image down to a clipped rectangle:
Modified: branches/branch-3.0/src/fltk3/Printer.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Printer.cxx 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/src/fltk3/Printer.cxx 2012-03-18 16:02:40 UTC (rev
9292)
@@ -92,11 +92,6 @@
PagedDevice::origin(x, y);
}
-int fltk3::SystemPrinter::has_display_driver()
-{
- return 1;
-}
-
#endif
fltk3::Printer::Printer(void) {
Modified: branches/branch-3.0/src/fltk3/TextDisplay.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/TextDisplay.cxx 2012-03-17 17:35:02 UTC
(rev 9291)
+++ branches/branch-3.0/src/fltk3/TextDisplay.cxx 2012-03-18 16:02:40 UTC
(rev 9292)
@@ -3378,7 +3378,7 @@
// draw the non-text, non-scrollbar areas.
if (damage() & fltk3::DAMAGE_ALL) {
// printf("drawing all (box = %d)\n", box());
- if (!fltk3::SurfaceDevice::to_display()) {
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device()) {
// if to printer, draw the background
fltk3::rectf(text_area.x, text_area.y, text_area.w, text_area.h, color()
);
}
Modified: branches/branch-3.0/src/fltk3/cocoa_draw_image.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_draw_image.cxx 2012-03-17 17:35:02 UTC
(rev 9291)
+++ branches/branch-3.0/src/fltk3/cocoa_draw_image.cxx 2012-03-18 16:02:40 UTC
(rev 9292)
@@ -64,7 +64,7 @@
const void *array = buf;
uchar *tmpBuf = 0;
- if (cb || !fltk3::SurfaceDevice::to_display()) {
+ if (cb || fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device()) {
tmpBuf = new uchar[ H*W*delta ];
if (cb) {
for (int i=0; i<H; i++) {
Modified: branches/branch-3.0/src/fltk3/draw_pixmap.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/draw_pixmap.cxx 2012-03-17 17:35:02 UTC
(rev 9291)
+++ branches/branch-3.0/src/fltk3/draw_pixmap.cxx 2012-03-18 16:02:40 UTC
(rev 9292)
@@ -341,7 +341,7 @@
#endif
#ifdef __APPLE_QUARTZ__
- if ( fltk3::SurfaceDevice::uses_display_driver() ) {
+ if ( fltk3::SurfaceDevice::surface() ==
fltk3::DisplayDevice::display_device() ) {
U32 *array = new U32[d.w * d.h], *q = array;
for (int Y = 0; Y < d.h; Y++) {
const uchar* p = data[Y];
Modified: branches/branch-3.0/src/fltk3/line_style.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/line_style.cxx 2012-03-17 17:35:02 UTC
(rev 9291)
+++ branches/branch-3.0/src/fltk3/line_style.cxx 2012-03-18 16:02:40 UTC
(rev 9292)
@@ -69,7 +69,7 @@
fl_quartz_line_width_ = (float)width;
fl_quartz_line_cap_ = Cap[(style>>8)&3];
// when printing kCGLineCapSquare seems better for solid lines
- if ( (!fltk3::SurfaceDevice::to_display()) && style == fltk3::SOLID &&
dashes == NULL ) {
+ if ( fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() && style == fltk3::SOLID && dashes ==
NULL ) {
fl_quartz_line_cap_ = kCGLineCapSquare;
}
fl_quartz_line_join_ = Join[(style>>12)&3];
Modified: branches/branch-3.0/src/fltk3/rect.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/rect.cxx 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/src/fltk3/rect.cxx 2012-03-18 16:02:40 UTC (rev
9292)
@@ -166,10 +166,10 @@
#if defined(__APPLE_QUARTZ__)
void fltk3::QuartzGraphicsDriver::rect(int x, int y, int w, int h) {
if (w<=0 || h<=0) return;
- if ( fltk3::SurfaceDevice::to_display() && fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if ( fltk3::SurfaceDevice::surface() ==
fltk3::DisplayDevice::display_device() && fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
CGRect rect = CGRectMake(x, y, w-1, h-1);
CGContextStrokeRect(fl_gc, rect);
- if ( fltk3::SurfaceDevice::to_display() && fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if ( fltk3::SurfaceDevice::surface() ==
fltk3::DisplayDevice::display_device() && fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
}
#elif defined(WIN32)
void fltk3::GDIGraphicsDriver::rect(int x, int y, int w, int h) {
@@ -214,11 +214,11 @@
#if defined(__APPLE_QUARTZ__)
void fltk3::QuartzGraphicsDriver::xyline(int x, int y, int x1) {
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x1, y);
CGContextStrokePath(fl_gc);
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
}
#elif defined(WIN32)
void fltk3::GDIGraphicsDriver::xyline(int x, int y, int x1) {
@@ -233,12 +233,12 @@
#if defined(__APPLE_QUARTZ__)
void fltk3::QuartzGraphicsDriver::xyline(int x, int y, int x1, int y2) {
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x1, y);
CGContextAddLineToPoint(fl_gc, x1, y2);
CGContextStrokePath(fl_gc);
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
}
#elif defined(WIN32)
void fltk3::GDIGraphicsDriver::xyline(int x, int y, int x1, int y2) {
@@ -260,13 +260,13 @@
#if defined(__APPLE_QUARTZ__)
void fltk3::QuartzGraphicsDriver::xyline(int x, int y, int x1, int y2, int x3)
{
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x1, y);
CGContextAddLineToPoint(fl_gc, x1, y2);
CGContextAddLineToPoint(fl_gc, x3, y2);
CGContextStrokePath(fl_gc);
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
}
#elif defined(WIN32)
void fltk3::GDIGraphicsDriver::xyline(int x, int y, int x1, int y2, int x3) {
@@ -290,11 +290,11 @@
#if defined(__APPLE_QUARTZ__)
void fltk3::QuartzGraphicsDriver::yxline(int x, int y, int y1) {
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x, y1);
CGContextStrokePath(fl_gc);
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
}
#elif defined(WIN32)
void fltk3::GDIGraphicsDriver::yxline(int x, int y, int y1) {
@@ -311,12 +311,12 @@
#if defined(__APPLE_QUARTZ__)
void fltk3::QuartzGraphicsDriver::yxline(int x, int y, int y1, int x2) {
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x, y1);
CGContextAddLineToPoint(fl_gc, x2, y1);
CGContextStrokePath(fl_gc);
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
}
#elif defined(WIN32)
void fltk3::GDIGraphicsDriver::yxline(int x, int y, int y1, int x2) {
@@ -338,13 +338,13 @@
#if defined(__APPLE_QUARTZ__)
void fltk3::QuartzGraphicsDriver::yxline(int x, int y, int y1, int x2, int y3)
{
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, true);
CGContextMoveToPoint(fl_gc, x, y);
CGContextAddLineToPoint(fl_gc, x, y1);
CGContextAddLineToPoint(fl_gc, x2, y1);
CGContextAddLineToPoint(fl_gc, x2, y3);
CGContextStrokePath(fl_gc);
- if (!fltk3::SurfaceDevice::to_display() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device() || fl_quartz_line_width_ > 1.5f)
CGContextSetShouldAntialias(fl_gc, false);
}
#elif defined(WIN32)
void fltk3::GDIGraphicsDriver::yxline(int x, int y, int y1, int x2, int y3) {
@@ -710,7 +710,7 @@
fltk3::Region r = clip_region();
if (!r) return 1;
RECT rect;
- if (!fltk3::SurfaceDevice::to_display()) { // in case of print context,
convert coords from logical to device
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device()) { // 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;
@@ -774,7 +774,7 @@
} else { // partial intersection
RECT rect;
GetRgnBox(temp, &rect);
- if (!fltk3::SurfaceDevice::to_display()) { // if print context, convert
coords from device to logical
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device()) { // 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;
Modified: branches/branch-3.0/src/fltk3/win32.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/win32.cxx 2012-03-17 17:35:02 UTC (rev
9291)
+++ branches/branch-3.0/src/fltk3/win32.cxx 2012-03-18 16:02:40 UTC (rev
9292)
@@ -1957,7 +1957,7 @@
}
fltk3::Region XRectangleRegion(int x, int y, int w, int h) {
- if (fltk3::SurfaceDevice::to_display()) return CreateRectRgn(x,y,x+w,y+h);
+ if (fltk3::SurfaceDevice::surface() ==
fltk3::DisplayDevice::display_device()) 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);
Modified: branches/branch-3.0/src/fltk3/win32_draw_image.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/win32_draw_image.cxx 2012-03-17 17:35:02 UTC
(rev 9291)
+++ branches/branch-3.0/src/fltk3/win32_draw_image.cxx 2012-03-18 16:02:40 UTC
(rev 9292)
@@ -178,7 +178,7 @@
int blocking = h;
{int size = linesize*h;
// when printing, don't limit buffer size not to get a crash in StretchDIBits
- if (size > MAXBUFFER && fltk3::SurfaceDevice::to_display()) {
+ if (size > MAXBUFFER && fltk3::SurfaceDevice::surface() ==
fltk3::DisplayDevice::display_device()) {
size = MAXBUFFER;
blocking = MAXBUFFER/linesize;
}
@@ -256,7 +256,7 @@
}
}
}
- if(!fltk3::SurfaceDevice::to_display()) {
+ if(fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device()) {
// 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-3.0/src/fltk3/win32_font.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/win32_font.cxx 2012-03-17 17:35:02 UTC
(rev 9291)
+++ branches/branch-3.0/src/fltk3/win32_font.cxx 2012-03-18 16:02:40 UTC
(rev 9292)
@@ -272,7 +272,7 @@
// if printer context, extents shd be converted to logical coords
#define EXTENTS_UPDATE(x,y,w,h) \
- if (!fltk3::SurfaceDevice::to_display()) {
on_printer_extents_update(x,y,w,h); }
+ if (fltk3::SurfaceDevice::surface() !=
fltk3::DisplayDevice::display_device()) { on_printer_extents_update(x,y,w,h); }
// Function to determine the extent of the "inked" area of the glyphs in a
string
void fltk3::GDIGraphicsDriver::text_extents(const char *c, int n, int &dx, int
&dy, int &w, int &h) {
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit