Author: manolo
Date: 2012-03-12 06:33:56 -0700 (Mon, 12 Mar 2012)
New Revision: 9280
Log:
Created virtual void fltk3::GraphicsDriver::copy_offscreen()
Modified:
branches/branch-3.0/include/FL/fl_draw.H
branches/branch-3.0/include/FL/mac.H
branches/branch-3.0/include/FL/win32.H
branches/branch-3.0/include/fltk3/Device.h
branches/branch-3.0/include/fltk3/draw.h
branches/branch-3.0/include/fltk3/osx.h
branches/branch-3.0/include/fltk3/win32.h
branches/branch-3.0/include/fltk3/x.h
branches/branch-3.0/src/fltk3/DoubleWindow.cxx
branches/branch-3.0/src/fltk3/Image.cxx
branches/branch-3.0/src/fltk3/Pixmap.cxx
Modified: branches/branch-3.0/include/FL/fl_draw.H
===================================================================
--- branches/branch-3.0/include/FL/fl_draw.H 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/include/FL/fl_draw.H 2012-03-12 13:33:56 UTC (rev
9280)
@@ -495,6 +495,10 @@
return fltk3::draw_symbol(label, x, y, w, h, fltk3::_1to3_color(c));
}
+inline void fl_copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen
pixmap, int srcx, int srcy) {
+ fltk3::copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
+}
+
#if 0 // FIXME: 123
FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int
scalable);
Modified: branches/branch-3.0/include/FL/mac.H
===================================================================
--- branches/branch-3.0/include/FL/mac.H 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/include/FL/mac.H 2012-03-12 13:33:56 UTC (rev
9280)
@@ -175,7 +175,7 @@
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld,
const uchar *data);
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
extern Fl_Offscreen fl_create_offscreen(int w, int h);
-extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld,
int srcx,int srcy);
+//extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld,
int srcx,int srcy);
extern void fl_delete_offscreen(Fl_Offscreen gWorld);
extern void fl_begin_offscreen(Fl_Offscreen gWorld);
extern void fl_end_offscreen();
Modified: branches/branch-3.0/include/FL/win32.H
===================================================================
--- branches/branch-3.0/include/FL/win32.H 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/include/FL/win32.H 2012-03-12 13:33:56 UTC (rev
9280)
@@ -145,8 +145,7 @@
fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc);
_ss->set_current(); fl_window=_sw; fl_gc = _sgc
-FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int
srcx,int srcy);
-FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP
pixmap,int srcx,int srcy);
+//FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int
srcx,int srcy);
#define fl_delete_offscreen(bitmap) DeleteObject(bitmap)
// Bitmap masks
Modified: branches/branch-3.0/include/fltk3/Device.h
===================================================================
--- branches/branch-3.0/include/fltk3/Device.h 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/include/fltk3/Device.h 2012-03-12 13:33:56 UTC (rev
9280)
@@ -334,6 +334,8 @@
inline Fl_Font_Descriptor *font_descriptor() { return font_descriptor_;}
/** Sets the current Fl_Font_Descriptor for the graphics driver */
inline void font_descriptor(Fl_Font_Descriptor *d) { font_descriptor_ = d;}
+ /** see fltk3::copy_offscreen() */
+ virtual void copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen
pixmap, int srcx, int srcy);
/** \brief The destructor */
virtual ~GraphicsDriver() { if (p) free(p); }
};
@@ -397,6 +399,7 @@
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
void line_style(int style, int width=0, char* dashes=0);
void transformed_vertex(double xf, double yf);
+ void copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap,
int srcx, int srcy);
#if ! defined(FLTK3_DOXYGEN)
static fltk3::Offscreen create_offscreen_with_alpha(int w, int h);
#endif
@@ -462,6 +465,7 @@
int not_clipped(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);
void line_style(int style, int width=0, char* dashes=0);
+ void copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap,
int srcx, int srcy);
#if ! defined(FLTK3_DOXYGEN)
void copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int
srcx,int srcy);
#endif
@@ -523,6 +527,7 @@
int not_clipped(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);
void line_style(int style, int width=0, char* dashes=0);
+ void copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap,
int srcx, int srcy);
};
#endif
Modified: branches/branch-3.0/include/fltk3/draw.h
===================================================================
--- branches/branch-3.0/include/fltk3/draw.h 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/include/fltk3/draw.h 2012-03-12 13:33:56 UTC (rev
9280)
@@ -749,6 +749,8 @@
/* note: doxygen comment here to avoid triplication in os-speciic files */
FLTK3_EXPORT uchar *read_image(uchar *p,int X,int Y,int W,int H,int alpha=0);
+ FLTK3_EXPORT void copy_offscreen(int x, int y, int w, int h,
fltk3::Offscreen pixmap, int srcx, int srcy);
+
// pixmaps:
FLTK3_EXPORT int draw_pixmap(/*const*/ char* const* data, int x,int
y,fltk3::Color=fltk3::GRAY);
FLTK3_EXPORT int draw_pixmap(const char* const* cdata, int x,int
y,fltk3::Color=fltk3::GRAY);
Modified: branches/branch-3.0/include/fltk3/osx.h
===================================================================
--- branches/branch-3.0/include/fltk3/osx.h 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/include/fltk3/osx.h 2012-03-12 13:33:56 UTC (rev
9280)
@@ -180,7 +180,7 @@
extern fltk3::Bitmask fl_create_alphamask(int w, int h, int d, int ld, const
uchar *data);
extern void fl_delete_bitmask(fltk3::Bitmask bm);
extern fltk3::Offscreen fl_create_offscreen(int w, int h);
-extern void fl_copy_offscreen(int x,int y,int w,int h, fltk3::Offscreen
gWorld, int srcx,int srcy);
+//extern void fltk3::copy_offscreen(int x,int y,int w,int h, fltk3::Offscreen
gWorld, int srcx,int srcy);
extern void fl_delete_offscreen(fltk3::Offscreen gWorld);
extern void fl_begin_offscreen(fltk3::Offscreen gWorld);
extern void fl_end_offscreen();
Modified: branches/branch-3.0/include/fltk3/win32.h
===================================================================
--- branches/branch-3.0/include/fltk3/win32.h 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/include/fltk3/win32.h 2012-03-12 13:33:56 UTC (rev
9280)
@@ -153,7 +153,6 @@
fltk3::pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc);
_ss->set_current(); fl_window=_sw; fl_gc = _sgc
-FLTK3_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int
srcx,int srcy);
#define fl_delete_offscreen(bitmap) DeleteObject(bitmap)
// Bitmap masks
Modified: branches/branch-3.0/include/fltk3/x.h
===================================================================
--- branches/branch-3.0/include/fltk3/x.h 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/include/fltk3/x.h 2012-03-12 13:33:56 UTC (rev
9280)
@@ -113,7 +113,6 @@
# define fl_end_offscreen() \
fltk3::pop_clip(); fl_window = _sw; _ss->set_current()
-extern void fl_copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen
pixmap, int srcx, int srcy);
# define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
// Bitmap masks
Modified: branches/branch-3.0/src/fltk3/DoubleWindow.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/DoubleWindow.cxx 2012-03-12 12:10:56 UTC
(rev 9279)
+++ branches/branch-3.0/src/fltk3/DoubleWindow.cxx 2012-03-12 13:33:56 UTC
(rev 9280)
@@ -69,8 +69,6 @@
Window::show();
}
-static void fl_copy_offscreen_to_display(int x, int y, int w, int h,
fltk3::Offscreen pixmap, int srcx, int srcy);
-
/** \addtogroup fl_drawings
@{
*/
@@ -80,23 +78,22 @@
\param pixmap offscreen buffer containing the rectangle to copy
\param srcx,srcy origin in offscreen buffer of rectangle to copy
*/
-void fl_copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap,
int srcx, int srcy) {
- if (fltk3::graphics_driver->class_name() ==
fltk3::DisplayDevice::display_device()->driver()->class_name()) {
- fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy);
- }
- else { // when copy is not to the display
- fl_begin_offscreen(pixmap);
- uchar *img = fltk3::read_image(NULL, srcx, srcy, w, h, 0);
- fl_end_offscreen();
- fltk3::draw_image(img, x, y, w, h, 3, 0);
- delete[] img;
- }
+void fltk3::copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen
pixmap, int srcx, int srcy) {
+ fltk3::graphics_driver->copy_offscreen(x, y, w, h, pixmap, srcx, srcy);
}
/** @} */
+void fltk3::GraphicsDriver::copy_offscreen(int x, int y, int w, int h,
fltk3::Offscreen pixmap, int srcx, int srcy) {
+ fl_begin_offscreen(pixmap);
+ uchar *img = fltk3::read_image(NULL, srcx, srcy, w, h, 0);
+ fl_end_offscreen();
+ fltk3::draw_image(img, x, y, w, h, 3, 0);
+ delete[] img;
+}
+
#if defined(USE_X11)
-static void fl_copy_offscreen_to_display(int x, int y, int w, int h,
fltk3::Offscreen pixmap, int srcx, int srcy) {
+void fltk3::XlibGraphicsDriver::copy_offscreen(int x, int y, int w, int h,
fltk3::Offscreen pixmap, int srcx, int srcy) {
XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y);
}
@@ -168,7 +165,7 @@
return new_gc;
}
-static void fl_copy_offscreen_to_display(int x,int y,int w,int h,HBITMAP
bitmap,int srcx,int srcy) {
+void fltk3::GDIGraphicsDriver::copy_offscreen(int x,int y,int w,int h,HBITMAP
bitmap,int srcx,int srcy) {
HDC new_gc = CreateCompatibleDC(fl_gc);
int save = SaveDC(new_gc);
SelectObject(new_gc, bitmap);
@@ -237,7 +234,7 @@
if(count == 1) free((void*)data);
}
-static void fl_copy_offscreen_to_display(int x,int y,int w,int
h,fltk3::Offscreen osrc,int srcx,int srcy) {
+void fltk3::QuartzGraphicsDriver::copy_offscreen(int x,int y,int w,int
h,fltk3::Offscreen osrc,int srcx,int srcy) {
CGContextRef src = (CGContextRef)osrc;
void *data = CGBitmapContextGetData(src);
int sw = CGBitmapContextGetWidth(src);
@@ -249,8 +246,7 @@
CFRetain(src);
CGDataProviderRef src_bytes = CGDataProviderCreateWithData( src, data,
sw*sh*4, bmProviderRelease);
CGImageRef img = CGImageCreate( sw, sh, 8, 4*8, 4*sw, lut, alpha,
- src_bytes, 0L, false, kCGRenderingIntentDefault);
- // fltk3::push_clip();
+ src_bytes, 0L, false,
kCGRenderingIntentDefault);
CGRect rect = { { x, y }, { w, h } };
Fl_X::q_begin_image(rect, srcx, srcy, sw, sh);
CGContextDrawImage(fl_gc, rect, img);
@@ -416,7 +412,7 @@
// on Irix (at least) it is faster to reduce the area copied to
// the current clip region:
int X,Y,W,H; fltk3::clip_box(0,0,w(),h(),X,Y,W,H);
- if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
+ if (myi->other_xid) fltk3::copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
}
void fltk3::DoubleWindow::resize(int X,int Y,int W,int H) {
Modified: branches/branch-3.0/src/fltk3/Image.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Image.cxx 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/src/fltk3/Image.cxx 2012-03-12 13:33:56 UTC (rev
9280)
@@ -528,7 +528,7 @@
} else if (img->d()==2 || img->d()==4) {
copy_offscreen_with_alpha(X, Y, W, H, (fltk3::Offscreen)img->id_, cx, cy);
} else {
- fl_copy_offscreen(X, Y, W, H, (fltk3::Offscreen)img->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, (fltk3::Offscreen)img->id_, cx, cy);
}
}
@@ -565,7 +565,7 @@
XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
}
- fl_copy_offscreen(X, Y, W, H, img->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, img->id_, cx, cy);
if (img->mask_) {
// put the old clip region back
Modified: branches/branch-3.0/src/fltk3/Pixmap.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/Pixmap.cxx 2012-03-12 12:10:56 UTC (rev
9279)
+++ branches/branch-3.0/src/fltk3/Pixmap.cxx 2012-03-12 13:33:56 UTC (rev
9280)
@@ -119,7 +119,7 @@
fltk3::draw_pixmap(pxm->data(), 0, 0, fltk3::GREEN);
fl_end_offscreen();
}
- fl_copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
}
#elif defined(WIN32)
@@ -173,7 +173,7 @@
fl_delete_offscreen(tmp_id);
}
else {
- fl_copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
}
}
else if (pxm->mask_) {
@@ -186,7 +186,7 @@
RestoreDC(new_gc,save);
DeleteDC(new_gc);
} else {
- fl_copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
}
}
@@ -224,7 +224,7 @@
int oy = Y-cy; if (oy < 0) oy += pxm->h();
XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
}
- fl_copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
+ copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
if (pxm->mask_) {
// put the old clip region back
XSetClipOrigin(fl_display, fl_gc, 0, 0);
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit