Remove redundant checks for IsOk() in wxAnimationGenericImpl
We already check that IsOk() returns true before calling these methods, there is no need to do it again inside them. Generally speaking, private functions may rely on public ones doing the precondition checking.
This commit is contained in:
@@ -50,22 +50,16 @@ bool wxAnimationGenericImpl::IsCompatibleWith(wxClassInfo* ci) const
|
|||||||
|
|
||||||
wxSize wxAnimationGenericImpl::GetSize() const
|
wxSize wxAnimationGenericImpl::GetSize() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") );
|
|
||||||
|
|
||||||
return m_decoder->GetAnimationSize();
|
return m_decoder->GetAnimationSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int wxAnimationGenericImpl::GetFrameCount() const
|
unsigned int wxAnimationGenericImpl::GetFrameCount() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
|
|
||||||
|
|
||||||
return m_decoder->GetFrameCount();
|
return m_decoder->GetFrameCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxImage wxAnimationGenericImpl::GetFrame(unsigned int i) const
|
wxImage wxAnimationGenericImpl::GetFrame(unsigned int i) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxNullImage, wxT("invalid animation") );
|
|
||||||
|
|
||||||
wxImage ret;
|
wxImage ret;
|
||||||
if (!m_decoder->ConvertToImage(i, &ret))
|
if (!m_decoder->ConvertToImage(i, &ret))
|
||||||
return wxNullImage;
|
return wxNullImage;
|
||||||
@@ -74,43 +68,31 @@ wxImage wxAnimationGenericImpl::GetFrame(unsigned int i) const
|
|||||||
|
|
||||||
int wxAnimationGenericImpl::GetDelay(unsigned int i) const
|
int wxAnimationGenericImpl::GetDelay(unsigned int i) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), 0, wxT("invalid animation") );
|
|
||||||
|
|
||||||
return m_decoder->GetDelay(i);
|
return m_decoder->GetDelay(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint wxAnimationGenericImpl::GetFramePosition(unsigned int frame) const
|
wxPoint wxAnimationGenericImpl::GetFramePosition(unsigned int frame) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxDefaultPosition, wxT("invalid animation") );
|
|
||||||
|
|
||||||
return m_decoder->GetFramePosition(frame);
|
return m_decoder->GetFramePosition(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxAnimationGenericImpl::GetFrameSize(unsigned int frame) const
|
wxSize wxAnimationGenericImpl::GetFrameSize(unsigned int frame) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxDefaultSize, wxT("invalid animation") );
|
|
||||||
|
|
||||||
return m_decoder->GetFrameSize(frame);
|
return m_decoder->GetFrameSize(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxAnimationDisposal wxAnimationGenericImpl::GetDisposalMethod(unsigned int frame) const
|
wxAnimationDisposal wxAnimationGenericImpl::GetDisposalMethod(unsigned int frame) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxANIM_UNSPECIFIED, wxT("invalid animation") );
|
|
||||||
|
|
||||||
return m_decoder->GetDisposalMethod(frame);
|
return m_decoder->GetDisposalMethod(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxAnimationGenericImpl::GetTransparentColour(unsigned int frame) const
|
wxColour wxAnimationGenericImpl::GetTransparentColour(unsigned int frame) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") );
|
|
||||||
|
|
||||||
return m_decoder->GetTransparentColour(frame);
|
return m_decoder->GetTransparentColour(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxAnimationGenericImpl::GetBackgroundColour() const
|
wxColour wxAnimationGenericImpl::GetBackgroundColour() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( IsOk(), wxNullColour, wxT("invalid animation") );
|
|
||||||
|
|
||||||
return m_decoder->GetBackgroundColour();
|
return m_decoder->GetBackgroundColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user