summaryrefslogtreecommitdiff
path: root/src/fl_draw_image_mac.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2002-01-03 08:08:21 +0000
committerMatthias Melcher <fltk@matthiasm.com>2002-01-03 08:08:21 +0000
commit1775984dbea2b186a9cd7b5a8b697558028e7da9 (patch)
tree432a4522d897897bceff31921e71060ae94fbf6f /src/fl_draw_image_mac.cxx
parent2283309d0349118ffbd8313dd4a898eeeda2df04 (diff)
cleaned up src/Fl_mac.cxx, fixed Fl::wait(0.0), fixed Cmd-Q handling
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1905 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_draw_image_mac.cxx')
-rw-r--r--src/fl_draw_image_mac.cxx94
1 files changed, 4 insertions, 90 deletions
diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx
index da132dd03..eaaf9bd74 100644
--- a/src/fl_draw_image_mac.cxx
+++ b/src/fl_draw_image_mac.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_draw_image_mac.cxx,v 1.1.2.2 2002/01/01 15:11:32 easysw Exp $"
+// "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $"
//
// MacOS image drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -163,9 +163,9 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
}
-#ifdef __APPLE__
-//++ the above function does not support subregions yet
+// \todo Mac : the above function does not support subregions yet
#ifdef later_we_do_this
+// \todo Mac : the following code is taken from fl_draw_image_win32 and needs to be modified for Mac Carbon
// if (!linedelta) linedelta = W*delta;
int x, y, w, h;
@@ -251,92 +251,6 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
// );
}
#endif
-#else
- if (!linedelta) linedelta = W*delta;
-
- int x, y, w, h;
- fl_clip_box(X,Y,W,H,x,y,w,h);
- if (w<=0 || h<=0) return;
- if (buf) buf += (x-X)*delta + (y-Y)*linedelta;
-
- static U32 bmibuffer[256+12];
- BITMAPINFO &bmi = *((BITMAPINFO*)bmibuffer);
- if (!bmi.bmiHeader.biSize) {
- bmi.bmiHeader.biSize = sizeof(bmi)-4; // does it use this to determine type?
- bmi.bmiHeader.biPlanes = 1;
- bmi.bmiHeader.biCompression = BI_RGB;
- bmi.bmiHeader.biXPelsPerMeter = 0;
- bmi.bmiHeader.biYPelsPerMeter = 0;
- bmi.bmiHeader.biClrUsed = 0;
- bmi.bmiHeader.biClrImportant = 0;
- }
- if (mono) {
- for (int i=0; i<256; i++) {
- bmi.bmiColors[i].rgbBlue = i;
- bmi.bmiColors[i].rgbGreen = i;
- bmi.bmiColors[i].rgbRed = i;
- bmi.bmiColors[i].rgbReserved = i;
- }
- }
- bmi.bmiHeader.biWidth = w;
- bmi.bmiHeader.biBitCount = mono ? 8 : 24;
- int pixelsize = mono ? 1 : 3;
- int linesize = (pixelsize*w+3)&~3;
-
- static U32* buffer;
- int blocking = h;
- {int size = linesize*h;
- if (size > MAXBUFFER) {
- size = MAXBUFFER;
- blocking = MAXBUFFER/linesize;
- }
- static long buffer_size;
- if (size > buffer_size) {
- delete[] buffer;
- buffer_size = size;
- buffer = new U32[(size+3)/4];
- }}
- bmi.bmiHeader.biHeight = blocking;
- static U32* line_buffer;
- if (!buf) {
- int size = W*delta;
- static int line_buf_size;
- if (size > line_buf_size) {
- delete[] line_buffer;
- line_buf_size = size;
- line_buffer = new U32[(size+3)/4];
- }
- }
- for (int j=0; j<h; ) {
- int k;
- for (k = 0; j<h && k<blocking; k++, j++) {
- const uchar* from;
- if (!buf) { // run the converter:
- cb(userdata, x-X, y-Y+j, w, (uchar*)line_buffer);
- from = (uchar*)line_buffer;
- } else {
- from = buf;
- buf += linedelta;
- }
- uchar *to = (uchar*)buffer+(blocking-k-1)*linesize;
- if (mono) {
- for (int i=w; i--; from += delta) *to++ = *from;
- } else {
- for (int i=w; i--; from += delta, to += 3) {
- uchar r = from[0];
- to[0] = from[2];
- to[1] = from[1];
- to[2] = r;
- }
- }
- }
- SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k,
- (LPSTR)((uchar*)buffer+(blocking-k)*linesize),
- &bmi,
- DIB_RGB_COLORS
- );
- }
-#endif
}
void fl_draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
@@ -360,5 +274,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
}
//
-// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.2 2002/01/01 15:11:32 easysw Exp $".
+// End of "$Id: fl_draw_image_mac.cxx,v 1.1.2.3 2002/01/03 08:08:21 matthiaswm Exp $".
//