summaryrefslogtreecommitdiff
path: root/src/fl_scroll_area.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/fl_scroll_area.cxx')
-rw-r--r--src/fl_scroll_area.cxx90
1 files changed, 6 insertions, 84 deletions
diff --git a/src/fl_scroll_area.cxx b/src/fl_scroll_area.cxx
index aa63976f7..5c045a72c 100644
--- a/src/fl_scroll_area.cxx
+++ b/src/fl_scroll_area.cxx
@@ -20,13 +20,7 @@
// a "callback" which is called to draw rectangular areas that are moved
// into the drawing area.
-#include <config.h>
-#include <FL/Fl.H>
-#include <FL/x.H>
-#include <FL/fl_draw.H>
-#ifdef __APPLE__
-#include "drivers/Quartz/Fl_Quartz_Graphics_Driver.h"
-#endif
+#include <Fl/Fl_Window_Driver.H>
// scroll a rectangle and redraw the newly exposed portions:
/**
@@ -78,84 +72,12 @@ void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
clip_h = H-src_h;
}
-#if defined(USE_X11)
- XCopyArea(fl_display, fl_window, fl_window, (GC)fl_graphics_driver->gc(),
- src_x, src_y, src_w, src_h, dest_x, dest_y);
- // we have to sync the display and get the GraphicsExpose events! (sigh)
- for (;;) {
- XEvent e; XWindowEvent(fl_display, fl_window, ExposureMask, &e);
- if (e.type == NoExpose) break;
- // otherwise assume it is a GraphicsExpose event:
- draw_area(data, e.xexpose.x, e.xexpose.y,
- e.xexpose.width, e.xexpose.height);
- if (!e.xgraphicsexpose.count) break;
- }
-#elif defined(WIN32)
- typedef int (WINAPI* fl_GetRandomRgn_func)(HDC, HRGN, INT);
- static fl_GetRandomRgn_func fl_GetRandomRgn = 0L;
- static char first_time = 1;
-
- // We will have to do some Region magic now, so let's see if the
- // required function is available (and it should be staring w/Win95)
- if (first_time) {
- HMODULE hMod = GetModuleHandle("GDI32.DLL");
- if (hMod) {
- fl_GetRandomRgn = (fl_GetRandomRgn_func)GetProcAddress(hMod, "GetRandomRgn");
- }
- first_time = 0;
- }
-
- // Now check if the source scrolling area is fully visible.
- // If it is, we will do a quick scroll and just update the
- // newly exposed area. If it is not, we go the safe route and
- // re-render the full area instead.
- // Note 1: we could go and find the areas that are actually
- // obscured and recursively call fl_scroll for the newly found
- // rectangles. However, this practice would rely on the
- // elements of the undocumented Rgn structure.
- // Note 2: although this method should take care of most
- // multi-screen solutions, it will not solve issues scrolling
- // from a different resolution screen onto another.
- // Note 3: this has been tested with image maps, too.
- HDC gc = (HDC)fl_graphics_driver->gc();
- if (fl_GetRandomRgn) {
- // get the DC region minus all overlapping windows
- HRGN sys_rgn = CreateRectRgn(0, 0, 0, 0);
- fl_GetRandomRgn(gc, sys_rgn, 4);
- // now get the source scrolling rectangle
- HRGN src_rgn = CreateRectRgn(src_x, src_y, src_x+src_w, src_y+src_h);
- POINT offset = { 0, 0 };
- if (GetDCOrgEx(gc, &offset)) {
- OffsetRgn(src_rgn, offset.x, offset.y);
- }
- // see if all source pixels are available in the system region
- // Note: we could be a bit more merciful and subtract the
- // scroll destination region as well.
- HRGN dst_rgn = CreateRectRgn(0, 0, 0, 0);
- int r = CombineRgn(dst_rgn, src_rgn, sys_rgn, RGN_DIFF);
- DeleteObject(dst_rgn);
- DeleteObject(src_rgn);
- DeleteObject(sys_rgn);
- if (r!=NULLREGION) {
- draw_area(data,X,Y,W,H);
- return;
- }
+ int retval = Fl_Window::current()->driver()->scroll(src_x, src_y, src_w, src_h,
+ dest_x, dest_y, draw_area, data);
+ if (retval) {
+ draw_area(data,X,Y,W,H);
+ return;
}
-
- // Great, we can do an accelerated scroll instead of re-rendering
- BitBlt(gc, dest_x, dest_y, src_w, src_h, gc, src_x, src_y,SRCCOPY);
-
-#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Graphics_Driver - platform scrolling
- CGImageRef img = Fl_X::CGImage_from_window_rect(Fl_Window::current(), src_x, src_y, src_w, src_h);
- if (img) {
- ((Fl_Quartz_Graphics_Driver*)fl_graphics_driver)->draw_CGImage(img,dest_x,dest_y,src_w,src_h,0,0,src_w,src_h);
- CFRelease(img);
- }
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: implement scrolling of the screen contents"
-#else
-# error unsupported platform
-#endif
if (dx) draw_area(data, clip_x, dest_y, clip_w, src_h);
if (dy) draw_area(data, X, clip_y, W, clip_h);
}