summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-11-02 21:08:15 +0000
committerManolo Gouy <Manolo>2016-11-02 21:08:15 +0000
commitd3f1a3c167954a4c874162ed4986a2235109ac33 (patch)
treebfa8483e0ddf24ca20678e6a9eae80cc879e6c33 /src/drivers
parent5c2a7d9fed465403758edda57acc59a4879cae56 (diff)
Replace declarations such as "friend class Fl_Xlib_Graphics_Driver;" by platform-independent declarations.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12076 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx51
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx24
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx38
3 files changed, 57 insertions, 56 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
index 0e2740bcf..01ce91b59 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx
@@ -401,13 +401,13 @@ void Fl_GDI_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) {
void Fl_GDI_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
+ if (Fl_Graphics_Driver::start(bm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
return;
}
HDC tempdc = CreateCompatibleDC(gc_);
int save = SaveDC(tempdc);
- SelectObject(tempdc, (HGDIOBJ)bm->id_);
+ SelectObject(tempdc, (HGDIOBJ)*Fl_Graphics_Driver::id(bm));
SelectObject(gc_, fl_brush());
// secret bitblt code found in old MSWindows reference manual:
BitBlt(gc_, X, Y, W, H, tempdc, cx, cy, 0xE20746L);
@@ -429,7 +429,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP,
Fl_GDI_Graphics_Driver::draw(bm, XP, YP, WP, HP, cx, cy);
return;
}
- if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
+ if (Fl_Graphics_Driver::start(bm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
return;
}
@@ -451,7 +451,7 @@ void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP,
HDC off_gc = (HDC)fl_graphics_driver->gc();
tempdc = CreateCompatibleDC(off_gc);
save = SaveDC(tempdc);
- SelectObject(tempdc, (HGDIOBJ)bm->id_);
+ SelectObject(tempdc, (HGDIOBJ)*Fl_Graphics_Driver::id(bm));
SelectObject(off_gc, fl_brush()); // use bitmap's desired color
BitBlt(off_gc, 0, 0, W, H, tempdc, 0, 0, 0xE20746L); // draw bitmap to offscreen
fl_end_offscreen(); // offscreen data is in tmp_id
@@ -504,26 +504,26 @@ void Fl_GDI_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, int
int X, Y, W, H;
// Don't draw an empty image...
if (!img->d() || !img->array) {
- img->draw_empty(XP, YP);
+ Fl_Graphics_Driver::draw_empty(img, XP, YP);
return;
}
- if (start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
+ if (::start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
return;
}
- if (!img->id_) img->id_ = (fl_uintptr_t)build_id(img, (void**)&(img->mask_));
- if (img->mask_) {
+ if (!*Fl_Graphics_Driver::id(img)) *Fl_Graphics_Driver::id(img) = (fl_uintptr_t)build_id(img, (void**)(Fl_Graphics_Driver::mask(img)));
+ if (*Fl_Graphics_Driver::mask(img)) {
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
- SelectObject(new_gc, (void*)img->mask_);
+ SelectObject(new_gc, (void*)*Fl_Graphics_Driver::mask(img));
BitBlt(gc_, X, Y, W, H, new_gc, cx, cy, SRCAND);
- SelectObject(new_gc, (void*)img->id_);
+ SelectObject(new_gc, (void*)*Fl_Graphics_Driver::id(img));
BitBlt(gc_, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
RestoreDC(new_gc,save);
DeleteDC(new_gc);
} else if (img->d()==2 || img->d()==4) {
- copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)img->id_, cx, cy);
+ copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(img), cx, cy);
} else {
- copy_offscreen(X, Y, W, H, (Fl_Offscreen)img->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(img), cx, cy);
}
}
@@ -545,10 +545,11 @@ int Fl_GDI_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP, i
Fl_RGB_Image *rgb = img->as_rgb_image();
if (!rgb || !rgb->array) return 0; // for bitmaps and pixmaps
- if (!rgb->id_) rgb->id_ = (fl_uintptr_t)build_id(rgb, (void**)&(rgb->mask_));
+ if (!*Fl_Graphics_Driver::id(rgb)) *Fl_Graphics_Driver::id(rgb) = (fl_uintptr_t)build_id(rgb,
+ (void**)(Fl_Graphics_Driver::mask(rgb)));
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
- SelectObject(new_gc, (HBITMAP)rgb->id_);
+ SelectObject(new_gc, (HBITMAP)*Fl_Graphics_Driver::id(rgb));
if ((img->d() % 2) == 0 && can_do_alpha_blending()) {
alpha_blend_(XP, YP, WP, HP, new_gc, 0, 0, rgb->w(), rgb->h());
} else {
@@ -607,25 +608,25 @@ fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_Bitmap*, int w, int h, const uchar
void Fl_GDI_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
- if (pxm->mask_) {
+ if (Fl_Graphics_Driver::prepare(pxm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
+ if (*Fl_Graphics_Driver::mask(pxm)) {
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
- SelectObject(new_gc, (void*)pxm->mask_);
+ SelectObject(new_gc, (void*)*Fl_Graphics_Driver::mask(pxm));
BitBlt(gc_, X, Y, W, H, new_gc, cx, cy, SRCAND);
- SelectObject(new_gc, (void*)pxm->id_);
+ SelectObject(new_gc, (void*)*Fl_Graphics_Driver::id(pxm));
BitBlt(gc_, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
RestoreDC(new_gc,save);
DeleteDC(new_gc);
} else {
- copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(pxm), cx, cy);
}
}
void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
+ if (Fl_Graphics_Driver::prepare(pxm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
typedef BOOL (WINAPI* fl_transp_func) (HDC,int,int,int,int,HDC,int,int,int,int,UINT);
static HMODULE hMod = NULL;
static fl_transp_func fl_TransparentBlt = NULL;
@@ -636,14 +637,14 @@ void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP
if (fl_TransparentBlt) {
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
- SelectObject(new_gc, (void*)pxm->id_);
+ SelectObject(new_gc, (void*)*Fl_Graphics_Driver::id(pxm));
// print all of offscreen but its parts in background color
- fl_TransparentBlt(gc_, X, Y, W, H, new_gc, cx, cy, W, H, pxm->pixmap_bg_color );
+ fl_TransparentBlt(gc_, X, Y, W, H, new_gc, cx, cy, W, H, *Fl_Graphics_Driver::pixmap_bg_color(pxm) );
RestoreDC(new_gc,save);
DeleteDC(new_gc);
}
else {
- copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(pxm), cx, cy);
}
}
@@ -655,10 +656,10 @@ fl_uintptr_t Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img, int w, int h, const c
uchar *bitmap = 0;
Fl_Surface_Device::surface()->driver()->mask_bitmap(&bitmap);
fl_draw_pixmap(data, 0, 0, FL_BLACK);
- img->pixmap_bg_color = Fl_WinAPI_System_Driver::win_pixmap_bg_color; // computed by fl_draw_pixmap()
+ *Fl_Graphics_Driver::pixmap_bg_color(img) = Fl_WinAPI_System_Driver::win_pixmap_bg_color; // computed by fl_draw_pixmap()
Fl_Surface_Device::surface()->driver()->mask_bitmap(0);
if (bitmap) {
- img->mask_ = (fl_uintptr_t)fl_create_bitmask(w, h, bitmap);
+ *Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)fl_create_bitmask(w, h, bitmap);
delete[] bitmap;
}
fl_end_offscreen();
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
index 6919e509f..8dec36f07 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
@@ -133,11 +133,11 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
void Fl_Quartz_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
+ if (Fl_Graphics_Driver::start(bm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
return;
}
- if (bm->id_ && gc_) {
- draw_CGImage((CGImageRef)bm->id_, X,Y,W,H, cx, cy, bm->w(), bm->h());
+ 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());
}
}
@@ -167,26 +167,26 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP,
int X, Y, W, H;
// Don't draw an empty image...
if (!img->d() || !img->array) {
- img->draw_empty(XP, YP);
+ Fl_Graphics_Driver::draw_empty(img, XP, YP);
return;
}
- if (start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
+ if (::start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
return;
}
- if (!img->id_) {
+ if (!*Fl_Graphics_Driver::id(img)) {
CGColorSpaceRef lut = img->d()<=2 ? CGColorSpaceCreateDeviceGray() : CGColorSpaceCreateDeviceRGB();
int ld = img->ld();
if (!ld) ld = img->w() * img->d();
// the CGImage data provider must not release the image data.
- CGDataProviderRef src = CGDataProviderCreateWithData((void*)img->mask_, img->array, ld * img->h(), NULL);
- img->id_ = (fl_uintptr_t)CGImageCreate(img->w(), img->h(), 8, img->d()*8, ld,
+ CGDataProviderRef src = CGDataProviderCreateWithData((void*)*Fl_Graphics_Driver::mask(img), img->array, ld * img->h(), NULL);
+ *Fl_Graphics_Driver::id(img) = (fl_uintptr_t)CGImageCreate(img->w(), img->h(), 8, img->d()*8, ld,
lut, (img->d()&1)?kCGImageAlphaNone:kCGImageAlphaLast,
src, 0L, false, kCGRenderingIntentDefault);
CGColorSpaceRelease(lut);
CGDataProviderRelease(src);
}
- if (img->id_ && gc_) {
- CGImageRef cgimg = (CGImageRef)img->id_;
+ if (*Fl_Graphics_Driver::id(img) && gc_) {
+ CGImageRef cgimg = (CGImageRef)*Fl_Graphics_Driver::id(img);
if ( has_feature(PRINTER) ) {
// When printing, the image data is used when the page is completed, that is, after return from this function.
// We must protect against image data being freed before it is used:
@@ -227,8 +227,8 @@ int Fl_Quartz_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP
void Fl_Quartz_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
- copy_offscreen(X, Y, W, H, (Fl_Offscreen)pxm->id_, cx, cy);
+ if (Fl_Graphics_Driver::prepare(pxm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
+ copy_offscreen(X, Y, W, H, (Fl_Offscreen)*Fl_Graphics_Driver::id(pxm), cx, cy);
}
Fl_Bitmask Fl_Quartz_Graphics_Driver::create_bitmask(int w, int h, const uchar *array) {
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
index 25ac80298..eea701a33 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx
@@ -614,11 +614,11 @@ void Fl_Xlib_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) {
void Fl_Xlib_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
+ if (Fl_Graphics_Driver::start(bm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
return;
}
- XSetStipple(fl_display, gc_, bm->id_);
+ XSetStipple(fl_display, gc_, *Fl_Graphics_Driver::id(bm));
int ox = X-cx; if (ox < 0) ox += bm->w();
int oy = Y-cy; if (oy < 0) oy += bm->h();
XSetTSOrigin(fl_display, gc_, ox, oy);
@@ -707,13 +707,13 @@ void Fl_Xlib_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, in
int X, Y, W, H;
// Don't draw an empty image...
if (!img->d() || !img->array) {
- img->draw_empty(XP, YP);
+ Fl_Graphics_Driver::draw_empty(img, XP, YP);
return;
}
- if (start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
+ if (::start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
return;
}
- if (!img->id_) {
+ if (!*Fl_Graphics_Driver::id(img)) {
Fl_Image_Surface *surface = NULL;
int depth = img->d();
if (depth == 1 || depth == 3) {
@@ -727,30 +727,30 @@ void Fl_Xlib_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, in
surface->set_current();
fl_draw_image(img->array, 0, 0, img->w(), img->h(), depth, img->ld());
surface->end_current();
- img->id_ = surface->get_offscreen_before_delete();
+ *Fl_Graphics_Driver::id(img) = surface->get_offscreen_before_delete();
delete surface;
}
}
- if (img->id_) {
- if (img->mask_) {
+ if (*Fl_Graphics_Driver::id(img)) {
+ if (*Fl_Graphics_Driver::mask(img)) {
// 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, gc_, img->mask_);
+ XSetClipMask(fl_display, gc_, *Fl_Graphics_Driver::mask(img));
int ox = X-cx; if (ox < 0) ox += img->w();
int oy = Y-cy; if (oy < 0) oy += img->h();
XSetClipOrigin(fl_display, gc_, X-cx, Y-cy);
}
if (img->d() == 4 && fl_can_do_alpha_blending())
- copy_offscreen_with_alpha(X, Y, W, H, img->id_, cx, cy);
+ copy_offscreen_with_alpha(X, Y, W, H, *Fl_Graphics_Driver::id(img), cx, cy);
else
- copy_offscreen(X, Y, W, H, img->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, *Fl_Graphics_Driver::id(img), cx, cy);
- if (img->mask_) {
+ if (*Fl_Graphics_Driver::mask(img)) {
// put the old clip region back
XSetClipOrigin(fl_display, gc_, 0, 0);
fl_restore_clip();
@@ -780,10 +780,10 @@ fl_uintptr_t Fl_Xlib_Graphics_Driver::cache(Fl_Bitmap*, int w, int h, const ucha
void Fl_Xlib_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
int X, Y, W, H;
- if (pxm->prepare(XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
- if (pxm->mask_) {
+ if (Fl_Graphics_Driver::prepare(pxm, XP, YP, WP, HP, cx, cy, X, Y, W, H)) return;
+ if (*Fl_Graphics_Driver::mask(pxm)) {
// make X use the bitmap as a mask:
- XSetClipMask(fl_display, gc_, pxm->mask_);
+ XSetClipMask(fl_display, gc_, *Fl_Graphics_Driver::mask(pxm));
XSetClipOrigin(fl_display, gc_, X-cx, Y-cy);
if (clip_region()) {
// At this point, XYWH is the bounding box of the intersection between
@@ -803,17 +803,17 @@ void Fl_Xlib_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int H
Y1 = r->rects[i].y1;
W1 = r->rects[i].x2 - r->rects[i].x1;
H1 = r->rects[i].y2 - r->rects[i].y1;
- copy_offscreen(X1, Y1, W1, H1, pxm->id_, cx + (X1 - X), cy + (Y1 - Y));
+ copy_offscreen(X1, Y1, W1, H1, *Fl_Graphics_Driver::id(pxm), cx + (X1 - X), cy + (Y1 - Y));
}
XDestroyRegion(r);
} else {
- copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, *Fl_Graphics_Driver::id(pxm), cx, cy);
}
// put the old clip region back
XSetClipOrigin(fl_display, gc_, 0, 0);
restore_clip();
}
- else copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
+ else copy_offscreen(X, Y, W, H, *Fl_Graphics_Driver::id(pxm), cx, cy);
}
@@ -826,7 +826,7 @@ fl_uintptr_t Fl_Xlib_Graphics_Driver::cache(Fl_Pixmap *img, int w, int h, const
fl_draw_pixmap(data, 0, 0, FL_BLACK);
Fl_Surface_Device::surface()->driver()->mask_bitmap(0);
if (bitmap) {
- img->mask_ = (fl_uintptr_t)fl_create_bitmask(w, h, bitmap);
+ *Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)fl_create_bitmask(w, h, bitmap);
delete[] bitmap;
}
fl_end_offscreen();