Fix typos for Linux from previous check-in.

- The previous check-in for OS X moved a few files and symbols around
- Fixing for Linux what I broke in my previous commit
- Fixing stuff for MSWindows next
- CodeBlocks IDE file generation via CMake works



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11140 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2016-02-09 18:52:21 +00:00
parent e02b3631b3
commit 4272f32b6b
7 changed files with 94 additions and 89 deletions

View File

@ -25,7 +25,7 @@
#define FL_GRAPHICS_DRIVER_H #define FL_GRAPHICS_DRIVER_H
#include <FL/x.H> #include <FL/x.H>
#include <FL/Fl_DevIce.H> #include <FL/Fl_Device.H>
#include <FL/Fl_Image.H> #include <FL/Fl_Image.H>
#include <FL/Fl_Bitmap.H> #include <FL/Fl_Bitmap.H>
#include <FL/Fl_Pixmap.H> #include <FL/Fl_Pixmap.H>
@ -77,9 +77,9 @@ typedef short COORD_T;
in the \ref fl_drawings and \ref fl_attributes modules. The \ref fl_graphics_driver global variable in the \ref fl_drawings and \ref fl_attributes modules. The \ref fl_graphics_driver global variable
gives at any time the graphics driver used by all drawing operations. Its value changes when gives at any time the graphics driver used by all drawing operations. Its value changes when
drawing operations are directed to another drawing surface by Fl_Surface_Device::set_current(). drawing operations are directed to another drawing surface by Fl_Surface_Device::set_current().
\p The Fl_Graphics_Driver class is of interest if one wants to perform new kinds of drawing operations. \p The Fl_Graphics_Driver class is of interest if one wants to perform new kinds of drawing operations.
An example would be to draw to a PDF file. This would involve creating a new Fl_Graphics_Driver derived An example would be to draw to a PDF file. This would involve creating a new Fl_Graphics_Driver derived
class. This new class should implement all virtual methods of the Fl_Graphics_Driver class class. This new class should implement all virtual methods of the Fl_Graphics_Driver class
to support all FLTK drawing functions. to support all FLTK drawing functions.
*/ */

View File

@ -57,7 +57,7 @@ void Fl_GDI_Surface_::untranslate() {
if (depth > 0) depth--; if (depth > 0) depth--;
SetWindowOrgEx(fl_gc, origins[depth].x, origins[depth].y, NULL); SetWindowOrgEx(fl_gc, origins[depth].x, origins[depth].y, NULL);
} }
const char *Fl_GDI_Surface_::class_id = "Fl_GDI_Surface_"; const char *Fl_GDI_Surface_::class_id = "Fl_GDI_Surface_";
#endif #endif
@ -65,7 +65,7 @@ const char *Fl_GDI_Surface_::class_id = "Fl_GDI_Surface_";
const char *Fl_Copy_Surface::class_id = "Fl_Copy_Surface"; const char *Fl_Copy_Surface::class_id = "Fl_Copy_Surface";
/** Constructor. /** Constructor.
\param w and \param h are the width and height of the clipboard surface \param w and \param h are the width and height of the clipboard surface
in pixels where drawing will occur. in pixels where drawing will occur.
*/ */
@ -91,13 +91,13 @@ Fl_Copy_Surface::Fl_Copy_Surface(int w, int h) : Fl_Surface_Device(NULL)
ReleaseDC(NULL, hdc); ReleaseDC(NULL, hdc);
float factorw = (100.f * hmm) / hdots; float factorw = (100.f * hmm) / hdots;
float factorh = (100.f * vmm) / vdots; float factorh = (100.f * vmm) / vdots;
RECT rect; rect.left = 0; rect.top = 0; rect.right = (LONG)(w * factorw); rect.bottom = (LONG)(h * factorh); RECT rect; rect.left = 0; rect.top = 0; rect.right = (LONG)(w * factorw); rect.bottom = (LONG)(h * factorh);
gc = CreateEnhMetaFile (NULL, NULL, &rect, NULL); gc = CreateEnhMetaFile (NULL, NULL, &rect, NULL);
if (gc != NULL) { if (gc != NULL) {
SetTextAlign(gc, TA_BASELINE|TA_LEFT); SetTextAlign(gc, TA_BASELINE|TA_LEFT);
SetBkMode(gc, TRANSPARENT); SetBkMode(gc, TRANSPARENT);
} }
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: initialize members of Fl_Copy_Surface" # pragma message "FL_PORTING: initialize members of Fl_Copy_Surface"
#else // Xlib #else // Xlib
@ -139,9 +139,9 @@ Fl_Copy_Surface::~Fl_Copy_Surface()
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: free resources in destructor of Fl_Copy_Surface" # pragma message "FL_PORTING: free resources in destructor of Fl_Copy_Surface"
#else // Xlib #else // Xlib
fl_pop_clip(); fl_pop_clip();
unsigned char *data = fl_read_image(NULL,0,0,width,height,0); unsigned char *data = fl_read_image(NULL,0,0,width,height,0);
fl_window = oldwindow; fl_window = oldwindow;
_ss->set_current(); _ss->set_current();
Fl::copy_image(data,width,height,1); Fl::copy_image(data,width,height,1);
delete[] data; delete[] data;
@ -151,12 +151,12 @@ Fl_Copy_Surface::~Fl_Copy_Surface()
} }
/** Copies a widget in the clipboard /** Copies a widget in the clipboard
\param widget any FLTK widget (e.g., standard, custom, window, GL view) to copy \param widget any FLTK widget (e.g., standard, custom, window, GL view) to copy
\param delta_x and \param delta_y give \param delta_x and \param delta_y give
the position in the clipboard of the top-left corner of the widget the position in the clipboard of the top-left corner of the widget
*/ */
void Fl_Copy_Surface::draw(Fl_Widget* widget, int delta_x, int delta_y) void Fl_Copy_Surface::draw(Fl_Widget* widget, int delta_x, int delta_y)
{ {
helper->print_widget(widget, delta_x, delta_y); helper->print_widget(widget, delta_x, delta_y);
} }
@ -170,8 +170,8 @@ void Fl_Copy_Surface::set_current()
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement Fl_Copy_Surface::set_current" # pragma message "FL_PORTING: implement Fl_Copy_Surface::set_current"
#else #else
fl_window=xid; fl_window=xid;
_ss = Fl_Surface_Device::surface(); _ss = Fl_Surface_Device::surface();
Fl_Surface_Device::set_current(); Fl_Surface_Device::set_current();
fl_push_no_clip(); fl_push_no_clip();
#endif #endif
@ -188,14 +188,14 @@ size_t Fl_Copy_Surface::MyPutBytes(void* info, const void* buffer, size_t count)
void Fl_Copy_Surface::init_PDF_context(int w, int h) void Fl_Copy_Surface::init_PDF_context(int w, int h)
{ {
CGRect bounds = CGRectMake(0, 0, w, h ); CGRect bounds = CGRectMake(0, 0, w, h );
pdfdata = CFDataCreateMutable(NULL, 0); pdfdata = CFDataCreateMutable(NULL, 0);
CGDataConsumerRef myconsumer; CGDataConsumerRef myconsumer;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
if (&CGDataConsumerCreateWithCFData != NULL) { if (&CGDataConsumerCreateWithCFData != NULL) {
myconsumer = CGDataConsumerCreateWithCFData(pdfdata); // 10.4 myconsumer = CGDataConsumerCreateWithCFData(pdfdata); // 10.4
} }
else else
#endif #endif
{ {
static CGDataConsumerCallbacks callbacks = { Fl_Copy_Surface::MyPutBytes, NULL }; static CGDataConsumerCallbacks callbacks = { Fl_Copy_Surface::MyPutBytes, NULL };
@ -209,7 +209,7 @@ void Fl_Copy_Surface::prepare_copy_pdf_and_tiff(int w, int h)
{ {
init_PDF_context(w, h); init_PDF_context(w, h);
if (gc == NULL) return; if (gc == NULL) return;
CGRect bounds = CGRectMake(0, 0, w, h ); CGRect bounds = CGRectMake(0, 0, w, h );
CGContextBeginPage (gc, &bounds); CGContextBeginPage (gc, &bounds);
CGContextTranslateCTM(gc, 0, h); CGContextTranslateCTM(gc, 0, h);
CGContextScaleCTM(gc, 1.0f, -1.0f); CGContextScaleCTM(gc, 1.0f, -1.0f);
@ -219,7 +219,7 @@ void Fl_Copy_Surface::prepare_copy_pdf_and_tiff(int w, int h)
#endif // __APPLE__ #endif // __APPLE__
/** Copies a window and its borders and title bar to the clipboard. /** Copies a window and its borders and title bar to the clipboard.
\param win an FLTK window to copy \param win an FLTK window to copy
\param delta_x and \param delta_y give \param delta_x and \param delta_y give
the position in the clipboard of the top-left corner of the window's title bar the position in the clipboard of the top-left corner of the window's title bar
@ -234,6 +234,9 @@ void Fl_Copy_Surface::draw_decorated_window(Fl_Window* win, int delta_x, int del
#elif defined(FL_PORTING) #elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you need a helper class for your graphics driver" # pragma message "FL_PORTING: do you need a helper class for your graphics driver"
#elif !defined(FL_DOXYGEN) #elif !defined(FL_DOXYGEN)
#include "drivers/Xlib/Fl_Xlib_Graphics_Driver.h"
/* graphics driver that translates all graphics coordinates before calling Xlib */ /* graphics driver that translates all graphics coordinates before calling Xlib */
class Fl_translated_Xlib_Graphics_Driver_ : public Fl_Xlib_Graphics_Driver { class Fl_translated_Xlib_Graphics_Driver_ : public Fl_Xlib_Graphics_Driver {
int offset_x, offset_y; // translation between user and graphical coordinates: graphical = user + offset int offset_x, offset_y; // translation between user and graphical coordinates: graphical = user + offset
@ -273,65 +276,65 @@ public:
void yxline(int x, int y, int y1, int x2, int y3) { Fl_Xlib_Graphics_Driver::yxline(x+offset_x, y+offset_y, y1+offset_y, x2+offset_x, y3+offset_y); } void yxline(int x, int y, int y1, int x2, int y3) { Fl_Xlib_Graphics_Driver::yxline(x+offset_x, y+offset_y, y1+offset_y, x2+offset_x, y3+offset_y); }
void line(int x, int y, int x1, int y1) { Fl_Xlib_Graphics_Driver::line(x+offset_x, y+offset_y, x1+offset_x, y1+offset_y); } void line(int x, int y, int x1, int y1) { Fl_Xlib_Graphics_Driver::line(x+offset_x, y+offset_y, x1+offset_x, y1+offset_y); }
void line(int x, int y, int x1, int y1, int x2, int y2) { Fl_Xlib_Graphics_Driver::line(x+offset_x, y+offset_y, x1+offset_x, y1+offset_y, x2+offset_x, y2+offset_y); } void line(int x, int y, int x1, int y1, int x2, int y2) { Fl_Xlib_Graphics_Driver::line(x+offset_x, y+offset_y, x1+offset_x, y1+offset_y, x2+offset_x, y2+offset_y); }
void draw(const char* str, int n, int x, int y) { void draw(const char* str, int n, int x, int y) {
Fl_Xlib_Graphics_Driver::draw(str, n, x+offset_x, y+offset_y); Fl_Xlib_Graphics_Driver::draw(str, n, x+offset_x, y+offset_y);
} }
void draw(int angle, const char *str, int n, int x, int y) { void draw(int angle, const char *str, int n, int x, int y) {
Fl_Xlib_Graphics_Driver::draw(angle, str, n, x+offset_x, y+offset_y); Fl_Xlib_Graphics_Driver::draw(angle, str, n, x+offset_x, y+offset_y);
} }
void rtl_draw(const char* str, int n, int x, int y) { void rtl_draw(const char* str, int n, int x, int y) {
Fl_Xlib_Graphics_Driver::rtl_draw(str, n, x+offset_x, y+offset_y); Fl_Xlib_Graphics_Driver::rtl_draw(str, n, x+offset_x, y+offset_y);
} }
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) { void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
XP += offset_x; YP += offset_y; XP += offset_x; YP += offset_y;
translate_all(-offset_x, -offset_y); translate_all(-offset_x, -offset_y);
Fl_Xlib_Graphics_Driver::draw(pxm, XP, YP, WP,HP,cx,cy); Fl_Xlib_Graphics_Driver::draw(pxm, XP, YP, WP,HP,cx,cy);
untranslate_all(); untranslate_all();
} }
void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) { void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
XP += offset_x; YP += offset_y; XP += offset_x; YP += offset_y;
translate_all(-offset_x, -offset_y); translate_all(-offset_x, -offset_y);
Fl_Xlib_Graphics_Driver::draw(bm, XP, YP, WP,HP,cx,cy); Fl_Xlib_Graphics_Driver::draw(bm, XP, YP, WP,HP,cx,cy);
untranslate_all(); untranslate_all();
} }
void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy) { void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy) {
XP += offset_x; YP += offset_y; XP += offset_x; YP += offset_y;
translate_all(-offset_x, -offset_y); translate_all(-offset_x, -offset_y);
Fl_Xlib_Graphics_Driver::draw(img, XP, YP, WP,HP,cx,cy); Fl_Xlib_Graphics_Driver::draw(img, XP, YP, WP,HP,cx,cy);
untranslate_all(); untranslate_all();
} }
void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) { void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) {
X += offset_x; Y += offset_y; X += offset_x; Y += offset_y;
translate_all(-offset_x, -offset_y); translate_all(-offset_x, -offset_y);
Fl_Xlib_Graphics_Driver::draw_image(buf, X, Y, W,H,D,L); Fl_Xlib_Graphics_Driver::draw_image(buf, X, Y, W,H,D,L);
untranslate_all(); untranslate_all();
} }
void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) { void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) {
X += offset_x; Y += offset_y; X += offset_x; Y += offset_y;
translate_all(-offset_x, -offset_y); translate_all(-offset_x, -offset_y);
Fl_Xlib_Graphics_Driver::draw_image(cb, data, X, Y, W,H,D); Fl_Xlib_Graphics_Driver::draw_image(cb, data, X, Y, W,H,D);
untranslate_all(); untranslate_all();
} }
void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) { void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) {
X += offset_x; Y += offset_y; X += offset_x; Y += offset_y;
translate_all(-offset_x, -offset_y); translate_all(-offset_x, -offset_y);
Fl_Xlib_Graphics_Driver::draw_image_mono(buf, X, Y, W,H,D,L); Fl_Xlib_Graphics_Driver::draw_image_mono(buf, X, Y, W,H,D,L);
untranslate_all(); untranslate_all();
} }
void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) { void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) {
X += offset_x; Y += offset_y; X += offset_x; Y += offset_y;
translate_all(-offset_x, -offset_y); translate_all(-offset_x, -offset_y);
Fl_Xlib_Graphics_Driver::draw_image_mono(cb, data, X, Y, W,H,D); Fl_Xlib_Graphics_Driver::draw_image_mono(cb, data, X, Y, W,H,D);
untranslate_all(); untranslate_all();
} }
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
Fl_Xlib_Graphics_Driver::copy_offscreen(x+offset_x, y+offset_y, w, h,pixmap,srcx,srcy); Fl_Xlib_Graphics_Driver::copy_offscreen(x+offset_x, y+offset_y, w, h,pixmap,srcx,srcy);
} }
void push_clip(int x, int y, int w, int h) { void push_clip(int x, int y, int w, int h) {
Fl_Xlib_Graphics_Driver::push_clip(x+offset_x, y+offset_y, w, h); Fl_Xlib_Graphics_Driver::push_clip(x+offset_x, y+offset_y, w, h);
} }
int not_clipped(int x, int y, int w, int h) { return Fl_Xlib_Graphics_Driver::not_clipped(x + offset_x, y + offset_y, w, h); }; int not_clipped(int x, int y, int w, int h) { return Fl_Xlib_Graphics_Driver::not_clipped(x + offset_x, y + offset_y, w, h); };
int clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H) { int clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H) {
int retval = Fl_Xlib_Graphics_Driver::clip_box(x + offset_x, y + offset_y, w,h,X,Y,W,H); int retval = Fl_Xlib_Graphics_Driver::clip_box(x + offset_x, y + offset_y, w,h,X,Y,W,H);
X -= offset_x; X -= offset_x;
Y -= offset_y; Y -= offset_y;
@ -352,11 +355,11 @@ public:
const char *Fl_translated_Xlib_Graphics_Driver_::class_id = "Fl_translated_Xlib_Graphics_Driver_"; const char *Fl_translated_Xlib_Graphics_Driver_::class_id = "Fl_translated_Xlib_Graphics_Driver_";
void Fl_Xlib_Surface_::translate(int x, int y) { void Fl_Xlib_Surface_::translate(int x, int y) {
((Fl_translated_Xlib_Graphics_Driver_*)driver())->translate_all(x, y); ((Fl_translated_Xlib_Graphics_Driver_*)driver())->translate_all(x, y);
} }
void Fl_Xlib_Surface_::untranslate() { void Fl_Xlib_Surface_::untranslate() {
((Fl_translated_Xlib_Graphics_Driver_*)driver())->untranslate_all(); ((Fl_translated_Xlib_Graphics_Driver_*)driver())->untranslate_all();
} }
Fl_Xlib_Surface_::Fl_Xlib_Surface_() : Fl_Paged_Device() { Fl_Xlib_Surface_::Fl_Xlib_Surface_() : Fl_Paged_Device() {

View File

@ -60,18 +60,18 @@ static int can_xdbe() {
#endif #endif
Fl_Double_Window::Fl_Double_Window(int W, int H, const char *l) Fl_Double_Window::Fl_Double_Window(int W, int H, const char *l)
: Fl_Window(W,H,l), : Fl_Window(W,H,l),
force_doublebuffering_(0) force_doublebuffering_(0)
{ {
type(FL_DOUBLE_WINDOW); type(FL_DOUBLE_WINDOW);
} }
Fl_Double_Window::Fl_Double_Window(int X, int Y, int W, int H, const char *l) Fl_Double_Window::Fl_Double_Window(int X, int Y, int W, int H, const char *l)
: Fl_Window(X,Y,W,H,l), : Fl_Window(X,Y,W,H,l),
force_doublebuffering_(0) force_doublebuffering_(0)
{ {
type(FL_DOUBLE_WINDOW); type(FL_DOUBLE_WINDOW);
} }
@ -107,6 +107,8 @@ void Fl_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen
#if defined(USE_X11) #if defined(USE_X11)
#include "drivers/Xlib/Fl_Xlib_Graphics_Driver.h"
#if HAVE_XRENDER #if HAVE_XRENDER
#include <X11/extensions/Xrender.h> #include <X11/extensions/Xrender.h>
#endif #endif
@ -248,7 +250,7 @@ char fl_can_do_alpha_blending() {
@{ @{
*/ */
/** /**
Creation of an offscreen graphics buffer. Creation of an offscreen graphics buffer.
\param w,h width and height in pixels of the buffer. \param w,h width and height in pixels of the buffer.
\return the created graphics buffer. \return the created graphics buffer.
@ -312,12 +314,12 @@ static Fl_Surface_Device *_ss;
\param ctx the offscreen buffer. \param ctx the offscreen buffer.
*/ */
void fl_begin_offscreen(Fl_Offscreen ctx) { void fl_begin_offscreen(Fl_Offscreen ctx) {
_ss = Fl_Surface_Device::surface(); _ss = Fl_Surface_Device::surface();
Fl_Display_Device::display_device()->set_current(); Fl_Display_Device::display_device()->set_current();
if (stack_ix<stack_max) { if (stack_ix<stack_max) {
stack_gc[stack_ix] = fl_gc; stack_gc[stack_ix] = fl_gc;
stack_window[stack_ix] = fl_window; stack_window[stack_ix] = fl_window;
} else } else
fprintf(stderr, "FLTK CGContext Stack overflow error\n"); fprintf(stderr, "FLTK CGContext Stack overflow error\n");
stack_ix++; stack_ix++;
@ -433,7 +435,7 @@ void Fl_Double_Window::flush(int eraseoverlay) {
#elif defined(__APPLE__) #elif defined(__APPLE__)
if ( myi->other_xid ) { if ( myi->other_xid ) {
fl_begin_offscreen( myi->other_xid ); fl_begin_offscreen( myi->other_xid );
fl_clip_region( 0 ); fl_clip_region( 0 );
draw(); draw();
fl_end_offscreen(); fl_end_offscreen();
} else { } else {
@ -498,23 +500,23 @@ Fl_Double_Window::~Fl_Double_Window() {
Fl_Overlay_Window::Fl_Overlay_Window(int W, int H, const char *l) Fl_Overlay_Window::Fl_Overlay_Window(int W, int H, const char *l)
: Fl_Double_Window(W,H,l) : Fl_Double_Window(W,H,l)
{ {
overlay_ = 0; overlay_ = 0;
force_doublebuffering_=1; force_doublebuffering_=1;
image(0); image(0);
}
Fl_Overlay_Window::Fl_Overlay_Window(int X, int Y, int W, int H, const char *l)
: Fl_Double_Window(X,Y,W,H,l)
{
overlay_ = 0;
force_doublebuffering_=1;
image(0);
} }
Fl_Overlay_Window::Fl_Overlay_Window(int X, int Y, int W, int H, const char *l)
: Fl_Double_Window(X,Y,W,H,l)
{
overlay_ = 0;
force_doublebuffering_=1;
image(0);
}
// //
// End of "$Id$". // End of "$Id$".
// //

View File

@ -16,12 +16,8 @@
// http://www.fltk.org/str.php // http://www.fltk.org/str.php
// //
#ifndef FL_CFG_GFX_XLIB_ARCI_CXX #include "Fl_Xlib_Graphics_Driver.h"
#define FL_CFG_GFX_XLIB_ARCI_CXX
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <config.h>
#include "../../config_lib.h"
/** /**
\file xlib_arci.cxx \file xlib_arci.cxx
@ -39,8 +35,6 @@ void Fl_Xlib_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
XFillArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64)); XFillArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
} }
#endif // FL_CFG_GFX_XLIB_ARCI_CXX
// //
// End of "$Id$". // End of "$Id$".
// //

View File

@ -31,6 +31,7 @@
// being used to index arrays. So I always copy them to an integer // being used to index arrays. So I always copy them to an integer
// before use. // before use.
#include "Fl_Xlib_Graphics_Driver.h"
# include "../../Fl_XColor.H" # include "../../Fl_XColor.H"
# include <FL/Fl.H> # include <FL/Fl.H>
# include <FL/x.H> # include <FL/x.H>
@ -218,7 +219,7 @@ ulong fl_xpixel(Fl_Color i) {
xmap.r = realcolor(r, fl_redmask); xmap.r = realcolor(r, fl_redmask);
xmap.g = realcolor(g, fl_greenmask); xmap.g = realcolor(g, fl_greenmask);
xmap.b = realcolor(b, fl_bluemask); xmap.b = realcolor(b, fl_bluemask);
return xmap.pixel = return xmap.pixel =
(((r&fl_redmask) << fl_redshift)+ (((r&fl_redmask) << fl_redshift)+
((g&fl_greenmask)<<fl_greenshift)+ ((g&fl_greenmask)<<fl_greenshift)+
((b&fl_bluemask)<< fl_blueshift) ((b&fl_bluemask)<< fl_blueshift)

View File

@ -18,6 +18,7 @@
// Select fonts from the FLTK font table. // Select fonts from the FLTK font table.
#include "../../flstring.h" #include "../../flstring.h"
#include "Fl_Xlib_Graphics_Driver.h"
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <FL/x.H> #include <FL/x.H>
@ -836,7 +837,7 @@ void Fl_Xlib_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &d
// If this code fails to load the requested font, it falls back through a // If this code fails to load the requested font, it falls back through a
// series of tried 'n tested alternatives, ultimately resorting to what the // series of tried 'n tested alternatives, ultimately resorting to what the
// original fltk code did. // original fltk code did.
// NOTE: On my test boxes (FC6, FC7, FC8, ubuntu8.04, 9.04, 9.10) this works // NOTE: On my test boxes (FC6, FC7, FC8, ubuntu8.04, 9.04, 9.10) this works
// well for the fltk "built-in" font names. // well for the fltk "built-in" font names.
static XFontStruct* load_xfont_for_xft2(Fl_Graphics_Driver *driver) { static XFontStruct* load_xfont_for_xft2(Fl_Graphics_Driver *driver) {
XFontStruct* xgl_font = 0; XFontStruct* xgl_font = 0;
@ -883,9 +884,9 @@ static XFontStruct* load_xfont_for_xft2(Fl_Graphics_Driver *driver) {
} }
snprintf(xlfd, 128, "-*-*%s*-%s-%c-*--*-%d-*-*-*-*-*-*", name, weight, slant, (size*10)); snprintf(xlfd, 128, "-*-*%s*-%s-%c-*--*-%d-*-*-*-*-*-*", name, weight, slant, (size*10));
xgl_font = XLoadQueryFont(fl_display, xlfd); xgl_font = XLoadQueryFont(fl_display, xlfd);
} }
free(pc); // release our copy of the font name free(pc); // release our copy of the font name
// if we have nothing loaded, try a generic proportional font // if we have nothing loaded, try a generic proportional font
if(!xgl_font) { if(!xgl_font) {
snprintf(xlfd, 128, "-*-helvetica-*-%c-*--*-%d-*-*-*-*-*-*", slant, (size*10)); snprintf(xlfd, 128, "-*-helvetica-*-%c-*--*-%d-*-*-*-*-*-*", slant, (size*10));
@ -999,7 +1000,7 @@ void Fl_Xlib_Graphics_Driver::draw(const char *str, int n, int x, int y) {
color.color.green = ((int)g)*0x101; color.color.green = ((int)g)*0x101;
color.color.blue = ((int)b)*0x101; color.color.blue = ((int)b)*0x101;
color.color.alpha = 0xffff; color.color.alpha = 0xffff;
const wchar_t *buffer = utf8reformat(str, n); const wchar_t *buffer = utf8reformat(str, n);
#ifdef __CYGWIN__ #ifdef __CYGWIN__
XftDrawString16(draw_, &color, font_descriptor()->font, x, y, (XftChar16 *)buffer, n); XftDrawString16(draw_, &color, font_descriptor()->font, x, y, (XftChar16 *)buffer, n);

View File

@ -45,11 +45,13 @@
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
#include "Fl_Xlib_Graphics_Driver.h"
# include <FL/Fl.H> # include <FL/Fl.H>
# include <FL/fl_draw.H> # include <FL/fl_draw.H>
# include <FL/x.H> # include <FL/x.H>
# include "../../Fl_XColor.H" # include "../../Fl_XColor.H"
# include "../../flstring.h" # include "../../flstring.h"
#include <X11/Xregion.h>
static XImage xi; // template used to pass info to X static XImage xi; // template used to pass info to X
static int bytes_per_pixel; static int bytes_per_pixel;
@ -693,9 +695,9 @@ static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, i
*dstptr++ = (srcb * srca + dstb * dsta) >> 8; *dstptr++ = (srcb * srca + dstb * dsta) >> 8;
} }
} }
fl_draw_image(dst, X, Y, W, H, 3, 0); fl_draw_image(dst, X, Y, W, H, 3, 0);
delete[] dst; delete[] dst;
} }
@ -814,16 +816,18 @@ void Fl_Xlib_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int H
else copy_offscreen(X, Y, W, H, pxm->id_, cx, cy); else copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
} }
extern uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here
fl_uintptr_t Fl_Xlib_Graphics_Driver::cache(Fl_Pixmap *img, int w, int h, const char *const*data) { fl_uintptr_t Fl_Xlib_Graphics_Driver::cache(Fl_Pixmap *img, int w, int h, const char *const*data) {
Fl_Offscreen id; Fl_Offscreen id;
id = fl_create_offscreen(w(), h()); id = fl_create_offscreen(w, h);
fl_begin_offscreen(id); fl_begin_offscreen(id);
uchar *bitmap = 0; uchar *bitmap = 0;
fl_mask_bitmap = &bitmap; fl_mask_bitmap = &bitmap;
fl_draw_pixmap(data(), 0, 0, FL_BLACK); fl_draw_pixmap(data, 0, 0, FL_BLACK);
fl_mask_bitmap = 0; fl_mask_bitmap = 0;
if (bitmap) { if (bitmap) {
img->mask_ = (fl_uintptr_t)fl_create_bitmask(w(), h(), bitmap); img->mask_ = (fl_uintptr_t)fl_create_bitmask(w, h, bitmap);
delete[] bitmap; delete[] bitmap;
} }
fl_end_offscreen(); fl_end_offscreen();