summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-03-13 22:16:37 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-03-13 22:16:37 +0000
commitb496d18b85917106c48e8e6f74115b3122b603d1 (patch)
tree4d96befa4377a81c89c6a32f4d66220199572938 /src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
parent30756ae3500a62bd8f63b4df3eb3ca8f6b8b0b70 (diff)
Fixed 'flush()' code for single, double, and overlay buffering
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11359 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx84
1 files changed, 82 insertions, 2 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index 6e7d546da..c1893b841 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -18,11 +18,13 @@
#include "../../config_lib.h"
+#include <FL/fl_draw.H>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Image.H>
#include <FL/Fl_Bitmap.H>
#include <FL/Fl_Window.H>
+#include <FL/Fl_Overlay_Window.H>
#include <FL/x.H>
#include "Fl_WinAPI_Window_Driver.H"
#include <windows.h>
@@ -40,6 +42,7 @@ Fl_WinAPI_Window_Driver::Fl_WinAPI_Window_Driver(Fl_Window *win)
memset(icon_, 0, sizeof(Fl_Window_Driver::icon_data));
}
+
Fl_WinAPI_Window_Driver::~Fl_WinAPI_Window_Driver()
{
if (shape_data_) {
@@ -96,6 +99,7 @@ int Fl_WinAPI_Window_Driver::decorated_h()
}
+// --- window management
@@ -235,7 +239,8 @@ static HRGN bitmap2region(Fl_Image* image) {
}
-void Fl_WinAPI_Window_Driver::draw() {
+void Fl_WinAPI_Window_Driver::draw_begin()
+{
if (shape_data_) {
if ((shape_data_->lw_ != pWindow->w() || shape_data_->lh_ != pWindow->h()) && shape_data_->shape_) {
// size of window has changed since last time
@@ -246,9 +251,84 @@ void Fl_WinAPI_Window_Driver::draw() {
SetWindowRgn(fl_xid(pWindow), region, TRUE); // the system deletes the region when it's no longer needed
delete temp;
}
- } Fl_Window_Driver::draw();
+ }
+}
+
+
+void Fl_WinAPI_Window_Driver::draw_end()
+{
}
+
+void Fl_WinAPI_Window_Driver::flush_single()
+{
+ if (!pWindow->shown()) return;
+ pWindow->make_current(); // make sure fl_gc is non-zero
+ Fl_X *i = Fl_X::i(pWindow);
+ if (!i) return;
+ fl_clip_region(i->region);
+ i->region = 0;
+ pWindow->draw();
+}
+
+
+void Fl_WinAPI_Window_Driver::flush_double()
+{
+ if (!pWindow->shown()) return;
+ pWindow->make_current(); // make sure fl_gc is non-zero
+ Fl_X *i = Fl_X::i(pWindow);
+ if (!i) return; // window not yet created
+
+ if (!i->other_xid) {
+ i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h());
+ pWindow->clear_damage(FL_DAMAGE_ALL);
+ }
+ if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) {
+ fl_clip_region(i->region); i->region = 0;
+ fl_begin_offscreen(i->other_xid);
+ fl_graphics_driver->clip_region( 0 );
+ draw();
+ fl_end_offscreen();
+ }
+
+ int X,Y,W,H; fl_clip_box(0,0,pWindow->w(),pWindow->h(),X,Y,W,H);
+ if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y);
+}
+
+
+void Fl_WinAPI_Window_Driver::flush_overlay()
+{
+ Fl_Overlay_Window *oWindow = pWindow->as_overlay_window();
+ if (!oWindow) return flush_single();
+
+ if (!pWindow->shown()) return;
+ pWindow->make_current(); // make sure fl_gc is non-zero
+ Fl_X *i = Fl_X::i(pWindow);
+ if (!i) return; // window not yet created
+
+ int eraseoverlay = (pWindow->damage()&FL_DAMAGE_OVERLAY);
+ pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY));
+
+ if (!i->other_xid) {
+ i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h());
+ pWindow->clear_damage(FL_DAMAGE_ALL);
+ }
+ if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) {
+ fl_clip_region(i->region); i->region = 0;
+ fl_begin_offscreen(i->other_xid);
+ fl_graphics_driver->clip_region(0);
+ draw();
+ fl_end_offscreen();
+ }
+
+ if (eraseoverlay) fl_clip_region(0);
+ int X, Y, W, H; fl_clip_box(0, 0, pWindow->w(), pWindow->h(), X, Y, W, H);
+ if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y);
+
+ if (oWindow->overlay_ == oWindow) oWindow->draw_overlay();
+}
+
+
void Fl_WinAPI_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) {
free_icons();