Relax the restriction on the number of colours in wxMSW wxPalette.

Refuse to create palettes with more than 65536 colours and not 256 ones. It
doesn't seem very useful to use more than 256 of them anyhow as any colours
above index 255 can't be accessed via GetRGB() but don't break the palette
creation with more colours in the stable branch without a good reason, maybe
someone makes some use of this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@67095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-03-01 00:02:52 +00:00
parent 2a35360c3d
commit fd22cf4915

View File

@@ -79,7 +79,9 @@ int wxPalette::GetColoursCount() const
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
if ( n < 0 || n > 255 )
// The number of colours in LOGPALETTE is a WORD so we can't create
// palettes with more entries than USHRT_MAX.
if ( n < 0 || n > 65535 )
return false;
UnRef();