summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-02-23 10:21:27 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-02-23 10:21:27 +0100
commit21c0134931ef22d6645fc182d7812776e14e369d (patch)
tree14e41d62f041a000214442be26aefb33eb911c02 /src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
parentf9255e375cb4751404e33837cdddd6f2d31d96b9 (diff)
New member function const Fl_Image* Fl_Window::shape() replaces int Fl_Window::is_shaped()
The new function allows to get the window's shaping image and delete it after use, if appropriate.
Diffstat (limited to 'src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index 3b6974330..27263b374 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -179,6 +179,7 @@ void Fl_WinAPI_Window_Driver::shape_alpha_(Fl_Image* img, int offset) {
bitmap->alloc_array = 1;
shape_bitmap_(bitmap);
shape_data_->todelete_ = bitmap;
+ shape_data_->shape_ = img;
}
void Fl_WinAPI_Window_Driver::shape(const Fl_Image* img) {
@@ -191,7 +192,10 @@ void Fl_WinAPI_Window_Driver::shape(const Fl_Image* img) {
memset(shape_data_, 0, sizeof(shape_data_type));
pWindow->border(false);
int d = img->d();
- if (d && img->count() >= 2) shape_pixmap_((Fl_Image*)img);
+ if (d && img->count() >= 2) {
+ shape_pixmap_((Fl_Image*)img);
+ shape_data_->shape_ = (Fl_Image*)img;
+ }
else if (d == 0) shape_bitmap_((Fl_Image*)img);
else if (d == 2 || d == 4) shape_alpha_((Fl_Image*)img, d - 1);
else if ((d == 1 || d == 3) && img->count() == 1) shape_alpha_((Fl_Image*)img, 0);
@@ -285,7 +289,8 @@ void Fl_WinAPI_Window_Driver::draw_begin()
// size of window has changed since last time
shape_data_->lw_ = s*w();
shape_data_->lh_ = s*h();
- Fl_Image* temp = shape_data_->shape_->copy(shape_data_->lw_, shape_data_->lh_);
+ Fl_Image* temp = shape_data_->todelete_ ? shape_data_->todelete_ : shape_data_->shape_;
+ temp = temp->copy(shape_data_->lw_, shape_data_->lh_);
HRGN region = bitmap2region(temp);
SetWindowRgn(fl_xid(pWindow), region, TRUE); // the system deletes the region when it's no longer needed
delete temp;
@@ -698,6 +703,10 @@ void Fl_WinAPI_Window_Driver::resize_after_screen_change(void *data) {
data_for_resize_window_between_screens_.busy = false;
}
+const Fl_Image* Fl_WinAPI_Window_Driver::shape() {
+ return shape_data_ ? shape_data_->shape_ : NULL;
+}
+
//
// End of "$Id$".
//