X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce7efe2d0f056042d86cc581a7ee3af694b1fd6b..a2979ead8d5f5f2023d30d05a3c2d55f7804e24a:/src/common/anidecod.cpp diff --git a/src/common/anidecod.cpp b/src/common/anidecod.cpp index 76d2f9c0ba..ee6f88ab0a 100644 --- a/src/common/anidecod.cpp +++ b/src/common/anidecod.cpp @@ -14,7 +14,9 @@ #pragma hdrstop #endif -#if wxUSE_STREAMS && wxUSE_GIF +#if wxUSE_STREAMS && wxUSE_ICO_CUR + +#include "wx/anidecod.h" #ifndef WX_PRECOMP #include "wx/palette.h" @@ -22,13 +24,10 @@ #include #include -#include "wx/anidecod.h" // static wxCURHandler wxANIDecoder::sm_handler; - - //--------------------------------------------------------------------------- // wxANIFrameInfo //--------------------------------------------------------------------------- @@ -36,20 +35,18 @@ wxCURHandler wxANIDecoder::sm_handler; class wxANIFrameInfo { public: - wxANIFrameInfo(size_t delay = 0, int idx = -1) + wxANIFrameInfo(unsigned int delay = 0, int idx = -1) { m_delay=delay; m_imageIndex=idx; } - size_t m_delay; + unsigned int m_delay; int m_imageIndex; }; -#include // this is a magic incantation which must be done! -WX_DEFINE_OBJARRAY(wxImageArray); - -#include // this is a magic incantation which must be done! -WX_DEFINE_OBJARRAY(wxANIFrameInfoArray); - +#include "wx/arrimpl.cpp" // this is a magic incantation which must be done! +WX_DEFINE_OBJARRAY(wxImageArray) +#include "wx/arrimpl.cpp" // this is a magic incantation which must be done! +WX_DEFINE_OBJARRAY(wxANIFrameInfoArray) //--------------------------------------------------------------------------- @@ -64,9 +61,9 @@ wxANIDecoder::~wxANIDecoder() { } -bool wxANIDecoder::ConvertToImage(size_t frame, wxImage *image) const +bool wxANIDecoder::ConvertToImage(unsigned int frame, wxImage *image) const { - size_t idx = m_info[frame].m_imageIndex; + unsigned int idx = m_info[frame].m_imageIndex; *image = m_images[idx]; // copy return image->IsOk(); } @@ -76,29 +73,41 @@ bool wxANIDecoder::ConvertToImage(size_t frame, wxImage *image) const // Data accessors //--------------------------------------------------------------------------- -wxSize wxANIDecoder::GetFrameSize(size_t WXUNUSED(frame)) const +wxSize wxANIDecoder::GetFrameSize(unsigned int WXUNUSED(frame)) const { // all frames are of the same size... return m_szAnimation; } -wxPoint wxANIDecoder::GetFramePosition(size_t WXUNUSED(frame)) const +wxPoint wxANIDecoder::GetFramePosition(unsigned int WXUNUSED(frame)) const { // all frames are of the same size... return wxPoint(0,0); } -wxAnimationDisposal wxANIDecoder::GetDisposalMethod(size_t WXUNUSED(frame)) const +wxAnimationDisposal wxANIDecoder::GetDisposalMethod(unsigned int WXUNUSED(frame)) const { // this disposal is implicit for all frames inside an ANI file return wxANIM_TOBACKGROUND; } -long wxANIDecoder::GetDelay(size_t frame) const +long wxANIDecoder::GetDelay(unsigned int frame) const { return m_info[frame].m_delay; } +wxColour wxANIDecoder::GetTransparentColour(unsigned int frame) const +{ + unsigned int idx = m_info[frame].m_imageIndex; + + if (!m_images[idx].HasMask()) + return wxNullColour; + + return wxColour(m_images[idx].GetMaskRed(), + m_images[idx].GetMaskGreen(), + m_images[idx].GetMaskBlue()); +} + //--------------------------------------------------------------------------- // ANI reading and decoding @@ -196,7 +205,7 @@ bool wxANIDecoder::Load( wxInputStream& stream ) { wxInt32 FCC1, FCC2; wxUint32 datalen; - size_t globaldelay=0; + unsigned int globaldelay=0; wxInt32 riff32; memcpy( &riff32, "RIFF", 4 ); @@ -269,7 +278,7 @@ bool wxANIDecoder::Load( wxInputStream& stream ) return false; // rate chunks should always be placed after anih chunk wxASSERT(m_info.GetCount() == m_nFrames); - for (size_t i=0; i