Isolate the definition of the 3 public, OS-dependent types (Fl_Offscreen, Fl_Region, Fl_Bitmask).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11432 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
e86e4a6ab0
commit
915d6c643a
@ -24,7 +24,7 @@
|
||||
#ifndef FL_GRAPHICS_DRIVER_H
|
||||
#define FL_GRAPHICS_DRIVER_H
|
||||
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_System_Driver.H>
|
||||
#include <FL/Fl_Device.H>
|
||||
#include <FL/Fl_Image.H>
|
||||
#include <FL/Fl_Bitmap.H>
|
||||
@ -47,25 +47,6 @@ FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver;
|
||||
*/
|
||||
typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
|
||||
|
||||
// typedef what the x,y fields in a point are:
|
||||
#ifdef WIN32
|
||||
typedef int COORD_T;
|
||||
# define XPOINT XPoint
|
||||
#elif defined(__APPLE__) // PORTME: Fl_Graphics_Driver - platform specific types
|
||||
typedef float COORD_T;
|
||||
typedef struct { float x; float y; } QPoint;
|
||||
# define XPOINT QPoint
|
||||
extern float fl_quartz_line_width_;
|
||||
#elif defined(FL_PORTING)
|
||||
# pragma message "FL_PORTING: define types for COORD_T and XPOINT"
|
||||
typedef int COORD_T; // default if not ported
|
||||
typedef struct { int x; int y; } QPoint;
|
||||
# define XPOINT QPoint
|
||||
#else
|
||||
typedef short COORD_T;
|
||||
# define XPOINT XPoint
|
||||
#endif
|
||||
|
||||
|
||||
#define FL_REGION_STACK_SIZE 10
|
||||
#define FL_MATRIX_STACK_SIZE 32
|
||||
@ -116,8 +97,7 @@ protected:
|
||||
static const int matrix_stack_size = FL_MATRIX_STACK_SIZE;
|
||||
matrix stack[FL_MATRIX_STACK_SIZE];
|
||||
matrix m;
|
||||
int n, p_size, gap_;
|
||||
XPOINT *p;
|
||||
int n, gap_;
|
||||
int what;
|
||||
int rstackptr;
|
||||
static const int region_stack_max = FL_REGION_STACK_SIZE - 1;
|
||||
@ -126,7 +106,6 @@ protected:
|
||||
#ifndef FL_DOXYGEN
|
||||
enum {LINE, LOOP, POLYGON, POINT_};
|
||||
inline int vertex_no() { return n; }
|
||||
inline XPOINT *vertices() {return p;}
|
||||
inline int vertex_kind() {return what;}
|
||||
#endif
|
||||
matrix *fl_matrix; /**< Points to the current coordinate transformation matrix */
|
||||
@ -134,7 +113,7 @@ protected:
|
||||
// === all code below in this class has been to the reorganisation FL_PORTING process
|
||||
public:
|
||||
Fl_Graphics_Driver();
|
||||
virtual ~Fl_Graphics_Driver() { if (p) free(p); }
|
||||
virtual ~Fl_Graphics_Driver() {}
|
||||
virtual char can_do_alpha_blending() { return 0; }
|
||||
// --- implementation is in src/fl_rect.cxx which includes src/drivers/xxx/Fl_xxx_Graphics_Driver_rect.cxx
|
||||
virtual void point(int x, int y) = 0;
|
||||
@ -261,8 +240,6 @@ public:
|
||||
static void add_rectangle_to_region(Fl_Region r, int x, int y, int w, int h);
|
||||
protected:
|
||||
// --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx
|
||||
virtual void transformed_vertex0(COORD_T x, COORD_T y);
|
||||
virtual void fixloop();
|
||||
void global_gc(void);
|
||||
};
|
||||
|
||||
|
@ -21,10 +21,25 @@
|
||||
\brief declaration of classe Fl_System_Driver.
|
||||
*/
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <src/drivers/Darwin/Fl_Darwin_System_Driver.H>
|
||||
|
||||
#elif defined(WIN32)
|
||||
#include <src/drivers/WinAPI/Fl_WinAPI_System_Driver.H>
|
||||
|
||||
#elif defined(FL_PORTING)
|
||||
# pragma message "FL_PORTING: define OS-dependent types"
|
||||
typedef void* Fl_Offscreen;
|
||||
typedef void* Fl_Bitmask;
|
||||
typedef void *Fl_Region;
|
||||
#else
|
||||
|
||||
#include <src/drivers/Posix/Fl_Posix_System_Driver.H>
|
||||
#endif // __APPLE__
|
||||
|
||||
#ifndef FL_SYSTEM_DRIVER_H
|
||||
#define FL_SYSTEM_DRIVER_H
|
||||
|
||||
#include <FL/Fl_Device.H>
|
||||
#include <FL/Fl_Export.H>
|
||||
|
||||
/**
|
||||
@ -36,7 +51,6 @@ public:
|
||||
virtual ~Fl_System_Driver();
|
||||
};
|
||||
|
||||
|
||||
#endif // FL_SYSTEM_DRIVER_H
|
||||
|
||||
//
|
||||
|
9
FL/mac.H
9
FL/mac.H
@ -33,18 +33,17 @@ typedef class FLWindow *Window; // pointer to the FLWindow objective-c class
|
||||
#endif // __OBJC__
|
||||
|
||||
#include <FL/Fl_Device.H>
|
||||
#include "src/drivers/Darwin/Fl_Darwin_System_Driver.H"
|
||||
|
||||
#if !(defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part is used when compiling an application program
|
||||
# include <FL/Fl_Widget.H>
|
||||
|
||||
typedef struct flCocoaRegion* Fl_Region;
|
||||
typedef struct CGContext* CGContextRef;
|
||||
typedef struct OpaquePMPrintSettings* PMPrintSettings;
|
||||
typedef struct OpaquePMPageFormat* PMPageFormat;
|
||||
typedef struct OpaquePMPrintSession* PMPrintSession;
|
||||
typedef struct CGImage* CGImageRef;
|
||||
typedef struct __CFData* CFMutableDataRef; // used in Fl_Copy_Surface.H
|
||||
typedef CGContextRef Fl_Offscreen;
|
||||
|
||||
#else // this part must be compiled when building the FLTK libraries
|
||||
|
||||
@ -99,15 +98,14 @@ class NSOpenGLContext;
|
||||
class CALayer;
|
||||
#endif // __OBJC__
|
||||
|
||||
typedef CGContextRef Fl_Offscreen;
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
|
||||
typedef CGImageAlphaInfo CGBitmapInfo;
|
||||
#endif
|
||||
|
||||
typedef struct flCocoaRegion {
|
||||
struct flCocoaRegion {
|
||||
int count;
|
||||
CGRect *rects;
|
||||
} *Fl_Region; // a region is the union of a series of rectangles
|
||||
}; // a region is the union of a series of rectangles
|
||||
|
||||
# include "Fl_Window.H"
|
||||
# include "../src/Fl_Font.H"
|
||||
@ -209,7 +207,6 @@ extern Window fl_window;
|
||||
|
||||
#endif // FL_LIBRARY || FL_INTERNALS
|
||||
|
||||
typedef CGImageRef Fl_Bitmask;
|
||||
|
||||
extern CGContextRef fl_gc;
|
||||
|
||||
|
@ -26,9 +26,8 @@
|
||||
#endif // !Fl_X_H
|
||||
|
||||
#include <windows.h>
|
||||
typedef HRGN Fl_Region;
|
||||
#include "src/drivers/WinAPI/Fl_WinAPI_System_Driver.H"
|
||||
typedef HWND Window;
|
||||
typedef POINT XPoint;
|
||||
|
||||
#include <FL/Fl_Device.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
@ -126,7 +125,6 @@ extern FL_EXPORT MSG fl_msg;
|
||||
extern FL_EXPORT HDC fl_GetDC(Window);
|
||||
extern FL_EXPORT HDC fl_makeDC(HBITMAP);
|
||||
|
||||
typedef HBITMAP Fl_Offscreen;
|
||||
/*#define fl_create_offscreen(w, h) \
|
||||
CreateCompatibleBitmap( (fl_graphics_driver->gc() ? (HDC)fl_graphics_driver->gc() : fl_GetDC(0) ) , w, h)
|
||||
|
||||
@ -143,7 +141,6 @@ Fl_Display_Device::display_device()->set_current(); \
|
||||
#define fl_delete_offscreen(bitmap) DeleteObject(bitmap)*/
|
||||
|
||||
// Bitmap masks
|
||||
typedef HBITMAP Fl_Bitmask;
|
||||
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
||||
|
9
FL/x.H
9
FL/x.H
@ -48,8 +48,8 @@
|
||||
# endif
|
||||
# include <X11/Xatom.h>
|
||||
# include "Fl_Window.H"
|
||||
// Mirror X definition of Region to Fl_Region, for portability...
|
||||
typedef Region Fl_Region;
|
||||
|
||||
#include <src/drivers/Posix/Fl_Posix_System_Driver.H>
|
||||
|
||||
FL_EXPORT void fl_open_display();
|
||||
FL_EXPORT void fl_open_display(Display*);
|
||||
@ -75,11 +75,6 @@ FL_EXPORT int fl_handle(const XEvent&);
|
||||
extern FL_EXPORT const XEvent* fl_xevent;
|
||||
extern FL_EXPORT ulong fl_event_time;
|
||||
|
||||
typedef ulong Fl_Offscreen;
|
||||
|
||||
// Bitmap masks
|
||||
typedef ulong Fl_Bitmask;
|
||||
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
||||
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
|
||||
|
@ -17,6 +17,9 @@
|
||||
//
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#ifdef __APPLE__
|
||||
#include <FL/x.H> // for fl_open_callback
|
||||
#endif
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Box.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
|
@ -30,6 +30,7 @@
|
||||
#endif
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Screen_Driver.H>
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Printer.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
@ -34,9 +34,7 @@ Fl_Graphics_Driver::Fl_Graphics_Driver() {
|
||||
fl_clip_state_number=0;
|
||||
m = m0;
|
||||
fl_matrix = &m;
|
||||
p = (XPOINT *)0;
|
||||
font_descriptor_ = NULL;
|
||||
p_size = 0;
|
||||
};
|
||||
|
||||
void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int& w, int& h)
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Input.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
// WIN32 note: HAVE_OVERLAY is false
|
||||
#if HAVE_OVERLAY
|
||||
#include <FL/x.H>
|
||||
extern XVisualInfo *fl_find_overlay_visual();
|
||||
extern XVisualInfo *fl_overlay_visual;
|
||||
extern Colormap fl_overlay_colormap;
|
||||
|
@ -87,6 +87,7 @@ void Fl_Overlay_Window::redraw_overlay() {
|
||||
}
|
||||
|
||||
#else
|
||||
#include <FL/x.H>
|
||||
|
||||
extern XVisualInfo *fl_find_overlay_visual();
|
||||
extern XVisualInfo *fl_overlay_visual;
|
||||
|
@ -24,6 +24,7 @@
|
||||
// it interferes with the color cube used by fl_draw_image).
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/Fl_Menu_Item.H>
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h> // strdup()
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Text_Buffer.H>
|
||||
#include <FL/Fl_Text_Display.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <FL/Fl_Widget_Surface.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
// crap you need to do to communicate with X is in Fl_x.cxx, the
|
||||
// equivalent (but totally different) crap for MSWindows is in Fl_win32.cxx
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
#include <FL/Fl_RGB_Image.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
|
||||
extern void fl_throw_focus(Fl_Widget *o);
|
||||
|
||||
|
@ -20,8 +20,10 @@
|
||||
// You do not need to call this! Feel free to make up your own switches.
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
#include <FL/Fl_Graphics_Driver.H>
|
||||
#include <FL/Fl_Tooltip.H>
|
||||
#include <FL/filename.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
@ -49,6 +49,7 @@ void fl_release_dc(HWND,HDC);
|
||||
void fl_cleanup_dc_list(void);
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Window_Driver.H>
|
||||
#include <FL/Fl_Graphics_Driver.H> // for fl_graphics_driver
|
||||
#include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H"
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
# include <config.h>
|
||||
# include <FL/Fl.H>
|
||||
# include <FL/x.H>
|
||||
# include <FL/Fl_Window_Driver.H>
|
||||
# include <FL/Fl_Window.H>
|
||||
# include <FL/fl_utf8.h>
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "../Quartz/Fl_Quartz_Printer_Graphics_Driver.H"
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_ask.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <FL/Fl_Overlay_Window.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
|
||||
|
||||
Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
|
||||
|
@ -27,10 +27,14 @@
|
||||
|
||||
#include <FL/Fl_System_Driver.H>
|
||||
|
||||
typedef struct CGContext* Fl_Offscreen;
|
||||
typedef struct CGImage* Fl_Bitmask;
|
||||
typedef struct flCocoaRegion* Fl_Region;
|
||||
|
||||
/*
|
||||
Move everything here that manages the system interface.
|
||||
|
||||
There is excatly one system driver.
|
||||
There is exactly one system driver.
|
||||
|
||||
- filename and pathname management
|
||||
- directory and file access
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#ifdef FL_CFG_GFX_GDI
|
||||
#include <FL/Fl_Copy_Surface.H>
|
||||
#include <FL/x.H>
|
||||
#include "Fl_GDI_Graphics_Driver.H"
|
||||
#include <windows.h>
|
||||
|
||||
|
@ -42,8 +42,11 @@ protected:
|
||||
uchar **mask_bitmap_;
|
||||
uchar **mask_bitmap() {return mask_bitmap_;}
|
||||
void mask_bitmap(uchar **value) { mask_bitmap_ = value; }
|
||||
int p_size;
|
||||
POINT *p;
|
||||
public:
|
||||
Fl_GDI_Graphics_Driver() {mask_bitmap_ = NULL;}
|
||||
Fl_GDI_Graphics_Driver() {mask_bitmap_ = NULL; gc_ = NULL; p_size = 0; p = NULL;}
|
||||
virtual ~Fl_GDI_Graphics_Driver() { if (p) free(p); }
|
||||
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
|
||||
char can_do_alpha_blending();
|
||||
virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (HDC)ctxt;}
|
||||
@ -76,6 +79,8 @@ public:
|
||||
#endif
|
||||
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
|
||||
protected:
|
||||
void transformed_vertex0(int x, int y);
|
||||
void fixloop();
|
||||
// --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/gdi_rect.cxx
|
||||
void point(int x, int y);
|
||||
void rect(int x, int y, int w, int h);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "../../config_lib.h"
|
||||
#include "Fl_GDI_Graphics_Driver.H"
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
|
||||
|
||||
/* Reference to the current device context
|
||||
@ -150,6 +151,23 @@ void Fl_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int
|
||||
XDestroyRegion(R);
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::transformed_vertex0(int x, int y) {
|
||||
if (!n || x != p[n-1].x || y != p[n-1].y) {
|
||||
if (n >= p_size) {
|
||||
p_size = p ? 2*p_size : 16;
|
||||
p = (POINT*)realloc((void*)p, p_size*sizeof(*p));
|
||||
}
|
||||
p[n].x = x;
|
||||
p[n].y = y;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::fixloop() { // remove equal points from closed path
|
||||
while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "Fl_GDI_Graphics_Driver.H"
|
||||
|
||||
#include <FL/math.h>
|
||||
#include <FL/x.h>
|
||||
|
||||
void Fl_GDI_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) {
|
||||
if (w <= 0 || h <= 0) return;
|
||||
|
@ -140,7 +140,7 @@ void Fl_GDI_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2,
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2) {
|
||||
XPoint p[3];
|
||||
POINT p[3];
|
||||
p[0].x = x; p[0].y = y;
|
||||
p[1].x = x1; p[1].y = y1;
|
||||
p[2].x = x2; p[2].y = y2;
|
||||
@ -149,7 +149,7 @@ void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
|
||||
XPoint p[4];
|
||||
POINT p[4];
|
||||
p[0].x = x; p[0].y = y;
|
||||
p[1].x = x1; p[1].y = y1;
|
||||
p[2].x = x2; p[2].y = y2;
|
||||
|
@ -33,11 +33,11 @@
|
||||
|
||||
|
||||
void Fl_GDI_Graphics_Driver::transformed_vertex(double xf, double yf) {
|
||||
transformed_vertex0(COORD_T(rint(xf)), COORD_T(rint(yf)));
|
||||
transformed_vertex0(int(rint(xf)), int(rint(yf)));
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::vertex(double x,double y) {
|
||||
transformed_vertex0(COORD_T(x*m.a + y*m.c + m.x), COORD_T(x*m.b + y*m.d + m.y));
|
||||
transformed_vertex0(int(x*m.a + y*m.c + m.x), int(x*m.b + y*m.d + m.y));
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::end_points() {
|
||||
@ -54,7 +54,7 @@ void Fl_GDI_Graphics_Driver::end_line() {
|
||||
|
||||
void Fl_GDI_Graphics_Driver::end_loop() {
|
||||
fixloop();
|
||||
if (n>2) transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y);
|
||||
if (n>2) transformed_vertex((int)p[0].x, (int)p[0].y);
|
||||
end_line();
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ void Fl_GDI_Graphics_Driver::begin_complex_polygon() {
|
||||
void Fl_GDI_Graphics_Driver::gap() {
|
||||
while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
|
||||
if (n > gap_+2) {
|
||||
transformed_vertex((COORD_T)p[gap_].x, (COORD_T)p[gap_].y);
|
||||
transformed_vertex((int)p[gap_].x, (int)p[gap_].y);
|
||||
counts[numcount++] = n-gap_;
|
||||
gap_ = n;
|
||||
} else {
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
void pop_clip();
|
||||
void restore_clip();
|
||||
// --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx
|
||||
void transformed_vertex0(COORD_T x, COORD_T y);
|
||||
//void transformed_vertex0(double x, double y);
|
||||
void transformed_vertex(double xf, double yf);
|
||||
void vertex(double x, double y);
|
||||
void begin_points();
|
||||
|
@ -99,12 +99,8 @@ void Fl_OpenGL_Graphics_Driver::transformed_vertex(double xf, double yf) {
|
||||
glVertex2d(xf, yf);
|
||||
}
|
||||
|
||||
void Fl_OpenGL_Graphics_Driver::transformed_vertex0(COORD_T x, COORD_T y) {
|
||||
glVertex2d(x, y);
|
||||
}
|
||||
|
||||
void Fl_OpenGL_Graphics_Driver::vertex(double x,double y) {
|
||||
transformed_vertex0(x*m.a + y*m.c + m.x, x*m.b + y*m.d + m.y);
|
||||
transformed_vertex(x*m.a + y*m.c + m.x, x*m.b + y*m.d + m.y);
|
||||
}
|
||||
|
||||
void Fl_OpenGL_Graphics_Driver::circle(double cx, double cy, double r) {
|
||||
|
@ -27,10 +27,14 @@
|
||||
|
||||
#include <FL/Fl_System_Driver.H>
|
||||
|
||||
typedef unsigned long Fl_Offscreen;
|
||||
typedef unsigned long Fl_Bitmask;
|
||||
typedef struct _XRegion *Fl_Region;
|
||||
|
||||
/*
|
||||
Move everything here that manages the system interface.
|
||||
|
||||
There is excatly one system driver.
|
||||
There is exactly one system driver.
|
||||
|
||||
- filename and pathname management
|
||||
- directory and file access
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_ask.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <stdio.h>
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#ifdef FL_CFG_GFX_QUARTZ
|
||||
#include <FL/Fl_Copy_Surface.H>
|
||||
#include <FL/x.H>
|
||||
#include "Fl_Quartz_Graphics_Driver.H"
|
||||
|
||||
class Fl_Quartz_Copy_Surface_Driver : public Fl_Copy_Surface_Driver {
|
||||
|
@ -26,12 +26,7 @@
|
||||
#define FL_QUARTZ_GRAPHICS_DRIVER_H
|
||||
|
||||
#include <FL/Fl_Graphics_Driver.H>
|
||||
|
||||
// typedef what the x,y fields in a point are:
|
||||
// FIXME: this is still defined in Fl_Device.H, but should be invisible to the user
|
||||
//typedef float COORD_T;
|
||||
//typedef struct { float x; float y; } QPoint;
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
/**
|
||||
\brief The Mac OS X-specific graphics class.
|
||||
@ -41,7 +36,12 @@
|
||||
class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
|
||||
protected:
|
||||
CGContextRef gc_;
|
||||
int p_size;
|
||||
typedef struct { float x; float y; } XPOINT;
|
||||
XPOINT *p;
|
||||
public:
|
||||
Fl_Quartz_Graphics_Driver() : Fl_Graphics_Driver(), gc_(NULL), p_size(0), p(NULL) {}
|
||||
virtual ~Fl_Quartz_Graphics_Driver() { if (p) free(p); }
|
||||
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
|
||||
virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (CGContextRef)ctxt; }
|
||||
virtual void *gc() {return gc_;}
|
||||
@ -64,6 +64,8 @@ public:
|
||||
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
|
||||
void draw_CGImage(CGImageRef cgimg, int x, int y, int w, int h, int srcx, int srcy, int sw, int sh);
|
||||
protected:
|
||||
void transformed_vertex0(float x, float y);
|
||||
void fixloop();
|
||||
// --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/quartz_rect.cxx
|
||||
void point(int x, int y);
|
||||
void rect(int x, int y, int w, int h);
|
||||
@ -122,6 +124,8 @@ protected:
|
||||
int descent();
|
||||
};
|
||||
|
||||
extern float fl_quartz_line_width_;
|
||||
|
||||
#endif // FL_QUARTZ_GRAPHICS_DRIVER_H
|
||||
|
||||
//
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "../../config_lib.h"
|
||||
#include "Fl_Quartz_Graphics_Driver.H"
|
||||
#include <FL/x.H>
|
||||
|
||||
/* Reference to the current CGContext
|
||||
For back-compatibility only. The preferred procedure to get this reference is
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifdef FL_CFG_GFX_QUARTZ
|
||||
|
||||
#include "Fl_Quartz_Graphics_Driver.h"
|
||||
#include <FL/x.H>
|
||||
|
||||
/**
|
||||
\file quartz_arci.cxx
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "Fl_Quartz_Graphics_Driver.h"
|
||||
#include <math.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_utf8.h>
|
||||
|
||||
Fl_Fontdesc* fl_fonts = NULL;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifdef FL_CFG_GFX_QUARTZ
|
||||
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/x.H>
|
||||
|
||||
extern int fl_line_width_;
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#ifdef FL_CFG_GFX_QUARTZ
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -33,11 +33,11 @@
|
||||
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::transformed_vertex(double xf, double yf) {
|
||||
transformed_vertex0(COORD_T(xf), COORD_T(yf));
|
||||
transformed_vertex0(float(xf), float(yf));
|
||||
}
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::vertex(double x,double y) {
|
||||
transformed_vertex0(COORD_T(x*m.a + y*m.c + m.x), COORD_T(x*m.b + y*m.d + m.y));
|
||||
transformed_vertex0(float(x*m.a + y*m.c + m.x), float(x*m.b + y*m.d + m.y));
|
||||
}
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::end_points() {
|
||||
@ -66,7 +66,7 @@ void Fl_Quartz_Graphics_Driver::end_line() {
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::end_loop() {
|
||||
fixloop();
|
||||
if (n>2) transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y);
|
||||
if (n>2) transformed_vertex((float)p[0].x, (float)p[0].y);
|
||||
end_line();
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ void Fl_Quartz_Graphics_Driver::begin_complex_polygon() {
|
||||
void Fl_Quartz_Graphics_Driver::gap() {
|
||||
while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
|
||||
if (n > gap_+2) {
|
||||
transformed_vertex((COORD_T)p[gap_].x, (COORD_T)p[gap_].y);
|
||||
transformed_vertex((float)p[gap_].x, (float)p[gap_].y);
|
||||
gap_ = n;
|
||||
} else {
|
||||
n = gap_;
|
||||
@ -135,6 +135,23 @@ void Fl_Quartz_Graphics_Driver::circle(double x, double y,double r) {
|
||||
CGContextSetShouldAntialias(gc_, false);
|
||||
}
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::transformed_vertex0(float x, float y) {
|
||||
if (!n || x != p[n-1].x || y != p[n-1].y) {
|
||||
if (n >= p_size) {
|
||||
p_size = p ? 2*p_size : 16;
|
||||
p = (XPOINT*)realloc((void*)p, p_size*sizeof(*p));
|
||||
}
|
||||
p[n].x = x;
|
||||
p[n].y = y;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::fixloop() { // remove equal points from closed path
|
||||
while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
|
||||
}
|
||||
|
||||
|
||||
#endif // FL_CFG_GFX_QUARTZ
|
||||
|
||||
//
|
||||
|
@ -27,10 +27,15 @@
|
||||
|
||||
#include <FL/Fl_System_Driver.H>
|
||||
|
||||
typedef struct HBITMAP__ *HBITMAP;
|
||||
typedef HBITMAP Fl_Offscreen;
|
||||
typedef HBITMAP Fl_Bitmask;
|
||||
typedef struct HRGN__ *Fl_Region;
|
||||
|
||||
/*
|
||||
Move everything here that manages the system interface.
|
||||
|
||||
There is excatly one system driver.
|
||||
There is exactly one system driver.
|
||||
|
||||
- filename and pathname management
|
||||
- directory and file access
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/fl_ask.H>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <string.h>
|
||||
#if HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
|
@ -21,6 +21,7 @@
|
||||
#ifdef FL_CFG_GFX_XLIB
|
||||
#include <FL/Fl_Copy_Surface.H>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include "Fl_Translated_Xlib_Graphics_Driver.H"
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define FL_CFG_GFX_XLIB_H
|
||||
|
||||
#include <FL/Fl_Graphics_Driver.H>
|
||||
#include <FL/x.H>
|
||||
|
||||
/**
|
||||
\brief The Xlib-specific graphics class.
|
||||
@ -38,8 +39,12 @@ protected:
|
||||
uchar **mask_bitmap_;
|
||||
uchar **mask_bitmap() {return mask_bitmap_;}
|
||||
void mask_bitmap(uchar **value) { mask_bitmap_ = value; }
|
||||
int p_size;
|
||||
typedef struct {short x, y;} XPOINT;
|
||||
XPOINT *p;
|
||||
public:
|
||||
Fl_Xlib_Graphics_Driver(void);
|
||||
virtual ~Fl_Xlib_Graphics_Driver() { if (p) free(p); }
|
||||
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
|
||||
virtual void *gc() { return gc_; }
|
||||
virtual void gc(void *value);
|
||||
@ -75,6 +80,8 @@ public:
|
||||
void copy_offscreen_with_alpha(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
|
||||
#endif
|
||||
protected:
|
||||
void transformed_vertex0(short x, short y);
|
||||
void fixloop();
|
||||
// --- implementation is in src/fl_rect.cxx which includes src/cfg_gfx/xlib_rect.cxx
|
||||
void point(int x, int y);
|
||||
void rect(int x, int y, int w, int h);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "../../config_lib.h"
|
||||
#include "Fl_Xlib_Graphics_Driver.H"
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/x.H>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -51,6 +52,8 @@ GC Fl_Xlib_Graphics_Driver::gc_ = NULL;
|
||||
|
||||
Fl_Xlib_Graphics_Driver::Fl_Xlib_Graphics_Driver(void) {
|
||||
mask_bitmap_ = NULL;
|
||||
p_size = 0;
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::gc(void *value) {
|
||||
@ -105,6 +108,22 @@ void Fl_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int
|
||||
XUnionRectWithRegion(&R, r, r);
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::transformed_vertex0(short x, short y) {
|
||||
if (!n || x != p[n-1].x || y != p[n-1].y) {
|
||||
if (n >= p_size) {
|
||||
p_size = p ? 2*p_size : 16;
|
||||
p = (XPOINT*)realloc((void*)p, p_size*sizeof(*p));
|
||||
}
|
||||
p[n].x = x;
|
||||
p[n].y = y;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::fixloop() { // remove equal points from closed path
|
||||
while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <config.h>
|
||||
#include "Fl_Xlib_Graphics_Driver.H"
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/x.H>
|
||||
|
||||
/**
|
||||
\file Fl_Xlib_Graphics_Driver_arci.cxx
|
||||
|
@ -31,15 +31,15 @@
|
||||
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::transformed_vertex(double xf, double yf) {
|
||||
transformed_vertex0(COORD_T(rint(xf)), COORD_T(rint(yf)));
|
||||
transformed_vertex0(short(rint(xf)), short(rint(yf)));
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::vertex(double x,double y) {
|
||||
transformed_vertex0(COORD_T(x*m.a + y*m.c + m.x), COORD_T(x*m.b + y*m.d + m.y));
|
||||
transformed_vertex0(short(x*m.a + y*m.c + m.x), short(x*m.b + y*m.d + m.y));
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::end_points() {
|
||||
if (n>1) XDrawPoints(fl_display, fl_window, gc_, p, n, 0);
|
||||
if (n>1) XDrawPoints(fl_display, fl_window, gc_, (XPoint*)p, n, 0);
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::end_line() {
|
||||
@ -47,12 +47,12 @@ void Fl_Xlib_Graphics_Driver::end_line() {
|
||||
end_points();
|
||||
return;
|
||||
}
|
||||
if (n>1) XDrawLines(fl_display, fl_window, gc_, p, n, 0);
|
||||
if (n>1) XDrawLines(fl_display, fl_window, gc_, (XPoint*)p, n, 0);
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::end_loop() {
|
||||
fixloop();
|
||||
if (n>2) transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y);
|
||||
if (n>2) transformed_vertex((short)p[0].x, (short)p[0].y);
|
||||
end_line();
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ void Fl_Xlib_Graphics_Driver::end_polygon() {
|
||||
end_line();
|
||||
return;
|
||||
}
|
||||
if (n>2) XFillPolygon(fl_display, fl_window, gc_, p, n, Convex, 0);
|
||||
if (n>2) XFillPolygon(fl_display, fl_window, gc_, (XPoint*)p, n, Convex, 0);
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::begin_complex_polygon() {
|
||||
@ -73,7 +73,7 @@ void Fl_Xlib_Graphics_Driver::begin_complex_polygon() {
|
||||
void Fl_Xlib_Graphics_Driver::gap() {
|
||||
while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
|
||||
if (n > gap_+2) {
|
||||
transformed_vertex((COORD_T)p[gap_].x, (COORD_T)p[gap_].y);
|
||||
transformed_vertex((short)p[gap_].x, (short)p[gap_].y);
|
||||
gap_ = n;
|
||||
} else {
|
||||
n = gap_;
|
||||
@ -86,7 +86,7 @@ void Fl_Xlib_Graphics_Driver::end_complex_polygon() {
|
||||
end_line();
|
||||
return;
|
||||
}
|
||||
if (n>2) XFillPolygon(fl_display, fl_window, gc_, p, n, 0, 0);
|
||||
if (n>2) XFillPolygon(fl_display, fl_window, gc_, (XPoint*)p, n, 0, 0);
|
||||
}
|
||||
|
||||
// shortcut the closed circles so they use XDrawArc:
|
||||
|
@ -23,6 +23,7 @@
|
||||
// portable to other systems.
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <FL/Fl_Pixmap.H>
|
||||
#include <FL/Fl_RGB_Image.H>
|
||||
|
@ -33,6 +33,7 @@
|
||||
// transparency added, color cube not required, etc. -erco Oct 20 2013
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <stdio.h>
|
||||
#include "flstring.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
// Select fonts from the FLTK font table.
|
||||
#include "flstring.h"
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include "Fl_Font.H"
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
//
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include "flstring.h"
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <config.h>
|
||||
#include "config_lib.h"
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/Fl_Printer.H>
|
||||
#include <FL/fl_draw.H>
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#ifdef __APPLE__
|
||||
#include "drivers/Quartz/Fl_Quartz_Graphics_Driver.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
// Also see fl_set_fonts.cxx which adds all possible fonts.
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include "flstring.h"
|
||||
#include "Fl_Font.H"
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include <FL/Fl_Widget.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl_System_Driver.H>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include "flstring.h"
|
||||
|
@ -125,22 +125,6 @@ double Fl_Graphics_Driver::transform_dy(double x, double y) {
|
||||
return x*m.b + y*m.d;
|
||||
}
|
||||
|
||||
void Fl_Graphics_Driver::transformed_vertex0(COORD_T x, COORD_T y) {
|
||||
if (!n || x != p[n-1].x || y != p[n-1].y) {
|
||||
if (n >= p_size) {
|
||||
p_size = p ? 2*p_size : 16;
|
||||
p = (XPOINT*)realloc((void*)p, p_size*sizeof(*p));
|
||||
}
|
||||
p[n].x = x;
|
||||
p[n].y = y;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Graphics_Driver::fixloop() { // remove equal points from closed path
|
||||
while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user