summaryrefslogtreecommitdiff
path: root/src/drivers/GDI
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-03-15 06:42:06 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-29 12:15:32 +0200
commitc720aae51515907ae82ee02df80bd084f291d4b1 (patch)
tree7fbf3569f35966891df68490b047b30c9ec20bcd /src/drivers/GDI
parent28981f6fd3971aaf7ff6527ee1cdeb9d886c4a4a (diff)
Make hybrid Wayland/X11 platform.
Diffstat (limited to 'src/drivers/GDI')
-rw-r--r--src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx4
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx14
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx6
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx18
-rw-r--r--src/drivers/GDI/Fl_GDI_Image_Surface_Driver.H2
-rw-r--r--src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx8
6 files changed, 28 insertions, 24 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
index 29478a9c4..c44c0a77b 100644
--- a/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Copy_Surface_Driver.cxx
@@ -64,7 +64,7 @@ Fl_GDI_Copy_Surface_Driver::~Fl_GDI_Copy_Surface_Driver() {
fl_color(FL_WHITE); // draw white background
fl_rectf(0, 0, W, H);
PlayEnhMetaFile((HDC)surf->driver()->gc(), hmf, &rect); // draw metafile to offscreen buffer
- SetClipboardData(CF_BITMAP, surf->offscreen());
+ SetClipboardData(CF_BITMAP, (HBITMAP)surf->offscreen());
Fl_Surface_Device::pop_current();
delete surf;
@@ -80,7 +80,7 @@ Fl_GDI_Copy_Surface_Driver::~Fl_GDI_Copy_Surface_Driver() {
void Fl_GDI_Copy_Surface_Driver::set_current() {
driver()->gc(gc);
- fl_window = (Window)1;
+ fl_window = (HWND)1;
Fl_Surface_Device::set_current();
}
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
index 87adc44f0..188bd1d2d 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
@@ -75,6 +75,10 @@ static FL_BLENDFUNCTION blendfunc = { 0, 0, 255, 1};
*/
HDC fl_gc = 0;
+
+HDC fl_win32_gc() { return fl_gc; }
+
+
Fl_GDI_Graphics_Driver::Fl_GDI_Graphics_Driver() {
mask_bitmap_ = NULL;
gc_ = NULL;
@@ -157,7 +161,7 @@ void Fl_GDI_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offsc
if (w <= 0 || h <= 0) return;
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
- SelectObject(new_gc, bitmap);
+ SelectObject(new_gc, (HBITMAP)bitmap);
BitBlt(gc_, x, y, w, h, new_gc, srcx, srcy, SRCCOPY);
RestoreDC(new_gc, save);
DeleteDC(new_gc);
@@ -211,8 +215,8 @@ void Fl_GDI_Graphics_Driver::untranslate_all() {
#endif
void Fl_GDI_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int W, int H) {
- Fl_Region R = XRectangleRegion(X, Y, W, H);
- CombineRgn(r, r, R, RGN_OR);
+ HRGN R = (HRGN)XRectangleRegion(X, Y, W, H);
+ CombineRgn((HRGN)r, (HRGN)r, R, RGN_OR);
XDestroyRegion(R);
}
@@ -241,7 +245,7 @@ Fl_Region Fl_GDI_Graphics_Driver::XRectangleRegion(int x, int y, int w, int h) {
}
void Fl_GDI_Graphics_Driver::XDestroyRegion(Fl_Region r) {
- DeleteObject(r);
+ DeleteObject((HRGN)r);
}
@@ -287,7 +291,7 @@ HRGN Fl_GDI_Graphics_Driver::scale_region(HRGN r, float f, Fl_GDI_Graphics_Drive
Fl_Region Fl_GDI_Graphics_Driver::scale_clip(float f) {
- HRGN r = rstack[rstackptr];
+ HRGN r = (HRGN)rstack[rstackptr];
HRGN r2 = scale_region(r, f, this);
return (r == r2 ? NULL : (rstack[rstackptr] = r2, r));
}
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 4cfc745c9..9e512d889 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -590,7 +590,7 @@ void Fl_GDI_Graphics_Driver::draw_fixed(Fl_RGB_Image *img, int X, int Y, int W,
RestoreDC(new_gc,save);
DeleteDC(new_gc);
} else if (img->d()==2 || img->d()==4) {
- copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(img), cx, cy);
+ copy_offscreen_with_alpha(X, Y, W, H, (HBITMAP)*Fl_Graphics_Driver::id(img), cx, cy);
} else {
copy_offscreen(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(img), cx, cy);
}
@@ -653,7 +653,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP,
void Fl_GDI_Graphics_Driver::uncache(Fl_RGB_Image*, fl_uintptr_t &id_, fl_uintptr_t &mask_)
{
if (id_) {
- DeleteObject((Fl_Offscreen)id_);
+ DeleteObject((HBITMAP)id_);
id_ = 0;
}
@@ -817,5 +817,5 @@ void Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) {
}
void Fl_GDI_Graphics_Driver::uncache_pixmap(fl_uintptr_t offscreen) {
- DeleteObject((Fl_Offscreen)offscreen);
+ DeleteObject((HBITMAP)offscreen);
}
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
index 76b546092..1b13ff0a9 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
@@ -138,10 +138,10 @@ void Fl_GDI_Graphics_Driver::polygon_unscaled(int x, int y, int x1, int y1, int
// --- clipping
void Fl_GDI_Graphics_Driver::push_clip(int x, int y, int w, int h) {
- Fl_Region r;
+ HRGN r;
if (w > 0 && h > 0) {
- r = XRectangleRegion(x,y,w,h);
- Fl_Region current = rstack[rstackptr];
+ r = (HRGN)XRectangleRegion(x,y,w,h);
+ HRGN current = (HRGN)rstack[rstackptr];
if (current) {
CombineRgn(r,r,current,RGN_AND);
}
@@ -155,14 +155,14 @@ void Fl_GDI_Graphics_Driver::push_clip(int x, int y, int w, int h) {
int Fl_GDI_Graphics_Driver::clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
X = x; Y = y; W = w; H = h;
- Fl_Region r = rstack[rstackptr];
+ HRGN r = (HRGN)rstack[rstackptr];
if (!r) return 0;
// The win32 API makes no distinction between partial and complete
// intersection, so we have to check for partial intersection ourselves.
// However, given that the regions may be composite, we have to do
// some voodoo stuff...
- Fl_Region rr = XRectangleRegion(x,y,w,h);
- Fl_Region temp = CreateRectRgn(0,0,0,0);
+ HRGN rr = (HRGN)XRectangleRegion(x,y,w,h);
+ HRGN temp = CreateRectRgn(0,0,0,0);
int ret;
if (CombineRgn(temp, rr, r, RGN_AND) == NULLREGION) { // disjoint
W = H = 0;
@@ -189,7 +189,7 @@ int Fl_GDI_Graphics_Driver::clip_box(int x, int y, int w, int h, int& X, int& Y,
int Fl_GDI_Graphics_Driver::not_clipped(int x, int y, int w, int h) {
if (x+w <= 0 || y+h <= 0) return 0;
- Fl_Region r = rstack[rstackptr];
+ HRGN r = (HRGN)rstack[rstackptr];
if (!r) return 1;
RECT rect;
if (Fl_Surface_Device::surface() != Fl_Display_Device::display_device()) { // in case of print context, convert coords from logical to device
@@ -206,8 +206,8 @@ void Fl_GDI_Graphics_Driver::restore_clip() {
fl_clip_state_number++;
if (gc_) {
HRGN r = NULL;
- if (rstack[rstackptr]) r = scale_clip(scale());
- SelectClipRgn(gc_, rstack[rstackptr]); // if region is NULL, clip is automatically cleared
+ if (rstack[rstackptr]) r = (HRGN)scale_clip(scale());
+ SelectClipRgn(gc_, (HRGN)rstack[rstackptr]); // if region is NULL, clip is automatically cleared
if (r) unscale_clip(r);
}
}
diff --git a/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.H b/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.H
index 979b7bd3a..a3d8ac6c6 100644
--- a/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.H
+++ b/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.H
@@ -24,7 +24,7 @@
class Fl_GDI_Image_Surface_Driver : public Fl_Image_Surface_Driver {
virtual void end_current();
public:
- Window pre_window;
+ HWND pre_window;
int _savedc;
Fl_GDI_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
~Fl_GDI_Image_Surface_Driver();
diff --git a/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx b/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx
index 7f655e291..6795fb06b 100644
--- a/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx
+++ b/src/drivers/GDI/Fl_GDI_Image_Surface_Driver.cxx
@@ -29,8 +29,8 @@ Fl_GDI_Image_Surface_Driver::Fl_GDI_Image_Surface_Driver(int w, int h, int high_
h = int(h*d);
}
HDC gc = (HDC)Fl_Graphics_Driver::default_driver().gc();
- offscreen = off ? off : CreateCompatibleBitmap( (gc ? gc : fl_GetDC(0) ) , w, h);
- if (!offscreen) offscreen = CreateCompatibleBitmap(fl_GetDC(0), w, h);
+ offscreen = off ? off : (Fl_Offscreen)CreateCompatibleBitmap( (gc ? gc : fl_GetDC(0) ) , w, h);
+ if (!offscreen) offscreen = (Fl_Offscreen)CreateCompatibleBitmap(fl_GetDC(0), w, h);
driver(Fl_Graphics_Driver::newMainGraphicsDriver());
if (d != 1 && high_res) ((Fl_GDI_Graphics_Driver*)driver())->scale(d);
origin.x = origin.y = 0;
@@ -38,13 +38,13 @@ Fl_GDI_Image_Surface_Driver::Fl_GDI_Image_Surface_Driver(int w, int h, int high_
Fl_GDI_Image_Surface_Driver::~Fl_GDI_Image_Surface_Driver() {
- if (offscreen && !external_offscreen) DeleteObject(offscreen);
+ if (offscreen && !external_offscreen) DeleteObject((HBITMAP)offscreen);
delete driver();
}
void Fl_GDI_Image_Surface_Driver::set_current() {
- HDC gc = fl_makeDC(offscreen);
+ HDC gc = fl_makeDC((HBITMAP)offscreen);
driver()->gc(gc);
SetWindowOrgEx(gc, origin.x, origin.y, NULL);
Fl_Surface_Device::set_current();