merge with latest sources
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7985 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -25,8 +25,10 @@ extern "C"
|
||||
#include "xpm.h"
|
||||
} ;
|
||||
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
||||
#endif
|
||||
|
||||
#include <PictUtils.h>
|
||||
|
||||
@@ -69,16 +71,7 @@ GWorldPtr wxMacCreateGWorld( int height , int width , int depth )
|
||||
|
||||
if ( depth < 0 )
|
||||
{
|
||||
// get max pixel depth
|
||||
CGrafPtr port ;
|
||||
GetCWMgrPort( &port ) ;
|
||||
GDHandle maxDevice ;
|
||||
|
||||
maxDevice = GetMaxDevice( &port->portRect ) ;
|
||||
if ( maxDevice )
|
||||
depth = (**((**maxDevice).gdPMap)).pixelSize ;
|
||||
else
|
||||
depth = 8 ;
|
||||
depth = wxDisplayDepth() ;
|
||||
}
|
||||
|
||||
err = NewGWorld( &port , depth , &rect , NULL , NULL , 0 ) ;
|
||||
@@ -178,7 +171,8 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
|
||||
|
||||
GetGWorld( &origPort , &origDevice ) ;
|
||||
SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
|
||||
|
||||
LockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
|
||||
|
||||
// bits is a word aligned array
|
||||
|
||||
unsigned char* linestart = (unsigned char*) bits ;
|
||||
@@ -211,6 +205,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
|
||||
}
|
||||
|
||||
}
|
||||
UnlockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
|
||||
|
||||
SetGWorld( origPort , origDevice ) ;
|
||||
}
|
||||
@@ -514,6 +509,8 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
||||
}
|
||||
|
||||
m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;
|
||||
LockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
|
||||
LockPixels( GetGWorldPixMap( (CGrafPtr) ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
|
||||
RGBColor maskColor = colour.GetPixel() ;
|
||||
|
||||
// this is not very efficient, but I can't think
|
||||
@@ -545,6 +542,8 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
||||
}
|
||||
}
|
||||
}
|
||||
UnlockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
|
||||
UnlockPixels( GetGWorldPixMap( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
|
||||
SetGWorld( origPort , origDevice ) ;
|
||||
|
||||
return TRUE;
|
||||
@@ -712,8 +711,8 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
|
||||
if (dc)
|
||||
{
|
||||
if (SelectObject(dc, (HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap))
|
||||
{ /* for following SetPixel */
|
||||
/* fill the XImage struct 'by hand' */
|
||||
{
|
||||
|
||||
ximage.width = M_BITMAPHANDLERDATA->m_width;
|
||||
ximage.height = M_BITMAPHANDLERDATA->m_height;
|
||||
ximage.depth = M_BITMAPHANDLERDATA->m_depth;
|
||||
@@ -725,7 +724,7 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
|
||||
DeleteDC(dc);
|
||||
|
||||
if (errorStatus == XpmSuccess)
|
||||
return TRUE; /* no error */
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
} else return FALSE;
|
||||
@@ -809,19 +808,6 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long
|
||||
int desiredWidth, int desiredHeight)
|
||||
{
|
||||
// TODO: load colourmap.
|
||||
/*
|
||||
M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name);
|
||||
if (M_BITMAPHANDLERDATA->m_hBitmap)
|
||||
{
|
||||
M_BITMAPHANDLERDATA->m_ok = TRUE;
|
||||
BITMAP bm;
|
||||
GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm);
|
||||
M_BITMAPHANDLERDATA->m_width = bm.bmWidth;
|
||||
M_BITMAPHANDLERDATA->m_height = bm.bmHeight;
|
||||
M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel;
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
// it's probably not found
|
||||
wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str());
|
||||
|
||||
@@ -852,11 +838,6 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
|
||||
#if USE_IMAGE_LOADING_IN_MSW
|
||||
wxPalette *palette = NULL;
|
||||
bool success = FALSE;
|
||||
/*
|
||||
if (type & wxBITMAP_DISCARD_COLOURMAP)
|
||||
success = wxLoadIntoBitmap(WXSTRINGCAST name, bitmap);
|
||||
else
|
||||
*/
|
||||
success = (wxLoadIntoBitmap(WXSTRINGCAST name, bitmap, &palette) != 0);
|
||||
if (!success && palette)
|
||||
{
|
||||
@@ -884,7 +865,6 @@ bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wxBitmap::CleanUpHandlers()
|
||||
{
|
||||
wxNode *node = sm_handlers.First();
|
||||
@@ -903,7 +883,7 @@ void wxBitmap::InitStandardHandlers()
|
||||
AddHandler( new wxPICTResourceHandler ) ;
|
||||
AddHandler( new wxICONResourceHandler ) ;
|
||||
AddHandler(new wxXPMFileHandler);
|
||||
AddHandler(new wxXPMDataHandler);
|
||||
AddHandler(new wxXPMDataHandler);
|
||||
AddHandler(new wxBMPResourceHandler);
|
||||
AddHandler(new wxBMPFileHandler);
|
||||
}
|
||||
|
Reference in New Issue
Block a user