don't always create DIBs in wxBitmap(wxImage) ctor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@55153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -135,7 +135,9 @@ wxMSW:
|
|||||||
- Fix quoting of arguments passed to wxExecute(char **) (Brian Ravnsgaard Riis).
|
- Fix quoting of arguments passed to wxExecute(char **) (Brian Ravnsgaard Riis).
|
||||||
- Support disabling items before adding them to the menu (Christian Walther).
|
- Support disabling items before adding them to the menu (Christian Walther).
|
||||||
- Allow to call SetFont(wxNullFont) to reset the font to default.
|
- Allow to call SetFont(wxNullFont) to reset the font to default.
|
||||||
- Implement UUID::operator==() and !=() (SQLAware).
|
- Implement UUID::operator==() and !=() (SQLAware Corporation).
|
||||||
|
- Fixed long standing (introduced in 2.6.3) bug which resulted in always
|
||||||
|
creating a DIB and not DDB in wxBitmap(const wxImage&) ctor.
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -808,14 +808,15 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc)
|
|||||||
if ( !dib.IsOk() )
|
if ( !dib.IsOk() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( depth == -1 )
|
const bool hasAlpha = image.HasAlpha();
|
||||||
depth = dib.GetDepth(); // Get depth from image if none specified
|
|
||||||
|
|
||||||
// store the bitmap parameters
|
// store the bitmap parameters
|
||||||
wxBitmapRefData *refData = new wxBitmapRefData;
|
wxBitmapRefData * const refData = new wxBitmapRefData;
|
||||||
refData->m_width = w;
|
refData->m_width = w;
|
||||||
refData->m_height = h;
|
refData->m_height = h;
|
||||||
refData->m_hasAlpha = image.HasAlpha();
|
refData->m_hasAlpha = hasAlpha;
|
||||||
|
refData->m_depth = depth == -1 ? (hasAlpha ? 32 : 24)
|
||||||
|
: depth;
|
||||||
|
|
||||||
m_refData = refData;
|
m_refData = refData;
|
||||||
|
|
||||||
@@ -826,20 +827,17 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc)
|
|||||||
// are we going to use DIB?
|
// are we going to use DIB?
|
||||||
//
|
//
|
||||||
// NB: DDBs don't support alpha so if we have alpha channel we must use DIB
|
// NB: DDBs don't support alpha so if we have alpha channel we must use DIB
|
||||||
if ( image.HasAlpha() || wxShouldCreateDIB(w, h, depth, hdc) )
|
if ( hasAlpha || wxShouldCreateDIB(w, h, depth, hdc) )
|
||||||
{
|
{
|
||||||
// don't delete the DIB section in dib object dtor
|
// don't delete the DIB section in dib object dtor
|
||||||
hbitmap = dib.Detach();
|
hbitmap = dib.Detach();
|
||||||
|
|
||||||
refData->m_isDIB = true;
|
refData->m_isDIB = true;
|
||||||
refData->m_depth = depth;
|
|
||||||
}
|
}
|
||||||
#ifndef ALWAYS_USE_DIB
|
#ifndef ALWAYS_USE_DIB
|
||||||
else // we need to convert DIB to DDB
|
else // we need to convert DIB to DDB
|
||||||
{
|
{
|
||||||
hbitmap = dib.CreateDDB((HDC)hdc);
|
hbitmap = dib.CreateDDB((HDC)hdc);
|
||||||
|
|
||||||
refData->m_depth = depth;
|
|
||||||
}
|
}
|
||||||
#endif // !ALWAYS_USE_DIB
|
#endif // !ALWAYS_USE_DIB
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user