summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2006-11-15 01:52:20 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2006-11-15 01:52:20 +0000
commit0789a8a18e999cd56d278fa5f1fcf5f9e9ca7c36 (patch)
tree148be404e80c889bae65073e73432c4c181f38c7
parent489e8cdd059eafb766293c5487d43a3ac17db382 (diff)
Fix endian problem with fl_read_image() and QuickDraw on Intel-based Macs.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5544 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES2
-rw-r--r--src/fl_read_image_mac.cxx12
2 files changed, 12 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 4b2cf9eb4..1fea9c9ee 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.8
+ - fl_read_image() was broken on Intel-based Macs (STR
+ #1490)
- Fl_Progress was using the wrong width to calculate
progress (STR #1492)
- Documentation fixes (STR #1454, STR #1455, STR #1456,
diff --git a/src/fl_read_image_mac.cxx b/src/fl_read_image_mac.cxx
index e5e75ee4a..3cdbd48c4 100644
--- a/src/fl_read_image_mac.cxx
+++ b/src/fl_read_image_mac.cxx
@@ -3,7 +3,7 @@
//
// WIN32 image reading routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2006 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -108,12 +108,20 @@ fl_read_image(uchar *p, // I - Pixel buffer or NULL to allocate
// Copy the image from the off-screen buffer to the memory buffer.
for (idy = 0, pdst = p; idy < h; idy ++)
+#ifdef __i386__
+ for (idx = 0, psrc = base + idy * rowBytes; idx < w; idx ++, psrc += 4, pdst += d) {
+ pdst[0] = psrc[2];
+ pdst[1] = psrc[1];
+ pdst[2] = psrc[0];
+ }
+#else
for (idx = 0, psrc = base + idy * rowBytes + 1; idx < w; idx ++, psrc += 4, pdst += d) {
pdst[0] = psrc[0];
pdst[1] = psrc[1];
pdst[2] = psrc[2];
}
-
+#endif // __i386__
+
// Unlock and delete the off-screen buffer, then return...
UnlockPixels(pm);
fl_delete_offscreen(osbuffer);