Following code is giving Bus Error at bmp create (last
line).  Any idea.

I am using SDK 3.5 and GNU gcc for compiling
application. Using Emulator for testing with release
ROM (  Palm OS 3.5-en-color.rom  ) .   Also I have
install newest PilRC. 

With Code warrior this piece is perfectly fine.

Thanx,
Nimesh.

==============
static BitmapPtr GetSigBitmap( RectangleType*
theBoundsPtr )
{
        WinHandle       theWindowHandle ;
        Word            theError        ;
        BitmapPtr       theBitmapPtr ;
        Word            theRowBytes, theHeight  ;
        UInt32          romVersion      ;
        UInt32          size = 0        ;       
        UInt16          width, height ;
        WindowType      *winP   ;
        Err             *errorP  ;
        UInt32          sizeP = 0       ;       
        UInt16          rowBytes ;
        UInt8           depth ;

        // First, free the previous bitmap if it exists
        if (gBitmapPtr)
        {
                MemPtrFree( gBitmapPtr );
                gBitmapPtr = NULL;
        }       
        theWindowHandle = WinCreateOffscreenWindow(
theBoundsPtr->extent.x,  
                                                        theBoundsPtr->extent.y, 
genericFormat,
&theError );
        
        if (!theError)
        {
                FtrGet(sysFtrCreator, sysFtrNumROMVersion,
&romVersion);
                if (romVersion >= version3_5) 
                {       
                        RGBColorType rgb = {0,0,0,0};  
                        drawIndex = WinRGBToIndex(&rgb);
                        newAPI = true;  
                }
                // Now, copy the gadgets screen rectangle into the
new window.  This will offset
                // the screen bits to (0, 0) in the offscreen
window.
        
                WinCopyRectangle( NULL, theWindowHandle,
theBoundsPtr, 0, 0, 0 );
                
                if (newAPI)
                        {
                        BitmapPtr winBmpP = WinGetBitmap(theWindowHandle);
                        ColorTableType *clrTableP =
BmpGetColortable(winBmpP);
                        UInt8 depth = winBmpP->pixelSize;
                        WinHandle winH;
                        
                        // we create a bitmap and then make a window to it
so that we can 
                        // create a bitmap whose depth does not match that
of the screen

                        theBitmapPtr = BmpCreate(theBoundsPtr->extent.x,
theBoundsPtr->extent.y, depth, clrTableP, errorP);      


__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to