void wxSVGAnimateTransformElement::ApplyAnimation() { wxSVGElement* targetElement = GetTargetElement(); if (targetElement == NULL || GetDur() <= 0 || (GetTo().GetPropertyType() != wxSVG_ANIMATED_LENGTH && GetTo().GetPropertyType() != wxSVG_ANIMATED_LENGTH_LIST)) return; wxSVGLengthList values; if (GetCurrentTime() >= GetStartTime() + GetDur()) { if (GetTo().GetPropertyType() == wxSVG_ANIMATED_LENGTH) { values.push_back(GetTo().GetLength()); } else { values = GetTo().GetLengthList(); } } else if (GetCurrentTime() >= GetStartTime() && GetFrom().GetPropertyType() == GetTo().GetPropertyType() && GetFrom().GetLengthList().size() == GetTo().GetLengthList().size()) { if (GetTo().GetPropertyType() == wxSVG_ANIMATED_LENGTH) { values.Add(wxSVGLength(GetTo().GetLength().GetUnitType(), GetFrom().GetLength().GetValue() + (GetTo().GetLength().GetValue() - GetFrom().GetLength().GetValue())* (GetCurrentTime() - GetStartTime())/GetDur())); } else { for (unsigned int i = 0; i < GetFrom().GetLengthList().size(); i++) { const wxSVGLength& from = GetFrom().GetLengthList()[i]; const wxSVGLength& to = GetTo().GetLengthList()[i]; values.Add(wxSVGLength(to.GetUnitType(), from.GetValue() + (to.GetValue() - from.GetValue())*(GetCurrentTime() - GetStartTime())/GetDur())); } } } else { return; } wxSVGTransformable* transformable = wxSVGTransformable::GetSVGTransformable(*targetElement); if (transformable != NULL) { if (m_transformIdx == -1 || m_transformIdx >= (int) transformable->GetTransformList().GetAnimVal().size()) { wxSVGTransformList& transforms = transformable->GetTransformList().GetAnimVal(); if (GetAdditive() != wxSVG_ANIMATION_ADDITIVE_SUM) { transforms.Clear(); } wxSVGTransform* transform = new wxSVGTransform(); UpdateTransform(*transform, GetType(), values); transforms.Add(transform); m_transformIdx = transforms.size() - 1; } else { UpdateTransform(transformable->GetTransformList().GetAnimVal()[m_transformIdx], GetType(), values); } } else { wxSVGTransformList transforms; wxSVGTransform* transform = new wxSVGTransform(); UpdateTransform(*transform, GetType(), values); transforms.Add(transform); targetElement->SetAnimatedValue(GetAttributeName(), wxSVGAnimatedType(transforms)); } }
double wxSVGVideoElement::GetDuration(wxProgressDialog* progressDlg) { if (GetDur() > 0) return GetDur(); if (GetClipEnd() > 0) return GetClipEnd() > GetClipBegin() ? GetClipEnd() - GetClipBegin() : 0; if (m_canvasItem == NULL) m_canvasItem = ((wxSVGDocument*) GetOwnerDocument())->GetCanvas()->CreateItem(this, NULL, progressDlg); double duration = ((wxSVGCanvasVideo*) m_canvasItem)->GetDuration(); if (!((wxSVGDocument*) GetOwnerDocument())->GetCanvas()->IsItemsCached()) { delete m_canvasItem; m_canvasItem = NULL; } if (GetClipBegin() > 0) duration = duration > GetClipBegin() ? duration - GetClipBegin() : 0; return duration; }
void cPlayer::Send_PlayerInfo() { MyPlayerInfoAq* pInfo = (MyPlayerInfoAq*)PrepareSendPacket( sizeof( MyPlayerInfoAq ) ); if( NULL == pInfo ) return; pInfo->s_sType = MyPlayerInfo_Aq; pInfo->s_byDur = GetDur(); pInfo->s_byLevel = GetLevel(); pInfo->s_byStr = GetStr(); pInfo->s_dwExp = GetExp(); pInfo->s_dwHp = GetHp(); pInfo->s_dwPKey = GetPKey(); pInfo->s_dwPos = GetPos(); strncpy( pInfo->s_szId , GetId() , MAX_ID_LENGTH ); strncpy( pInfo->s_szName , GetName() , MAX_NAME_LENGTH ); strncpy( pInfo->s_szNickName , GetNickName() , MAX_NICKNAME_LENGTH ); SendPost( sizeof( MyPlayerInfoAq ) ); }