FLTK logo

[master] 09697c4 - Fix GDI graphics driver use for bitmasks

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 ]

[master] 09697c4 - Fix GDI graphics driver use for bitmasks "Matthias Melcher" Nov 25, 2022  
 
commit 09697c47385b2b4749f41e2862b0e93eb9933092
Author:     Matthias Melcher <github@matthiasm.com>
AuthorDate: Fri Nov 25 10:52:46 2022 +0100
Commit:     Matthias Melcher <github@matthiasm.com>
CommitDate: Fri Nov 25 10:52:46 2022 +0100

    Fix GDI graphics driver use for bitmasks

 src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 9e512d8..d3e23be 100644
--- src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -803,7 +803,11 @@ void Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) {
   fl_draw_pixmap(img->data(), 0, 0, FL_BLACK);
   uchar *bitmap = *pbitmap;
   if (bitmap) {
-    *Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)create_bitmask(img->data_w(), img->data_h(), bitmap);
+    // Note: activating the surface device changes graphics drivers.
+    // Don't use 'this', but the new driver instead.
+    *Fl_Graphics_Driver::mask(img) =
+      (fl_uintptr_t)((Fl_GDI_Graphics_Driver *)fl_graphics_driver)->
+      create_bitmask(img->data_w(), img->data_h(), bitmap);
     delete[] bitmap;
   }
   *pbitmap = 0;
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'.