From d67f395031b0e9cfb266bf31a4a5e08a2d109e3b Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 30 Mar 2016 20:16:40 +0000 Subject: Rewrite functions XRectangleRegion(), XDestroyRegion() under the driver model. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11479 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/drivers/GDI') diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx index 54740fc10..f03c38940 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx @@ -166,6 +166,18 @@ void Fl_GDI_Graphics_Driver::fixloop() { // remove equal points from closed pat while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--; } +Fl_Region Fl_Graphics_Driver::XRectangleRegion(int x, int y, int w, int h) { + if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) return CreateRectRgn(x,y,x+w,y+h); + // because rotation may apply, the rectangle becomes a polygon in device coords + POINT pt[4] = { {x, y}, {x + w, y}, {x + w, y + h}, {x, y + h} }; + LPtoDP((HDC)fl_graphics_driver->gc(), pt, 4); + return CreatePolygonRgn(pt, 4, ALTERNATE); +} + +void Fl_Graphics_Driver::XDestroyRegion(Fl_Region r) { + DeleteObject(r); +} + // // End of "$Id$". -- cgit v1.2.3