Renamed internal member variables id and mask to id_ and mask_ to avoid
conflict with Mac OS X/gcc 3.x name clash when compiling with obj-c. Also made them private instead of public. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7273 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
99e9c68215
commit
186a8f0ff1
@ -46,19 +46,25 @@ class FL_EXPORT Fl_Bitmap : public Fl_Image {
|
||||
const uchar *array;
|
||||
/** Non-zero if array points to bitmap data allocated internally */
|
||||
int alloc_array;
|
||||
|
||||
private:
|
||||
|
||||
#if defined(__APPLE__) || defined(WIN32)
|
||||
/** for internal use */
|
||||
void *id;
|
||||
void *id_;
|
||||
#else
|
||||
/** for internal use */
|
||||
unsigned id;
|
||||
unsigned id_;
|
||||
#endif // __APPLE__ || WIN32
|
||||
|
||||
public:
|
||||
|
||||
/** The constructors create a new bitmap from the specified bitmap data */
|
||||
Fl_Bitmap(const uchar *bits, int W, int H) :
|
||||
Fl_Image(W,H,0), array(bits), alloc_array(0), id(0) {data((const char **)&array, 1);}
|
||||
Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0) {data((const char **)&array, 1);}
|
||||
/** The constructors create a new bitmap from the specified bitmap data */
|
||||
Fl_Bitmap(const char *bits, int W, int H) :
|
||||
Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id(0) {data((const char **)&array, 1);}
|
||||
Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0) {data((const char **)&array, 1);}
|
||||
virtual ~Fl_Bitmap();
|
||||
virtual Fl_Image *copy(int W, int H);
|
||||
Fl_Image *copy() { return copy(w(), h()); }
|
||||
|
@ -193,16 +193,21 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
|
||||
const uchar *array;
|
||||
int alloc_array; // Non-zero if array was allocated
|
||||
|
||||
private:
|
||||
|
||||
#if defined(__APPLE__) || defined(WIN32)
|
||||
void *id; // for internal use
|
||||
void *mask; // for internal use (mask bitmap)
|
||||
void *id_; // for internal use
|
||||
void *mask_; // for internal use (mask bitmap)
|
||||
#else
|
||||
unsigned id; // for internal use
|
||||
unsigned mask; // for internal use (mask bitmap)
|
||||
unsigned id_; // for internal use
|
||||
unsigned mask_; // for internal use (mask bitmap)
|
||||
#endif // __APPLE__ || WIN32
|
||||
|
||||
public:
|
||||
|
||||
/** The constructor creates a new image from the specified data. */
|
||||
Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
|
||||
Fl_Image(W,H,D), array(bits), alloc_array(0), id(0), mask(0) {data((const char **)&array, 1); ld(LD);}
|
||||
Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);}
|
||||
virtual ~Fl_RGB_Image();
|
||||
virtual Fl_Image *copy(int W, int H);
|
||||
Fl_Image *copy() { return copy(w(), h()); }
|
||||
|
@ -56,22 +56,27 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
|
||||
public:
|
||||
|
||||
int alloc_data; // Non-zero if data was allocated
|
||||
|
||||
private:
|
||||
|
||||
#if defined(__APPLE__) || defined(WIN32)
|
||||
void *id; // for internal use
|
||||
void *mask; // for internal use (mask bitmap)
|
||||
void *id_; // for internal use
|
||||
void *mask_; // for internal use (mask bitmap)
|
||||
#else
|
||||
unsigned id; // for internal use
|
||||
unsigned mask; // for internal use (mask bitmap)
|
||||
unsigned id_; // for internal use
|
||||
unsigned mask_; // for internal use (mask bitmap)
|
||||
#endif // __APPLE__ || WIN32
|
||||
|
||||
public:
|
||||
|
||||
/** The constructors create a new pixmap from the specified XPM data. */
|
||||
explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
|
||||
explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
|
||||
/** The constructors create a new pixmap from the specified XPM data. */
|
||||
explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
|
||||
explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
|
||||
/** The constructors create a new pixmap from the specified XPM data. */
|
||||
explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
|
||||
explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
|
||||
/** The constructors create a new pixmap from the specified XPM data. */
|
||||
explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
|
||||
explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();}
|
||||
virtual ~Fl_Pixmap();
|
||||
virtual Fl_Image *copy(int W, int H);
|
||||
Fl_Image *copy() { return copy(w(), h()); }
|
||||
|
@ -52,12 +52,12 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
|
||||
*dst++ = ((reverse[*src & 0x0f] & 0xf0) | (reverse[(*src >> 4) & 0x0f] & 0x0f))^0xff;
|
||||
}
|
||||
CGDataProviderRef srcp = CGDataProviderCreateWithData( 0L, bmask, rowBytes*h, 0L);
|
||||
CGImageRef id = CGImageMaskCreate( w, h, 1, 1, rowBytes, srcp, 0L, false);
|
||||
CGImageRef id_ = CGImageMaskCreate( w, h, 1, 1, rowBytes, srcp, 0L, false);
|
||||
CGDataProviderRelease(srcp);
|
||||
return (Fl_Bitmask)id;
|
||||
return (Fl_Bitmask)id_;
|
||||
}
|
||||
void fl_delete_bitmask(Fl_Bitmask id) {
|
||||
if (id) CGImageRelease((CGImageRef)id);
|
||||
void fl_delete_bitmask(Fl_Bitmask bm) {
|
||||
if (bm) CGImageRelease((CGImageRef)bm);
|
||||
}
|
||||
#elif defined(WIN32) // Windows bitmask functions...
|
||||
// 'fl_create_bitmap()' - Create a 1-bit bitmap for drawing...
|
||||
@ -69,7 +69,7 @@ static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) {
|
||||
uchar* newarray = new uchar[w2*h];
|
||||
const uchar* src = data;
|
||||
uchar* dest = newarray;
|
||||
Fl_Bitmask id;
|
||||
Fl_Bitmask bm;
|
||||
static uchar reverse[16] = /* Bit reversal lookup table */
|
||||
{ 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
|
||||
0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
|
||||
@ -81,18 +81,18 @@ static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) {
|
||||
dest += w2-w1;
|
||||
}
|
||||
|
||||
id = CreateBitmap(w, h, 1, 1, newarray);
|
||||
bm = CreateBitmap(w, h, 1, 1, newarray);
|
||||
|
||||
delete[] newarray;
|
||||
|
||||
return id;
|
||||
return bm;
|
||||
}
|
||||
|
||||
// 'fl_create_bitmask()' - Create an N-bit bitmap for masking...
|
||||
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data) {
|
||||
// this won't work when the user changes display mode during run or
|
||||
// has two screens with differnet depths
|
||||
Fl_Bitmask id;
|
||||
Fl_Bitmask bm;
|
||||
static uchar hiNibble[16] =
|
||||
{ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
|
||||
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 };
|
||||
@ -141,10 +141,10 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data) {
|
||||
dst += pad;
|
||||
}
|
||||
|
||||
id = CreateBitmap(w, h, np, bpp, newarray);
|
||||
bm = CreateBitmap(w, h, np, bpp, newarray);
|
||||
delete[] newarray;
|
||||
|
||||
return id;
|
||||
return bm;
|
||||
}
|
||||
|
||||
#if 0 // This doesn't appear to be used anywhere...
|
||||
@ -156,7 +156,7 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data, int for_mask) {
|
||||
uchar* newarray = new uchar[w2*h];
|
||||
const uchar* src = data;
|
||||
uchar* dest = newarray;
|
||||
Fl_Bitmask id;
|
||||
Fl_Bitmask bm;
|
||||
static uchar reverse[16] = /* Bit reversal lookup table */
|
||||
{ 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
|
||||
0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
|
||||
@ -168,11 +168,11 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data, int for_mask) {
|
||||
dest += w2-w1;
|
||||
}
|
||||
|
||||
id = CreateBitmap(w, h, 1, 1, newarray);
|
||||
bm = CreateBitmap(w, h, 1, 1, newarray);
|
||||
|
||||
delete[] newarray;
|
||||
|
||||
return (id);
|
||||
return bm;
|
||||
}
|
||||
# endif // 0
|
||||
|
||||
@ -193,7 +193,7 @@ void fl_delete_bitmask(Fl_Bitmask bm) {
|
||||
|
||||
// Create a 1-bit mask used for alpha blending
|
||||
Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array) {
|
||||
Fl_Bitmask mask;
|
||||
Fl_Bitmask bm;
|
||||
int bmw = (w + 7) / 8;
|
||||
uchar *bitmap = new uchar[bmw * h];
|
||||
uchar *bitptr, bit;
|
||||
@ -258,10 +258,10 @@ Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array)
|
||||
}
|
||||
}
|
||||
|
||||
mask = fl_create_bitmask(w, h, bitmap);
|
||||
bm = fl_create_bitmask(w, h, bitmap);
|
||||
delete[] bitmap;
|
||||
|
||||
return (mask);
|
||||
return (bm);
|
||||
}
|
||||
|
||||
void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
@ -286,9 +286,9 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
if (H <= 0) return;
|
||||
|
||||
#if defined(USE_X11)
|
||||
if (!id) id = fl_create_bitmask(w(), h(), array);
|
||||
if (!id_) id_ = fl_create_bitmask(w(), h(), array);
|
||||
|
||||
XSetStipple(fl_display, fl_gc, id);
|
||||
XSetStipple(fl_display, fl_gc, id_);
|
||||
int ox = X-cx; if (ox < 0) ox += w();
|
||||
int oy = Y-cy; if (oy < 0) oy += h();
|
||||
XSetTSOrigin(fl_display, fl_gc, ox, oy);
|
||||
@ -296,7 +296,7 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
XFillRectangle(fl_display, fl_window, fl_gc, X, Y, W, H);
|
||||
XSetFillStyle(fl_display, fl_gc, FillSolid);
|
||||
#elif defined(WIN32)
|
||||
if (!id) id = fl_create_bitmap(w(), h(), array);
|
||||
if (!id_) id_ = fl_create_bitmap(w(), h(), array);
|
||||
|
||||
typedef BOOL (WINAPI* fl_transp_func) (HDC,int,int,int,int,HDC,int,int,int,int,UINT);
|
||||
static fl_transp_func fl_TransparentBlt;
|
||||
@ -326,7 +326,7 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
fl_color(save_c); // back to bitmap's color
|
||||
tempdc = CreateCompatibleDC(fl_gc);
|
||||
save = SaveDC(tempdc);
|
||||
SelectObject(tempdc, (HGDIOBJ)id);
|
||||
SelectObject(tempdc, (HGDIOBJ)id_);
|
||||
SelectObject(fl_gc, fl_brush()); // use bitmap's desired color
|
||||
BitBlt(fl_gc, 0, 0, W, H, tempdc, 0, 0, 0xE20746L); // draw bitmap to offscreen
|
||||
fl_end_offscreen(); // offscreen data is in tmp_id
|
||||
@ -338,7 +338,7 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
else { // algorithm for bitmap output to display
|
||||
tempdc = CreateCompatibleDC(fl_gc);
|
||||
save = SaveDC(tempdc);
|
||||
SelectObject(tempdc, (HGDIOBJ)id);
|
||||
SelectObject(tempdc, (HGDIOBJ)id_);
|
||||
SelectObject(fl_gc, fl_brush());
|
||||
// secret bitblt code found in old MSWindows reference manual:
|
||||
BitBlt(fl_gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L);
|
||||
@ -346,11 +346,11 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
RestoreDC(tempdc, save);
|
||||
DeleteDC(tempdc);
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
if (!id) id = fl_create_bitmask(w(), h(), array);
|
||||
if (id && fl_gc) {
|
||||
if (!id_) id_ = fl_create_bitmask(w(), h(), array);
|
||||
if (id_ && fl_gc) {
|
||||
CGRect rect = { { X, Y }, { W, H } };
|
||||
Fl_X::q_begin_image(rect, cx, cy, w(), h());
|
||||
CGContextDrawImage(fl_gc, rect, (CGImageRef)id);
|
||||
CGContextDrawImage(fl_gc, rect, (CGImageRef)id_);
|
||||
Fl_X::q_end_image();
|
||||
}
|
||||
#else
|
||||
@ -368,13 +368,13 @@ Fl_Bitmap::~Fl_Bitmap() {
|
||||
}
|
||||
|
||||
void Fl_Bitmap::uncache() {
|
||||
if (id) {
|
||||
if (id_) {
|
||||
#if defined(__APPLE__) && defined(__APPLE_COCOA__)
|
||||
fl_delete_bitmask((Fl_Bitmask)id);
|
||||
fl_delete_bitmask((Fl_Bitmask)id_);
|
||||
#else
|
||||
fl_delete_bitmask((Fl_Offscreen)id);
|
||||
fl_delete_bitmask((Fl_Offscreen)id_);
|
||||
#endif
|
||||
id = 0;
|
||||
id_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,19 +181,19 @@ Fl_RGB_Image::~Fl_RGB_Image() {
|
||||
|
||||
void Fl_RGB_Image::uncache() {
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
if (id) {
|
||||
CGImageRelease((CGImageRef)id);
|
||||
id = 0;
|
||||
if (id_) {
|
||||
CGImageRelease((CGImageRef)id_);
|
||||
id_ = 0;
|
||||
}
|
||||
#else
|
||||
if (id) {
|
||||
fl_delete_offscreen((Fl_Offscreen)id);
|
||||
id = 0;
|
||||
if (id_) {
|
||||
fl_delete_offscreen((Fl_Offscreen)id_);
|
||||
id_ = 0;
|
||||
}
|
||||
|
||||
if (mask) {
|
||||
fl_delete_bitmask((Fl_Bitmask)mask);
|
||||
mask = 0;
|
||||
if (mask_) {
|
||||
fl_delete_bitmask((Fl_Bitmask)mask_);
|
||||
mask_ = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -455,7 +455,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
if (cy < 0) {H += cy; Y -= cy; cy = 0;}
|
||||
if (cy+H > h()) H = h()-cy;
|
||||
if (H <= 0) return;
|
||||
if (!id) {
|
||||
if (!id_) {
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
CGColorSpaceRef lut = 0;
|
||||
if (d()<=2)
|
||||
@ -463,29 +463,29 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
else
|
||||
lut = CGColorSpaceCreateDeviceRGB();
|
||||
CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, w()*h()*d(), 0L);
|
||||
id = CGImageCreate( w(), h(), 8, d()*8, ld()?ld():w()*d(),
|
||||
id_ = CGImageCreate( w(), h(), 8, d()*8, ld()?ld():w()*d(),
|
||||
lut, (d()&1)?kCGImageAlphaNone:kCGImageAlphaLast,
|
||||
src, 0L, false, kCGRenderingIntentDefault);
|
||||
CGColorSpaceRelease(lut);
|
||||
CGDataProviderRelease(src);
|
||||
#elif defined(WIN32)
|
||||
id = fl_create_offscreen(w(), h());
|
||||
id_ = fl_create_offscreen(w(), h());
|
||||
if ((d() == 2 || d() == 4) && fl_can_do_alpha_blending()) {
|
||||
fl_begin_offscreen((Fl_Offscreen)id);
|
||||
fl_begin_offscreen((Fl_Offscreen)id_);
|
||||
fl_draw_image(array, 0, 0, w(), h(), d()|FL_IMAGE_WITH_ALPHA, ld());
|
||||
fl_end_offscreen();
|
||||
} else {
|
||||
fl_begin_offscreen((Fl_Offscreen)id);
|
||||
fl_begin_offscreen((Fl_Offscreen)id_);
|
||||
fl_draw_image(array, 0, 0, w(), h(), d(), ld());
|
||||
fl_end_offscreen();
|
||||
if (d() == 2 || d() == 4) {
|
||||
mask = fl_create_alphamask(w(), h(), d(), ld(), array);
|
||||
mask_ = fl_create_alphamask(w(), h(), d(), ld(), array);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (d() == 1 || d() == 3) {
|
||||
id = fl_create_offscreen(w(), h());
|
||||
fl_begin_offscreen((Fl_Offscreen)id);
|
||||
id_ = fl_create_offscreen(w(), h());
|
||||
fl_begin_offscreen((Fl_Offscreen)id_);
|
||||
fl_draw_image(array, 0, 0, w(), h(), d(), ld());
|
||||
fl_end_offscreen();
|
||||
}
|
||||
@ -493,23 +493,23 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
}
|
||||
|
||||
#if defined(USE_X11)
|
||||
if (id) {
|
||||
if (mask) {
|
||||
if (id_) {
|
||||
if (mask_) {
|
||||
// I can't figure out how to combine a mask with existing region,
|
||||
// so cut the image down to a clipped rectangle:
|
||||
int nx, ny; fl_clip_box(X,Y,W,H,nx,ny,W,H);
|
||||
cx += nx-X; X = nx;
|
||||
cy += ny-Y; Y = ny;
|
||||
// make X use the bitmap as a mask:
|
||||
XSetClipMask(fl_display, fl_gc, mask);
|
||||
XSetClipMask(fl_display, fl_gc, mask_);
|
||||
int ox = X-cx; if (ox < 0) ox += w();
|
||||
int oy = Y-cy; if (oy < 0) oy += h();
|
||||
XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
|
||||
}
|
||||
|
||||
fl_copy_offscreen(X, Y, W, H, id, cx, cy);
|
||||
fl_copy_offscreen(X, Y, W, H, id_, cx, cy);
|
||||
|
||||
if (mask) {
|
||||
if (mask_) {
|
||||
// put the old clip region back
|
||||
XSetClipOrigin(fl_display, fl_gc, 0, 0);
|
||||
fl_restore_clip();
|
||||
@ -519,25 +519,25 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
alpha_blend(this, X, Y, W, H, cx, cy);
|
||||
}
|
||||
#elif defined(WIN32)
|
||||
if (mask) {
|
||||
if (mask_) {
|
||||
HDC new_gc = CreateCompatibleDC(fl_gc);
|
||||
int save = SaveDC(new_gc);
|
||||
SelectObject(new_gc, (void*)mask);
|
||||
SelectObject(new_gc, (void*)mask_);
|
||||
BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND);
|
||||
SelectObject(new_gc, (void*)id);
|
||||
SelectObject(new_gc, (void*)id_);
|
||||
BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
|
||||
RestoreDC(new_gc,save);
|
||||
DeleteDC(new_gc);
|
||||
} else if (d()==2 || d()==4) {
|
||||
fl_copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
|
||||
fl_copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)id_, cx, cy);
|
||||
} else {
|
||||
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
|
||||
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id_, cx, cy);
|
||||
}
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
if (id && fl_gc) {
|
||||
if (id_ && fl_gc) {
|
||||
CGRect rect = { { X, Y }, { W, H } };
|
||||
Fl_X::q_begin_image(rect, cx, cy, w(), h());
|
||||
CGContextDrawImage(fl_gc, rect, (CGImageRef)id);
|
||||
CGContextDrawImage(fl_gc, rect, (CGImageRef)id_);
|
||||
Fl_X::q_end_image();
|
||||
}
|
||||
#else
|
||||
|
@ -103,21 +103,21 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
if (cy < 0) {H += cy; Y -= cy; cy = 0;}
|
||||
if (cy+H > h()) H = h()-cy;
|
||||
if (H <= 0) return;
|
||||
if (!id) {
|
||||
if (!id_) {
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
id = fl_create_offscreen_with_alpha(w(), h());
|
||||
fl_begin_offscreen((Fl_Offscreen)id);
|
||||
id_ = fl_create_offscreen_with_alpha(w(), h());
|
||||
fl_begin_offscreen((Fl_Offscreen)id_);
|
||||
fl_draw_pixmap(data(), 0, 0, FL_GREEN);
|
||||
fl_end_offscreen();
|
||||
#else
|
||||
id = fl_create_offscreen(w(), h());
|
||||
fl_begin_offscreen((Fl_Offscreen)id);
|
||||
id_ = fl_create_offscreen(w(), h());
|
||||
fl_begin_offscreen((Fl_Offscreen)id_);
|
||||
uchar *bitmap = 0;
|
||||
fl_mask_bitmap = &bitmap;
|
||||
fl_draw_pixmap(data(), 0, 0, FL_BLACK);
|
||||
fl_mask_bitmap = 0;
|
||||
if (bitmap) {
|
||||
mask = fl_create_bitmask(w(), h(), bitmap);
|
||||
mask_ = fl_create_bitmask(w(), h(), bitmap);
|
||||
delete[] bitmap;
|
||||
}
|
||||
fl_end_offscreen();
|
||||
@ -125,20 +125,20 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
}
|
||||
|
||||
#if defined(USE_X11)
|
||||
if (mask) {
|
||||
if (mask_) {
|
||||
// I can't figure out how to combine a mask with existing region,
|
||||
// so cut the image down to a clipped rectangle:
|
||||
int nx, ny; fl_clip_box(X,Y,W,H,nx,ny,W,H);
|
||||
cx += nx-X; X = nx;
|
||||
cy += ny-Y; Y = ny;
|
||||
// make X use the bitmap as a mask:
|
||||
XSetClipMask(fl_display, fl_gc, mask);
|
||||
XSetClipMask(fl_display, fl_gc, mask_);
|
||||
int ox = X-cx; if (ox < 0) ox += w();
|
||||
int oy = Y-cy; if (oy < 0) oy += h();
|
||||
XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
|
||||
}
|
||||
fl_copy_offscreen(X, Y, W, H, id, cx, cy);
|
||||
if (mask) {
|
||||
fl_copy_offscreen(X, Y, W, H, id_, cx, cy);
|
||||
if (mask_) {
|
||||
// put the old clip region back
|
||||
XSetClipOrigin(fl_display, fl_gc, 0, 0);
|
||||
fl_restore_clip();
|
||||
@ -188,23 +188,23 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
fl_delete_offscreen(tmp_id);
|
||||
}
|
||||
else {
|
||||
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
|
||||
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id_, cx, cy);
|
||||
}
|
||||
}
|
||||
else if (mask) {
|
||||
else if (mask_) {
|
||||
HDC new_gc = CreateCompatibleDC(fl_gc);
|
||||
int save = SaveDC(new_gc);
|
||||
SelectObject(new_gc, (void*)mask);
|
||||
SelectObject(new_gc, (void*)mask_);
|
||||
BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND);
|
||||
SelectObject(new_gc, (void*)id);
|
||||
SelectObject(new_gc, (void*)id_);
|
||||
BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
|
||||
RestoreDC(new_gc,save);
|
||||
DeleteDC(new_gc);
|
||||
} else {
|
||||
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
|
||||
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id_, cx, cy);
|
||||
}
|
||||
#elif defined(__APPLE_QUARTZ__)
|
||||
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
|
||||
fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id_, cx, cy);
|
||||
#else
|
||||
# error unsupported platform
|
||||
#endif
|
||||
@ -220,14 +220,14 @@ Fl_Pixmap::~Fl_Pixmap() {
|
||||
}
|
||||
|
||||
void Fl_Pixmap::uncache() {
|
||||
if (id) {
|
||||
fl_delete_offscreen((Fl_Offscreen)id);
|
||||
id = 0;
|
||||
if (id_) {
|
||||
fl_delete_offscreen((Fl_Offscreen)id_);
|
||||
id_ = 0;
|
||||
}
|
||||
|
||||
if (mask) {
|
||||
fl_delete_bitmask((Fl_Bitmask)mask);
|
||||
mask = 0;
|
||||
if (mask_) {
|
||||
fl_delete_bitmask((Fl_Bitmask)mask_);
|
||||
mask_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user