summaryrefslogtreecommitdiff
path: root/src/fl_draw_image_mac.cxx
diff options
context:
space:
mode:
authorFabien Costantini <fabien@onepost.net>2008-10-13 23:10:43 +0000
committerFabien Costantini <fabien@onepost.net>2008-10-13 23:10:43 +0000
commit92051890f1127429142cc0b60e3e9a1e567bf01d (patch)
tree4c0e7f28192914b24202d08aa3eaa72a7bf5f7e4 /src/fl_draw_image_mac.cxx
parent8e9c1d1ab030dc7beed522f368c467dd94e1f8bb (diff)
Quickdraw removal: option removed from configure, all Qd code removed from sources. Also took this opportunity to sort the ifdef clauses so that USE_X11 shows first. Also added error pragma to enforce proper target checking, thus make even less assumptions.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6423 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_draw_image_mac.cxx')
-rw-r--r--src/fl_draw_image_mac.cxx114
1 files changed, 2 insertions, 112 deletions
diff --git a/src/fl_draw_image_mac.cxx b/src/fl_draw_image_mac.cxx
index fb493b487..d8ccb14b0 100644
--- a/src/fl_draw_image_mac.cxx
+++ b/src/fl_draw_image_mac.cxx
@@ -56,117 +56,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
{
if (!linedelta) linedelta = W*delta;
-#ifdef __APPLE_QD__
- // theoretically, if the current GPort permits, we could write
- // directly into it, avoiding the temporary GWorld. For now I
- // will go the safe way... .
- char direct = 0;
- GWorldPtr gw;
- Rect bounds;
- bounds.left=0; bounds.right=W; bounds.top=0; bounds.bottom=H;
- QDErr err = NewGWorld( &gw, 32, &bounds, 0L, 0L, useTempMem );
- if (err==noErr && gw) {
- PixMapHandle pm = GetGWorldPixMap( gw );
- if ( pm ) {
- LockPixels( pm );
- if ( *pm ) {
- uchar *base = (uchar*)GetPixBaseAddr( pm );
- if ( base ) {
- PixMapPtr pmp = *pm;
- // make absolutely sure that we can use a direct memory write to
- // create the pixmap!
- if ( pmp->pixelType == 16 || pmp->pixelSize == 32 || pmp->cmpCount == 3 || pmp->cmpSize == 8 ) {
- int rowBytes = pmp->rowBytes & 0x3fff;
- if ( cb )
- {
- uchar *tmpBuf = new uchar[ W*delta ];
- if ( mono ) delta -= 1; else delta -= 3;
- for ( int i=0; i<H; i++ )
- {
- uchar *src = tmpBuf;
- uchar *dst = base + i*rowBytes;
- cb( userdata, 0, i, W, tmpBuf );
- if ( mono ) {
- for ( int j=0; j<W; j++ )
- { uchar c = *src++; *dst++ = 0; *dst++ = c; *dst++ = c; *dst++ = c; src += delta; }
- } else {
- for ( int j=0; j<W; j++ )
- { *dst++ = 0; *dst++ = *src++; *dst++ = *src++; *dst++ = *src++; src += delta; }
- }
- }
- delete[] tmpBuf;
- }
- else
- {
- if ( mono ) delta -= 1; else delta -= 3;
- for ( int i=0; i<H; i++ )
- {
- const uchar *src = buf+i*linedelta;
- uchar *dst = base + i*rowBytes;
- if ( mono ) {
- for ( int j=0; j<W; j++ )
- { uchar c = *src++; *dst++ = 0; *dst++ = c; *dst++ = c; *dst++ = c; src += delta; }
- } else {
- for ( int j=0; j<W; j++ )
- { *dst++ = 0; *dst++ = *src++; *dst++ = *src++; *dst++ = *src++; src += delta; }
- }
- }
- }
-
- fl_copy_offscreen( X, Y, W, H, gw, 0, 0 );
- direct = 1;
- }
- }
- }
-
- UnlockPixels( pm );
- }
-
- DisposeGWorld( gw );
- }
-
- // great. We were able to write the pixels directly into memory, so we can return now.
- if ( direct )
- return;
-
- // following the very save (and very slow) way to write the image into the give port
- if ( cb )
- {
- uchar *tmpBuf = new uchar[ W*3 ];
- for ( int i=0; i<H; i++ )
- {
- uchar *src = tmpBuf;
- cb( userdata, 0, i, W, tmpBuf );
- for ( int j=0; j<W; j++ )
- {
- if ( mono )
- { fl_color( src[0], src[0], src[0] ); src++; }
- else
- { fl_color( src[0], src[1], src[2] ); src+=3; }
- MoveTo( X+j, Y+i );
- Line( 0, 0 );
- }
- }
- delete[] tmpBuf;
- }
- else
- {
- for ( int i=0; i<H; i++ )
- {
- const uchar *src = buf+i*linedelta;
- for ( int j=0; j<W; j++ )
- {
- if ( mono )
- fl_color( src[0], src[0], src[0] );
- else
- fl_color( src[0], src[1], src[2] );
- MoveTo( X+j, Y+i );
- Line( 0, 0 );
- src += delta;
- }
- }
- }
-#elif defined(__APPLE_QUARTZ__)
+#if defined(__APPLE_QUARTZ__)
const void *array = buf;
uchar *tmpBuf = 0;
if (cb) {
@@ -245,7 +135,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
CGContextSetShouldAntialias(fl_gc, true);
#else
-# error : you must defined __APPLE_QD__ or __APPLE_QUARTZ__
+# error : you must define __APPLE_QUARTZ__
#endif
}