summaryrefslogtreecommitdiff
path: root/src/drivers/GDI
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-02-26 12:51:47 +0000
committerManolo Gouy <Manolo>2016-02-26 12:51:47 +0000
commit682f95079691dd9c9b0677cb66e727397f910e0d (patch)
tree9be00996ebe41d8d87fb1965ceff4f6f69b41310 /src/drivers/GDI
parente1f5f5f7ec75ed203fb14571e6bcbf6b0bd30771 (diff)
Create class Fl_Widget_Surface that supports draw(Fl_Widget *, int, int).
This simplifies the implementation of Fl_Copy_Surface and Fl_Image_Surface which now are made to derive from Fl_Widget_Surface. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11220 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/GDI')
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx13
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.h9
2 files changed, 22 insertions, 0 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
index 175a48e7e..1230290c6 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
@@ -20,6 +20,7 @@
#include <config.h>
#include "../../config_lib.h"
#include "Fl_GDI_Graphics_Driver.h"
+#include <FL/Fl.H>
/* Reference to the current device context
@@ -129,6 +130,18 @@ void Fl_GDI_Graphics_Driver::copy_offscreen_with_alpha(int x,int y,int w,int h,H
DeleteDC(new_gc);
}
+void Fl_Translated_GDI_Graphics_Driver::translate_all(int x, int y) {
+ GetWindowOrgEx((HDC)gc(), origins+depth);
+ SetWindowOrgEx((HDC)gc(), origins[depth].x - x, origins[depth].y - y, NULL);
+ if (depth < sizeof(origins)/sizeof(POINT)) depth++;
+ else Fl::warning("Fl_Copy_Surface: translate stack overflow!");
+}
+
+void Fl_Translated_GDI_Graphics_Driver::untranslate_all() {
+ if (depth > 0) depth--;
+ SetWindowOrgEx((HDC)gc(), origins[depth].x, origins[depth].y, NULL);
+}
+
//
// End of "$Id$".
//
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.h b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h
index 6852b4beb..a4b2730aa 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.h
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.h
@@ -26,6 +26,7 @@
#define FL_GDI_GRAPHICS_DRIVER_H
#include <FL/Fl_Graphics_Driver.H>
+#include <windows.h>
/**
@@ -136,6 +137,14 @@ public:
int draw_scaled(Fl_Image *img, int XP, int YP, int WP, int HP);
};
+class Fl_Translated_GDI_Graphics_Driver : public Fl_GDI_Graphics_Driver {
+ unsigned depth;
+ POINT origins[10];
+public:
+ Fl_Translated_GDI_Graphics_Driver() {depth = 0;}
+ virtual void translate_all(int x, int y);
+ virtual void untranslate_all(void);
+};
#endif // FL_GDI_GRAPHICS_DRIVER_H