diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-02-09 21:54:38 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-02-09 21:54:38 +0000 |
| commit | 94f0278d4771c816f3303efd2e8fa10fc6c41b7a (patch) | |
| tree | d60ad09f2f45e2d972541fe19a5a7d26bb3a1ddf /src/drivers/Xlib | |
| parent | 7a0fe79f99ea90106b035047cb37148b4f3809fc (diff) | |
Porting efforts, minimal Android stuff, cleanup.
- Moving code around for Fl_Double_Window, but not yet happy
- Tested CMake for Android cross compilation. Very happy!
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11142 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Xlib')
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx | 41 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h | 1 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx index 0385413f1..cdcfd4548 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx @@ -21,6 +21,10 @@ #include "../../config_lib.h" #include "Fl_Xlib_Graphics_Driver.h" +#if HAVE_XRENDER +#include <X11/extensions/Xrender.h> +#endif + const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver"; @@ -34,6 +38,43 @@ Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() return new Fl_Xlib_Graphics_Driver(); } +char Fl_Xlib_Graphics_Driver::can_do_alpha_blending() { + return Fl_X::xrender_supported(); +} + + +void Fl_Xlib_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { + XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y); +} + +void Fl_Xlib_Graphics_Driver::copy_offscreen_with_alpha(int x, int y, int w, int h, + Fl_Offscreen pixmap, int srcx, int srcy) { +#if HAVE_XRENDER + XRenderPictureAttributes srcattr; + memset(&srcattr, 0, sizeof(XRenderPictureAttributes)); + static XRenderPictFormat *srcfmt = XRenderFindStandardFormat(fl_display, PictStandardARGB32); + static XRenderPictFormat *dstfmt = XRenderFindStandardFormat(fl_display, PictStandardRGB24); + + Picture src = XRenderCreatePicture(fl_display, pixmap, srcfmt, 0, &srcattr); + Picture dst = XRenderCreatePicture(fl_display, fl_window, dstfmt, 0, &srcattr); + + if (!src || !dst) { + fprintf(stderr, "Failed to create Render pictures (%lu %lu)\n", src, dst); + return; + } + + const Fl_Region clipr = fl_clip_region(); + if (clipr) + XRenderSetPictureClipRegion(fl_display, dst, clipr); + + XRenderComposite(fl_display, PictOpOver, src, None, dst, srcx, srcy, 0, 0, + x, y, w, h); + + XRenderFreePicture(fl_display, src); + XRenderFreePicture(fl_display, dst); +#endif +} + // // End of "$Id$". // diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h index 577f5f573..8cd086a2a 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.h @@ -37,6 +37,7 @@ public: static const char *class_id; const char *class_name() {return class_id;}; virtual int has_feature(driver_feature mask) { return mask & NATIVE; } + char can_do_alpha_blending(); // --- bitmap stuff Fl_Bitmask create_bitmask(int w, int h, const uchar *array); |
