summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-02-06 12:32:23 +0000
committerManolo Gouy <Manolo>2011-02-06 12:32:23 +0000
commit6a5feafe23e6e37009312aa40b63d19ad9cff886 (patch)
treea5d1d7b429cec1ae3f21647e9777a5bc66c0b8c3 /FL
parent5e7232e776d3325ecc1a336453a3f846a1872ff1 (diff)
Replaced global variable fl_color_ by a private member of the Fl_Graphics_Driver class,
and a public getter to it: Fl_Graphics_Driver::color(). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8384 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Device.H7
-rw-r--r--FL/fl_draw.H4
2 files changed, 6 insertions, 5 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H
index 42b386e9c..705d17be1 100644
--- a/FL/Fl_Device.H
+++ b/FL/Fl_Device.H
@@ -114,6 +114,7 @@ public:
class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
Fl_Font font_; // current font
Fl_Fontsize size_; // current font size
+ Fl_Color color_; // current color
enum {LINE, LOOP, POLYGON, POINT_};
int sptr;
matrix stack[MATRIX_STACK_SIZE];
@@ -236,7 +237,7 @@ protected:
/** \brief see fl_rtl_draw(const char *str, int n, int x, int y). */
virtual void rtl_draw(const char *str, int n, int x, int y) = 0;
/** \brief see fl_color(Fl_Color c). */
- virtual void color(Fl_Color c) = 0;
+ virtual void color(Fl_Color c) {color_ = c;}
/** \brief see fl_color(uchar r, uchar g, uchar b). */
virtual void color(uchar r, uchar g, uchar b) = 0;
/** \brief see fl_point(int x, int y). */
@@ -350,10 +351,12 @@ public:
static const char *class_id;
/** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
virtual void font(Fl_Font face, Fl_Fontsize size) {font_ = face; size_ = size;}
- /** \brief see fl_font(). */
+ /** \brief see fl_font(void). */
Fl_Font font() {return font_; }
/** \brief see fl_size(). */
Fl_Fontsize size() {return size_; }
+ /** \brief see fl_color(void). */
+ Fl_Color color() {return color_;}
/** \brief The destructor */
virtual ~Fl_Graphics_Driver() {};
};
diff --git a/FL/fl_draw.H b/FL/fl_draw.H
index 5d197e403..a9651846d 100644
--- a/FL/fl_draw.H
+++ b/FL/fl_draw.H
@@ -72,13 +72,11 @@ inline void fl_color(int c) {fl_color((Fl_Color)c);}
\param[in] r,g,b color components
*/
inline void fl_color(uchar r, uchar g, uchar b) {fl_graphics_driver->color(r,g,b); } // select actual color
-/** \brief The current color */
-extern FL_EXPORT Fl_Color fl_color_;
/**
Returns the last fl_color() that was set.
This can be used for state save/restore.
*/
-inline Fl_Color fl_color() {return fl_color_;}
+inline Fl_Color fl_color() {return fl_graphics_driver->color();}
/** @} */
/** \addtogroup fl_drawings