BOOL ON_Hatch::Transform( const ON_Xform& xform) { if( fabs( fabs( xform.Determinant()) - 1.0) > 1.0e-4) { // xform has a scale component ON_Plane tmp( m_plane); tmp.Transform( xform); ON_Xform A, B, T; A.Rotation( ON_xy_plane, m_plane); B.Rotation( tmp, ON_xy_plane); T = B * xform * A; // kill translation and z-scaling T[0][2] = T[0][3] = 0.0; T[1][2] = T[1][3] = 0.0; T[2][0] = T[2][1] = 0.0; T[2][2] = 1.0; T[2][3] = 0.0; T[3][0] = T[3][1] = T[3][2] = 0.0; T[3][3] = 1.0; for( int i = 0; i < LoopCount(); i++) m_loops[i]->m_p2dCurve->Transform( T); } int rc = m_plane.Transform( xform); return rc; }
bool vgmstreamPreferences::HasChanged() { if(IsDlgButtonChecked(IDC_LOOP_FOREVER)) if(cfg_LoopForever != true) return true; if(IsDlgButtonChecked(IDC_IGNORE_LOOP)) if(cfg_IgnoreLoop != true) return true; if(IsDlgButtonChecked(IDC_LOOP_NORMALLY)) if(cfg_IgnoreLoop != false || cfg_LoopForever != false) return true; bool current_cfg_DisableSubsongs = IsDlgButtonChecked(IDC_DISABLE_SUBSONGS)?true:false; if(cfg_DisableSubsongs != current_cfg_DisableSubsongs) return true; bool current_cfg_TagfileDisable = IsDlgButtonChecked(IDC_TAGFILE_DISABLE)?true:false; if(cfg_TagfileDisable != current_cfg_TagfileDisable) return true; bool current_cfg_OverrideTitle = IsDlgButtonChecked(IDC_OVERRIDE_TITLE)?true:false; if(cfg_OverrideTitle != current_cfg_OverrideTitle) return true; pfc::string FadeLength(cfg_FadeLength); pfc::string FadeDelay(cfg_FadeDelay); pfc::string LoopCount(cfg_LoopCount); if(FadeLength != uGetDlgItemText(m_hWnd, IDC_FADE_SECONDS)) return true; if(FadeDelay != uGetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS)) return true; if(LoopCount != uGetDlgItemText(m_hWnd, IDC_LOOP_COUNT)) return true; pfc::string DownmixChannels(cfg_DownmixChannels); if(DownmixChannels != uGetDlgItemText(m_hWnd, IDC_DOWNMIX_CHANNELS)) return true; return FALSE; }
bool vgmstreamPreferences::HasChanged() { if(IsDlgButtonChecked(IDC_LOOP_FOREVER)) if(cfg_LoopForever != true) return true; if(IsDlgButtonChecked(IDC_IGNORE_LOOP)) if(cfg_IgnoreLoop != true) return true; if(IsDlgButtonChecked(IDC_LOOP_NORMALLY)) if(cfg_IgnoreLoop != false || cfg_LoopForever != false) return true; pfc::string FadeLength(cfg_FadeLength); pfc::string FadeDelay(cfg_FadeDelay); pfc::string LoopCount(cfg_LoopCount); if(FadeLength != uGetDlgItemText(m_hWnd, IDC_FADE_SECONDS)) return true; if(FadeDelay != uGetDlgItemText(m_hWnd, IDC_FADE_DELAY_SECONDS)) return true; if(LoopCount != uGetDlgItemText(m_hWnd, IDC_LOOP_COUNT)) return true; return FALSE; }
FrameAnimator::RefreshResult FrameAnimator::AdvanceFrame(TimeStamp aTime) { NS_ASSERTION(aTime <= TimeStamp::Now(), "Given time appears to be in the future"); PROFILER_LABEL_FUNC(js::ProfileEntry::Category::GRAPHICS); RefreshResult ret; // Determine what the next frame is, taking into account looping. uint32_t currentFrameIndex = mCurrentAnimationFrameIndex; uint32_t nextFrameIndex = currentFrameIndex + 1; if (mImage->GetNumFrames() == nextFrameIndex) { // We can only accurately determine if we are at the end of the loop if we are // done decoding, otherwise we don't know how many frames there will be. if (!mDoneDecoding) { // We've already advanced to the last decoded frame, nothing more we can do. // We're blocked by network/decoding from displaying the animation at the // rate specified, so that means the frame we are displaying (the latest // available) is the frame we want to be displaying at this time. So we // update the current animation time. If we didn't update the current // animation time then it could lag behind, which would indicate that we // are behind in the animation and should try to catch up. When we are // done decoding (and thus can loop around back to the start of the // animation) we would then jump to a random point in the animation to // try to catch up. But we were never behind in the animation. mCurrentAnimationFrameTime = aTime; return ret; } // End of an animation loop... // If we are not looping forever, initialize the loop counter if (mLoopRemainingCount < 0 && LoopCount() >= 0) { mLoopRemainingCount = LoopCount(); } // If animation mode is "loop once", or we're at end of loop counter, // it's time to stop animating. if (mAnimationMode == imgIContainer::kLoopOnceAnimMode || mLoopRemainingCount == 0) { ret.animationFinished = true; } nextFrameIndex = 0; if (mLoopRemainingCount > 0) { mLoopRemainingCount--; } // If we're done, exit early. if (ret.animationFinished) { return ret; } } // There can be frames in the surface cache with index >= mImage->GetNumFrames() // that GetRawFrame can access because the decoding thread has decoded them, but // RasterImage hasn't acknowledged those frames yet. We don't want to go past // what RasterImage knows about so that we stay in sync with RasterImage. The code // above should obey this, the MOZ_ASSERT records this invariant. MOZ_ASSERT(nextFrameIndex < mImage->GetNumFrames()); RawAccessFrameRef nextFrame = GetRawFrame(nextFrameIndex); // If we're done decoding, we know we've got everything we're going to get. // If we aren't, we only display fully-downloaded frames; everything else // gets delayed. bool canDisplay = mDoneDecoding || (nextFrame && nextFrame->IsFinished()); if (!canDisplay) { // Uh oh, the frame we want to show is currently being decoded (partial) // Wait until the next refresh driver tick and try again return ret; } // Bad data if (GetTimeoutForFrame(nextFrameIndex) < 0) { ret.animationFinished = true; ret.error = true; } if (nextFrameIndex == 0) { ret.dirtyRect = mFirstFrameRefreshArea; } else { MOZ_ASSERT(nextFrameIndex == currentFrameIndex + 1); // Change frame if (!DoBlend(&ret.dirtyRect, currentFrameIndex, nextFrameIndex)) { // something went wrong, move on to next NS_WARNING("FrameAnimator::AdvanceFrame(): Compositing of frame failed"); nextFrame->SetCompositingFailed(true); mCurrentAnimationFrameTime = GetCurrentImgFrameEndTime(); mCurrentAnimationFrameIndex = nextFrameIndex; ret.error = true; return ret; } nextFrame->SetCompositingFailed(false); } mCurrentAnimationFrameTime = GetCurrentImgFrameEndTime(); // If we can get closer to the current time by a multiple of the image's loop // time, we should. We need to be done decoding in order to know the full loop // time though! int32_t loopTime = GetSingleLoopTime(); if (loopTime > 0) { // We shouldn't be advancing by a whole loop unless we are decoded and know // what a full loop actually is. GetSingleLoopTime should return -1 so this // never happens. MOZ_ASSERT(mDoneDecoding); TimeDuration delay = aTime - mCurrentAnimationFrameTime; if (delay.ToMilliseconds() > loopTime) { // Explicitly use integer division to get the floor of the number of // loops. uint64_t loops = static_cast<uint64_t>(delay.ToMilliseconds()) / loopTime; mCurrentAnimationFrameTime += TimeDuration::FromMilliseconds(loops * loopTime); } } // Set currentAnimationFrameIndex at the last possible moment mCurrentAnimationFrameIndex = nextFrameIndex; // If we're here, we successfully advanced the frame. ret.frameAdvanced = true; return ret; }