Remove Fl_Pixmap::prepare() and Fl_Bitmap::prepare() that were used only once.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12834 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
2abe8bd413
commit
bfac5462be
@ -40,8 +40,6 @@ public:
|
||||
int alloc_array;
|
||||
|
||||
private:
|
||||
int prepare(int XP, int YP, int WP, int HP, int &cx, int &cy,
|
||||
int &X, int &Y, int &W, int &H);
|
||||
/** for internal use */
|
||||
fl_uintptr_t id_;
|
||||
int cache_w_, cache_h_; // size of bitmap when cached
|
||||
|
@ -248,17 +248,7 @@ protected:
|
||||
static Fl_Color* pixmap_bg_color(Fl_Pixmap *pm) {return &(pm->pixmap_bg_color);}
|
||||
/** For internal library use only */
|
||||
static void draw_empty(Fl_Image* img, int X, int Y) {img->draw_empty(X, Y);}
|
||||
/** Accessor to a private member function of Fl_Bitmap */
|
||||
static int prepare(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int &cx, int &cy,
|
||||
int &X, int &Y, int &W, int &H) {
|
||||
return bm->prepare(XP,YP,WP,HP,cx,cy,X,Y,W,H);
|
||||
}
|
||||
/** Accessor to a private member function of Fl_Pixmap */
|
||||
static int prepare(Fl_Pixmap *pm, int XP, int YP, int WP, int HP, int &cx, int &cy,
|
||||
int &X, int &Y, int &W, int &H) {
|
||||
return pm->prepare(XP,YP,WP,HP,cx,cy,X,Y,W,H);
|
||||
}
|
||||
|
||||
|
||||
Fl_Graphics_Driver();
|
||||
void cache_size(Fl_Image *img, int &width, int &height);
|
||||
public:
|
||||
|
@ -40,8 +40,6 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
|
||||
void copy_data();
|
||||
void delete_data();
|
||||
void set_data(const char * const *p);
|
||||
int prepare(int XP, int YP, int WP, int HP, int &cx, int &cy,
|
||||
int &X, int &Y, int &W, int &H);
|
||||
|
||||
protected:
|
||||
void measure();
|
||||
|
@ -116,19 +116,6 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
fl_graphics_driver->draw_bitmap(this, XP, YP, WP, HP, cx, cy);
|
||||
}
|
||||
|
||||
int Fl_Bitmap::prepare(int XP, int YP, int WP, int HP, int &cx, int &cy,
|
||||
int &X, int &Y, int &W, int &H)
|
||||
{
|
||||
if (!array) {
|
||||
draw_empty(XP, YP);
|
||||
return 1;
|
||||
}
|
||||
if (fl_graphics_driver->start_image(this, XP,YP,WP,HP,cx,cy,X,Y,W,H)) return 1;
|
||||
if (!id_)
|
||||
fl_graphics_driver->cache(this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
The destructor frees all memory and server resources that are used by
|
||||
the bitmap.
|
||||
|
@ -50,25 +50,6 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
fl_graphics_driver->draw_pixmap(this, XP, YP, WP, HP, cx, cy);
|
||||
}
|
||||
|
||||
|
||||
int Fl_Pixmap::prepare(int XP, int YP, int WP, int HP, int &cx, int &cy,
|
||||
int &X, int &Y, int &W, int &H) {
|
||||
if (w() < 0) measure();
|
||||
if (!data() || !w()) {
|
||||
draw_empty(XP, YP);
|
||||
return 1;
|
||||
}
|
||||
if (WP == -1) {
|
||||
WP = w();
|
||||
HP = h();
|
||||
}
|
||||
if ( fl_graphics_driver->start_image(this, XP,YP,WP,HP,cx,cy,X,Y,W,H) ) return 1;
|
||||
if (!id_) {
|
||||
fl_graphics_driver->cache(this);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
The destructor frees all memory and server resources that are used by
|
||||
the pixmap.
|
||||
|
@ -134,9 +134,14 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::draw_bitmap(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
int X, Y, W, H;
|
||||
if (Fl_Graphics_Driver::prepare(bm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
|
||||
if (!bm->array) {
|
||||
draw_empty(bm, XP, YP);
|
||||
return;
|
||||
}
|
||||
if (start_image(bm, XP,YP,WP,HP,cx,cy,X,Y,W,H)) return;
|
||||
if (!*id(bm))
|
||||
cache(bm);
|
||||
|
||||
if (*Fl_Graphics_Driver::id(bm) && gc_) {
|
||||
draw_CGImage((CGImageRef)*Fl_Graphics_Driver::id(bm), X,Y,W,H, cx, cy, bm->w(), bm->h());
|
||||
}
|
||||
@ -199,7 +204,15 @@ void Fl_Quartz_Graphics_Driver::draw_rgb(Fl_RGB_Image *img, int XP, int YP, int
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
int X, Y, W, H;
|
||||
if (Fl_Graphics_Driver::prepare(pxm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
|
||||
if (!pxm->data() || !pxm->w()) {
|
||||
draw_empty(pxm, XP, YP);
|
||||
return;
|
||||
}
|
||||
if ( start_image(pxm, XP,YP,WP,HP,cx,cy,X,Y,W,H) ) return;
|
||||
if (!*id(pxm)) {
|
||||
cache(pxm);
|
||||
}
|
||||
|
||||
CGImageRef cgimg = (CGImageRef)*Fl_Graphics_Driver::id(pxm);
|
||||
draw_CGImage(cgimg, X,Y,W,H, cx,cy, pxm->w(), pxm->h());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user