FLTK logo

[Library] r8471 - in branches/branch-1.3: FL src

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[Library] r8471 - in branches/branch-1.3: FL src fltk-dev Feb 24, 2011  
 
Author: manolo
Date: 2011-02-24 10:02:11 -0800 (Thu, 24 Feb 2011)
New Revision: 8471
Log:
Made struct matrix a subclass of Fl_Graphics_Device class to avoid collision
with application-defined names.

Modified:
   branches/branch-1.3/FL/Fl_Device.H
   branches/branch-1.3/src/Fl_Device.cxx
   branches/branch-1.3/src/fl_rect.cxx
   branches/branch-1.3/src/fl_vertex.cxx

Modified: branches/branch-1.3/FL/Fl_Device.H
===================================================================
--- branches/branch-1.3/FL/Fl_Device.H	2011-02-24 16:58:00 UTC (rev 8470)
+++ branches/branch-1.3/FL/Fl_Device.H	2011-02-24 18:02:11 UTC (rev 8471)
@@ -55,15 +55,6 @@
  */
 typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
 
-#define REGION_STACK_SIZE 10
-#define REGION_STACK_MAX (REGION_STACK_SIZE - 1)
-
-#define MATRIX_STACK_SIZE 32
-#define MATRIX_STACK_MAX (MATRIX_STACK_SIZE - 1)
-/** A 2D coordinate transformation matrix
- */
-struct matrix {double a, b, c, d, x, y;};
-
 // typedef what the x,y fields in a point are:
 #ifdef WIN32
 typedef int COORD_T;
@@ -97,6 +88,8 @@
   virtual const char *class_name() {return class_id;};
 };
 
+#define FL_REGION_STACK_SIZE 10
+#define FL_MATRIX_STACK_SIZE 32
 /**
  \brief A virtual class subclassed for each graphics driver FLTK uses.
  *
@@ -106,19 +99,27 @@
  in the \ref fl_drawings and \ref fl_attributes modules. 
   */
 class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
+public:
+  /** A 2D coordinate transformation matrix
+   */
+  struct matrix {double a, b, c, d, x, y;};
+private:
+  static const matrix m0;
   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];
+  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 what;
   int fl_clip_state_number;
   int rstackptr;
-  Fl_Region rstack[REGION_STACK_MAX];
+  static const int region_stack_max = FL_REGION_STACK_SIZE - 1;
+  Fl_Region rstack[FL_REGION_STACK_SIZE];
 #ifdef WIN32
   int numcount;
   int counts[20];

Modified: branches/branch-1.3/src/Fl_Device.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Device.cxx	2011-02-24 16:58:00 UTC (rev 8470)
+++ branches/branch-1.3/src/Fl_Device.cxx	2011-02-24 18:02:11 UTC (rev 8471)
@@ -51,7 +51,7 @@
   _surface = this;
 }
 
-static matrix m0 = {1, 0, 0, 1, 0, 0};
+const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};
 
 Fl_Graphics_Driver::Fl_Graphics_Driver() {
   font_ = 0;

Modified: branches/branch-1.3/src/fl_rect.cxx
===================================================================
--- branches/branch-1.3/src/fl_rect.cxx	2011-02-24 16:58:00 UTC (rev 8470)
+++ branches/branch-1.3/src/fl_rect.cxx	2011-02-24 18:02:11 UTC (rev 8471)
@@ -590,14 +590,14 @@
 # error unsupported platform
 #endif
   }
-  if (rstackptr < REGION_STACK_MAX) rstack[++rstackptr] = r;
+  if (rstackptr < region_stack_max) rstack[++rstackptr] = r;
   else Fl::warning("fl_push_clip: clip stack overflow!\n");
   fl_restore_clip();
 }
 
 // make there be no clip (used by fl_begin_offscreen() only!)
 void Fl_Graphics_Driver::push_no_clip() {
-  if (rstackptr < REGION_STACK_MAX) rstack[++rstackptr] = 0;
+  if (rstackptr < region_stack_max) rstack[++rstackptr] = 0;
   else Fl::warning("fl_push_no_clip: clip stack overflow!\n");
   fl_restore_clip();
 }

Modified: branches/branch-1.3/src/fl_vertex.cxx
===================================================================
--- branches/branch-1.3/src/fl_vertex.cxx	2011-02-24 16:58:00 UTC (rev 8470)
+++ branches/branch-1.3/src/fl_vertex.cxx	2011-02-24 18:02:11 UTC (rev 8471)
@@ -45,7 +45,7 @@
 #include <stdlib.h>
 
 void Fl_Graphics_Driver::push_matrix() {
-  if (sptr==MATRIX_STACK_SIZE)
+  if (sptr==matrix_stack_size)
     Fl::error("fl_push_matrix(): matrix stack overflow.");
   else
     stack[sptr++] = m;

Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.