From 9a0f0f462f4bce813af5fd7d26d61f2109d0025e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 13 Sep 2012 17:13:05 +0000 Subject: [PATCH] Don't initialize alpha twice when loading wxImage from resources. Calling InitAlpha() when we already had loaded alpha from the resource data results in an assert. Fix this by only initializing alpha if don't have it yet. Closes #14643. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/image.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/image.cpp b/src/common/image.cpp index 5d65ecaa9c..2c61998e6d 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -2306,7 +2306,10 @@ static wxImage LoadImageFromResource(const wxString &name, wxBitmapType type) image.SetMaskColour(0xc0, 0xc0, 0xc0); } - image.InitAlpha(); + // We could have already loaded alpha from the resources, but if not, + // initialize it now using the mask. + if ( !image.HasAlpha() ) + image.InitAlpha(); return image; } -- 2.45.2