git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41844
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
class wxANIFrameInfo
{
public:
class wxANIFrameInfo
{
public:
- wxANIFrameInfo(size_t delay = 0, int idx = -1)
+ wxANIFrameInfo(size_t delay = 0, int idx = -1)
{ m_delay=delay; m_imageIndex=idx; }
size_t m_delay;
{ m_delay=delay; m_imageIndex=idx; }
size_t m_delay;
{
size_t idx = m_info[frame].m_imageIndex;
*image = m_images[idx]; // copy
{
size_t idx = m_info[frame].m_imageIndex;
*image = m_images[idx]; // copy
// we always have a data size:
stream.Read(&datalen, 4);
datalen = wxINT32_SWAP_ON_BE(datalen) ;
// we always have a data size:
stream.Read(&datalen, 4);
datalen = wxINT32_SWAP_ON_BE(datalen) ;
// data should be padded to make even number of bytes
if (datalen % 2 == 1) datalen ++ ;
// data should be padded to make even number of bytes
if (datalen % 2 == 1) datalen ++ ;
}
// the "anih" RIFF chunk
}
// the "anih" RIFF chunk
{
wxInt32 cbSizeOf; // Num bytes in AniHeader (36 bytes)
wxInt32 cFrames; // Number of unique Icons in this cursor
{
wxInt32 cbSizeOf; // Num bytes in AniHeader (36 bytes)
wxInt32 cFrames; // Number of unique Icons in this cursor
// save interesting info from the header
m_nFrames = header.cSteps; // NB: not cFrames!!
// save interesting info from the header
m_nFrames = header.cSteps; // NB: not cFrames!!
return false;
globaldelay = wxINT32_SWAP_ON_BE(header.JifRate) * 1000 / 60;
return false;
globaldelay = wxINT32_SWAP_ON_BE(header.JifRate) * 1000 / 60;
// did we already process the anih32 chunk?
if (m_nFrames == 0)
return false; // rate chunks should always be placed after anih chunk
// did we already process the anih32 chunk?
if (m_nFrames == 0)
return false; // rate chunks should always be placed after anih chunk
wxASSERT(m_info.GetCount() == m_nFrames);
for (size_t i=0; i<m_nFrames; i++)
{
wxASSERT(m_info.GetCount() == m_nFrames);
for (size_t i=0; i<m_nFrames; i++)
{
bool wxAnimation::LoadFile(const wxString& filename, wxAnimationType type)
{
wxFileInputStream stream(filename);
bool wxAnimation::LoadFile(const wxString& filename, wxAnimationType type)
{
wxFileInputStream stream(filename);
return false;
return Load(stream, type);
return false;
return Load(stream, type);
const wxAnimationDecoder *handler;
if ( type == wxANIMATION_TYPE_ANY )
{
const wxAnimationDecoder *handler;
if ( type == wxANIMATION_TYPE_ANY )
{
- for ( wxAnimationDecoderList::compatibility_iterator node = sm_handlers.GetFirst();
+ for ( wxAnimationDecoderList::compatibility_iterator node = sm_handlers.GetFirst();
node; node = node->GetNext() )
{
handler=(const wxAnimationDecoder*)node->GetData();
node; node = node->GetNext() )
{
handler=(const wxAnimationDecoder*)node->GetData();
bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type)
{
wxAnimation anim;
bool wxAnimationCtrl::LoadFile(const wxString& filename, wxAnimationType type)
{
wxAnimation anim;
- if (!anim.LoadFile(filename, type) ||
+ if (!anim.LoadFile(filename, type) ||
!anim.IsOk())
return false;
!anim.IsOk())
return false;
RebuildBackingStoreUpToFrame(0);
else
{
RebuildBackingStoreUpToFrame(0);
else
{
wxMemoryDC dc;
dc.SelectObject(m_backingStore);
wxMemoryDC dc;
dc.SelectObject(m_backingStore);
int w = wxMin(sz.GetWidth(), winsz.GetWidth());
int h = wxMin(sz.GetHeight(), winsz.GetHeight());
int w = wxMin(sz.GetWidth(), winsz.GetWidth());
int h = wxMin(sz.GetHeight(), winsz.GetHeight());
- if ( !m_backingStore.Ok() ||
+ if ( !m_backingStore.IsOk() ||
m_backingStore.GetWidth() < w || m_backingStore.GetHeight() < h )
{
m_backingStore.Create(w, h);
m_backingStore.GetWidth() < w || m_backingStore.GetHeight() < h )
{
m_backingStore.Create(w, h);
case wxANIM_TOPREVIOUS:
// this disposal should never be used too often.
// E.g. GIF specification explicitely say to keep the usage of this
case wxANIM_TOPREVIOUS:
// this disposal should never be used too often.
// E.g. GIF specification explicitely say to keep the usage of this
- // disposal limited to the minimum.
- // In fact it may require a lot of time to restore
+ // disposal limited to the minimum.
+ // In fact it may require a lot of time to restore
if (m_currentFrame == 1)
{
// if 0-th frame disposal is to restore to previous frame,
if (m_currentFrame == 1)
{
// if 0-th frame disposal is to restore to previous frame,
void wxAnimationCtrl::DrawCurrentFrame(wxDC& dc)
{
void wxAnimationCtrl::DrawCurrentFrame(wxDC& dc)
{
- wxASSERT(m_backingStore.Ok());
+ wxASSERT( m_backingStore.IsOk() );
// m_backingStore always contains the current frame
dc.DrawBitmap(m_backingStore, 0, 0);
// m_backingStore always contains the current frame
dc.DrawBitmap(m_backingStore, 0, 0);
void wxAnimationCtrl::DisposeToBackground(wxDC& dc)
{
void wxAnimationCtrl::DisposeToBackground(wxDC& dc)
{
- wxBrush brush(IsUsingWindowBackgroundColour() ?
- this->GetBackgroundColour() : m_animation.GetBackgroundColour(), wxSOLID);
+ wxBrush brush(IsUsingWindowBackgroundColour()
+ ? GetBackgroundColour()
+ : m_animation.GetBackgroundColour());
dc.SetBackground(brush);
dc.Clear();
}
dc.SetBackground(brush);
dc.Clear();
}
wxPaintDC dc(this);
// both if we are playing or not, we need to refresh the current frame
wxPaintDC dc(this);
// both if we are playing or not, we need to refresh the current frame
- if (m_backingStore.Ok())
+ if ( m_backingStore.IsOk() )
DrawCurrentFrame(dc);
//else: m_animation is not valid and thus we don't have a valid backing store...
}
DrawCurrentFrame(dc);
//else: m_animation is not valid and thus we don't have a valid backing store...
}