1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
//
// "$Id$"
//
// implementation of Fl_Device class for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2012 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
//
// Please report all bugs and problems to:
//
// http://www.fltk.org/str.php
//
#include <FL/Fl.H>
#include "config_lib.h"
#include <FL/Fl_Device.H>
#include <FL/Fl_Image.H>
#include <FL/fl_draw.h>
#ifdef FL_CFG_GFX_QUARTZ
#include "drivers/Quartz/Fl_Quartz_Graphics_Driver.h"
#endif
#if defined(WIN32) || defined(__APPLE__)
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate and implement various device drivers here"
#else
#endif
const char *Fl_Device::class_id = "Fl_Device";
const char *Fl_Surface_Device::class_id = "Fl_Surface_Device";
const char *Fl_Display_Device::class_id = "Fl_Display_Device";
const char *Fl_Graphics_Driver::class_id = "Fl_Graphics_Driver";
#if defined(__APPLE__) || defined(FL_DOXYGEN)
# ifndef FL_DOXYGEN
bool Fl_Display_Device::high_res_window_ = false;
# endif
#endif
#if defined(WIN32) || defined(FL_DOXYGEN)
const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
const char *Fl_GDI_Printer_Graphics_Driver::class_id = "Fl_GDI_Printer_Graphics_Driver";
#endif
#if !(defined(__APPLE__) || defined(WIN32))
#if defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate the main graphics driver here"
#else
const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
#endif
#endif
/** \brief Make this surface the current drawing surface.
This surface will receive all future graphics requests. */
void Fl_Surface_Device::set_current(void)
{
fl_graphics_driver = _driver;
_surface = this;
}
FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver; // the current target device of graphics operations
Fl_Surface_Device* Fl_Surface_Device::_surface; // the current target surface of graphics operations
const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};
Fl_Graphics_Driver::Fl_Graphics_Driver() {
font_ = 0;
size_ = 0;
sptr=0; rstackptr=0;
rstack[0] = NULL;
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)
{
w = (int)width(t, n);
h = - height();
dx = 0;
dy = descent();
}
void Fl_Graphics_Driver::focus_rect(int x, int y, int w, int h)
{
line_style(FL_DOT);
rect(x, y, w, h);
line_style(FL_SOLID);
}
/** A constructor that sets the graphics driver used by the display */
Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device(graphics_driver) {
this->set_current();
};
/** Returns the platform display device. */
Fl_Display_Device *Fl_Display_Device::display_device() {
static Fl_Display_Device *display = new Fl_Display_Device(new
#if defined(__APPLE__)
Fl_Quartz_Graphics_Driver
#elif defined(WIN32)
Fl_GDI_Graphics_Driver
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: instantiate your display driver here"
Fl_XXX_Graphics_Driver
#else
Fl_Xlib_Graphics_Driver
#endif
);
return display;
};
Fl_Surface_Device *Fl_Surface_Device::default_surface()
{
return Fl_Display_Device::display_device();
}
Fl_Display_Device *Fl_Display_Device::_display = Fl_Display_Device::display_device();
//
// End of "$Id$".
//
|