void UAnimInstance::EvaluateAnimation(FPoseContext& Output) { // If bone caches have been invalidated, have AnimNodes refresh those. if( bBoneCachesInvalidated && RootNode ) { bBoneCachesInvalidated = false; IncrementContextCounter(); FAnimationCacheBonesContext UpdateContext(this); RootNode->CacheBones(UpdateContext); } // Evaluate native code if implemented, otherwise evaluate the node graph if (!NativeEvaluateAnimation(Output)) { if (RootNode != NULL) { SCOPE_CYCLE_COUNTER(STAT_AnimGraphEvaluate); RootNode->Evaluate(Output); } else { Output.ResetToRefPose(); } } }
void wxGLCanvas::MacUpdateView() { if (m_glContext) { UpdateContext(); m_glContext->SetCurrent(); SetViewport(); } }
void ProcessEvent(PSEvent* event) { switch(event->type) { /* If the view updates, build a new Graphics 2D Context */ case PSE_INSTANCE_DIDCHANGEVIEW: { struct PP_Rect rect; g_pView->GetRect(event->as_resource, &rect); UpdateContext(rect.size.width, rect.size.height); break; } case PSE_INSTANCE_HANDLEINPUT: { PP_InputEvent_Type type = g_pInputEvent->GetType(event->as_resource); PP_InputEvent_Modifier modifiers = g_pInputEvent->GetModifiers(event->as_resource); switch(type) { case PP_INPUTEVENT_TYPE_MOUSEDOWN: { struct PP_Point location = g_pMouseInput->GetPosition(event->as_resource); DrawCell(location.x, location.y); break; } case PP_INPUTEVENT_TYPE_MOUSEMOVE: { struct PP_Point location = g_pMouseInput->GetPosition(event->as_resource); /* If the button is down, draw */ if (modifiers & PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN) { DrawCell(location.x, location.y); } break; } case PP_INPUTEVENT_TYPE_KEYDOWN: { PP_Bool fullscreen = g_pFullscreen->IsFullscreen(PSGetInstanceId()); g_pFullscreen->SetFullscreen(PSGetInstanceId(), fullscreen ? PP_FALSE : PP_TRUE); break; } default: break; } /* case PSE_INSTANCE_HANDLEINPUT */ break; } default: break; } }
void InteractiveMarkerServer::insert( const visualization_msgs::InteractiveMarker &int_marker ) { boost::recursive_mutex::scoped_lock lock( mutex_ ); M_UpdateContext::iterator update_it = pending_updates_.find( int_marker.name ); if ( update_it == pending_updates_.end() ) { update_it = pending_updates_.insert( std::make_pair( int_marker.name, UpdateContext() ) ).first; } update_it->second.update_type = UpdateContext::FULL_UPDATE; update_it->second.int_marker = int_marker; }
void CDebugger::PrintCallStack(DWORD dwThreadId, DWORD dwProcessId) { STACKFRAME64 stackFrame = { 0 }; const DWORD_PTR dwMaxFrames = 50; UpdateContext(dwThreadId); stackFrame.AddrPC.Mode = AddrModeFlat; stackFrame.AddrFrame.Mode = AddrModeFlat; stackFrame.AddrStack.Mode = AddrModeFlat; DWORD dwMachineType = IMAGE_FILE_MACHINE_I386; stackFrame.AddrPC.Offset = m_context.Eip; stackFrame.AddrFrame.Offset = m_context.Ebp; stackFrame.AddrStack.Offset = m_context.Esp; HANDLE hThread = OpenThread(THREAD_GET_CONTEXT | THREAD_SET_CONTEXT | THREAD_QUERY_INFORMATION, FALSE, dwThreadId); HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId); m_pSymbols->RefreshSymbols(hProcess); // Print call stack stringstream ssCallStack; for (int i = 0; i < dwMaxFrames; ++i) { bool bSuccess = StackWalk64(dwMachineType, hProcess, hThread, &stackFrame, (dwMachineType == IMAGE_FILE_MACHINE_I386 ? nullptr : &m_context), nullptr, SymFunctionTableAccess64, SymGetModuleBase64, nullptr); if (!bSuccess || stackFrame.AddrPC.Offset == 0) { cout << "StackWalk64 finished." << endl; break; } IMAGEHLP_MODULE64 module = {0}; module.SizeOfStruct = sizeof(module); SymGetModuleInfo64(hProcess, (DWORD64)stackFrame.AddrPC.Offset, &module); //SymLoadModuleEx(hProcess, NULL, module.LoadedImageName, NULL, module.BaseOfImage, 0, NULL, 0); //cout << "modulePath: " << module.LoadedImageName << ", baseofdll: " << module.BaseOfImage << ", symbol: " << module.LoadedPdbName << endl; PSYMBOL_INFO pSymInfo = m_pSymbols->SymbolFromAddress(stackFrame.AddrPC.Offset); if (pSymInfo) { ssCallStack << "#" << dec << i << " " << module.ModuleName << "!" << pSymInfo->Name << endl; } else { ssCallStack << "#" << dec << i << " " << module.ModuleName << "!" << "unknown" << endl; } delete pSymInfo; } m_pCrash->GetHash(ssCallStack.str()); m_pCrash->AddLog("\nCall Stack\n" + ssCallStack.str()); }
void InteractiveMarkerServer::doSetPose( M_UpdateContext::iterator update_it, const std::string &name, const geometry_msgs::Pose &pose, const std_msgs::Header &header ) { if ( update_it == pending_updates_.end() ) { update_it = pending_updates_.insert( std::make_pair( name, UpdateContext() ) ).first; update_it->second.update_type = UpdateContext::POSE_UPDATE; } else if ( update_it->second.update_type != UpdateContext::FULL_UPDATE ) { update_it->second.update_type = UpdateContext::POSE_UPDATE; } update_it->second.int_marker.pose = pose; update_it->second.int_marker.header = header; ROS_DEBUG( "Marker '%s' is now at %f, %f, %f", update_it->first.c_str(), pose.position.x, pose.position.y, pose.position.z ); }
already_AddRefed<nsISupports> CanvasRenderingContextHelper::GetContext(JSContext* aCx, const nsAString& aContextId, JS::Handle<JS::Value> aContextOptions, ErrorResult& aRv) { CanvasContextType contextType; if (!CanvasUtils::GetCanvasContextType(aContextId, &contextType)) return nullptr; if (!mCurrentContext) { // This canvas doesn't have a context yet. RefPtr<nsICanvasRenderingContextInternal> context; context = CreateContext(contextType); if (!context) { return nullptr; } // Ensure that the context participates in CC. Note that returning a // CC participant from QI doesn't addref. nsXPCOMCycleCollectionParticipant* cp = nullptr; CallQueryInterface(context, &cp); if (!cp) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } mCurrentContext = context.forget(); mCurrentContextType = contextType; nsresult rv = UpdateContext(aCx, aContextOptions, aRv); if (NS_FAILED(rv)) { // See bug 645792 and bug 1215072. // We want to throw only if dictionary initialization fails, // so only in case aRv has been set to some error value. return nullptr; } } else { // We already have a context of some type. if (contextType != mCurrentContextType) return nullptr; } nsCOMPtr<nsICanvasRenderingContextInternal> context = mCurrentContext; return context.forget(); }
void CDebugger::PrintContext(DWORD dwThreadId) { stringstream ssContext; UpdateContext(dwThreadId); ssContext << uppercase << hex << "eax = 0x" << setfill('0') << setw(8) << m_context.Eax << " \nebx = 0x" << setfill('0') << setw(8) << m_context.Ebx << " \necx = 0x" << setfill('0') << setw(8) << m_context.Ecx << " \nedx = 0x" << setfill('0') << setw(8) << m_context.Edx << " \nesp = 0x" << setfill('0') << setw(8) << m_context.Esp << " \nebp = 0x" << setfill('0') << setw(8) << m_context.Ebp << " \nesi = 0x" << setfill('0') << setw(8) << m_context.Esi << " \nedi = 0x" << setfill('0') << setw(8) << m_context.Edi << " \neip = 0x" << setfill('0') << setw(8) << m_context.Eip << " " << endl; m_pCrash->AddLog("\nRegisters:\n" + ssContext.str()); }
void ScriptManager::UpdateContext(QScriptValue object) { UpdateContext(object.engine()); }
void UAnimInstance::UpdateAnimation(float DeltaSeconds) { #if WITH_EDITORONLY_DATA if (GIsEditor) { // Reset the anim graph visualization if (RootNode != NULL) { if (UAnimBlueprintGeneratedClass* AnimBlueprintClass = Cast<UAnimBlueprintGeneratedClass>(GetClass())) { UAnimBlueprint* AnimBP = CastChecked<UAnimBlueprint>(AnimBlueprintClass->ClassGeneratedBy); if (AnimBP->GetObjectBeingDebugged() == this) { AnimBlueprintClass->GetAnimBlueprintDebugData().ResetNodeVisitSites(); } } } // Update the lifetimer and see if we should use the snapshot instead CurrentLifeTimerScrubPosition += DeltaSeconds; LifeTimer = FMath::Max<double>(CurrentLifeTimerScrubPosition, LifeTimer); if (UpdateSnapshotAndSkipRemainingUpdate()) { return; } } #endif AnimNotifies.Empty(); MorphTargetCurves.Empty(); ClearSlotNodeWeights(); //Track material params we set last time round so we can clear them if they aren't set again. MaterialParamatersToClear.Empty(); for( auto Iter = MaterialParameterCurves.CreateConstIterator(); Iter; ++Iter ) { if(Iter.Value() > 0.0f) { MaterialParamatersToClear.Add(Iter.Key()); } } MaterialParameterCurves.Empty(); VertexAnims.Empty(); // Reset the player tick list (but keep it presized) UngroupedActivePlayers.Empty(UngroupedActivePlayers.Num()); for (int32 GroupIndex = 0; GroupIndex < SyncGroups.Num(); ++GroupIndex) { SyncGroups[GroupIndex].Reset(); } NativeUpdateAnimation(DeltaSeconds); BlueprintUpdateAnimation(DeltaSeconds); // update weight before all nodes update comes in Montage_UpdateWeight(DeltaSeconds); // Update the anim graph if (RootNode != NULL) { IncrementContextCounter(); FAnimationUpdateContext UpdateContext(this, DeltaSeconds); RootNode->Update(UpdateContext); } // curve values can be used during update state, so we need to clear the array before ticking each elements // where we collect new items EventCurves.Empty(); // Handle all players inside sync groups for (int32 GroupIndex = 0; GroupIndex < SyncGroups.Num(); ++GroupIndex) { FAnimGroupInstance& SyncGroup = SyncGroups[GroupIndex]; if (SyncGroup.ActivePlayers.Num() > 0) { const int32 GroupLeaderIndex = FMath::Max(SyncGroup.GroupLeaderIndex, 0); // Tick the group leader FAnimAssetTickContext TickContext(DeltaSeconds); FAnimTickRecord& GroupLeader = SyncGroup.ActivePlayers[GroupLeaderIndex]; GroupLeader.SourceAsset->TickAssetPlayerInstance(GroupLeader, this, TickContext); // Update everything else to follow the leader if (SyncGroup.ActivePlayers.Num() > 1) { TickContext.ConvertToFollower(); for (int32 TickIndex = 0; TickIndex < SyncGroup.ActivePlayers.Num(); ++TickIndex) { if (TickIndex != GroupLeaderIndex) { const FAnimTickRecord& AssetPlayer = SyncGroup.ActivePlayers[TickIndex]; AssetPlayer.SourceAsset->TickAssetPlayerInstance(AssetPlayer, this, TickContext); } } } } } // Handle the remaining ungrouped animation players for (int32 TickIndex = 0; TickIndex < UngroupedActivePlayers.Num(); ++TickIndex) { const FAnimTickRecord& AssetPlayerToTick = UngroupedActivePlayers[TickIndex]; FAnimAssetTickContext TickContext(DeltaSeconds); AssetPlayerToTick.SourceAsset->TickAssetPlayerInstance(AssetPlayerToTick, this, TickContext); } // update montage should run in game thread // if we do multi threading, make sure this stays in game thread Montage_Advance(DeltaSeconds); // now trigger Notifies TriggerAnimNotifies(DeltaSeconds); // Add 0.0 curves to clear parameters that we have previously set but didn't set this tick. // - Make a copy of MaterialParametersToClear as it will be modified by AddCurveValue TArray<FName> ParamsToClearCopy = MaterialParamatersToClear; for (int i = 0; i < ParamsToClearCopy.Num(); ++i) { AddCurveValue(ParamsToClearCopy[i], 0.0f, ACF_DrivesMaterial); } #if WITH_EDITOR && 0 { // Take a snapshot if the scrub control is locked to the end, we are playing, and we are the one being debugged if (UAnimBlueprintGeneratedClass* AnimBlueprintClass = Cast<UAnimBlueprintGeneratedClass>(GetClass())) { if (UAnimBlueprint* Blueprint = Cast<UAnimBlueprint>(AnimBlueprintClass->ClassGeneratedBy)) { if (Blueprint->GetObjectBeingDebugged() == this) { if ((CurrentLifeTimerScrubPosition == LifeTimer) && (DeltaSeconds > 0.0f)) { AnimBlueprintClass->GetAnimBlueprintDebugData().TakeSnapshot(this); } } } } } #endif }
/// SingleComponentLSScan::ParseMCU // Parse a single MCU in this scan. Return true if there are more // MCUs in this row. bool SingleComponentLSScan::ParseMCU(void) { #if ACCUSOFT_CODE int lines = m_ulRemaining[0]; // total number of MCU lines processed. UBYTE preshift = m_ucLowBit + FractionalColorBitsOf(); struct Line *line = CurrentLine(0); // // If a DNL marker is present, the number of remaining lines is zero. Fix it. if (m_pFrame->HeightOf() == 0) { assert(lines == 0); lines = 8; } assert(m_ucCount == 1); // // A "MCU" in respect to the code organization is eight lines. if (lines > 8) { lines = 8; } if (m_pFrame->HeightOf() > 0) m_ulRemaining[0] -= lines; assert(lines > 0); // Loop over lines and columns do { LONG length = m_ulWidth[0]; LONG *lp = line->m_pData; #ifdef DEBUG_LS int xpos = 0; static int linenumber = 0; printf("\n%4d : ",++linenumber); #endif StartLine(0); if (BeginReadMCU(m_Stream.ByteStreamOf())) { // No error handling strategy. No RST in scans. Bummer! do { LONG a,b,c,d; // neighbouring values. LONG d1,d2,d3; // local gradients. GetContext(0,a,b,c,d); d1 = d - b; // compute local gradients d2 = b - c; d3 = c - a; if (isRunMode(d1,d2,d3)) { LONG run = DecodeRun(length,m_lRunIndex[0]); // // Now fill the data. while(run) { // Update so that the next process gets the correct value. UpdateContext(0,a); // And insert the value into the target line as well. *lp++ = a << preshift; #ifdef DEBUG_LS printf("%4d:<%2x> ",xpos++,a); #endif run--,length--; // As long as there are pixels on the line. } // // More data on the line? I.e. the run did not cover the full m_lJ samples? // Now decode the run interruption sample. if (length) { bool negative; // the sign variable bool rtype; // run interruption type LONG errval; // the prediction error LONG merr; // the mapped error (symbol) LONG rx; // the reconstructed value UBYTE k; // golomb parameter // Get the neighbourhood. GetContext(0,a,b,c,d); // Get the prediction mode. rtype = InterruptedPredictionMode(negative,a,b); // Get the golomb parameter for run interruption coding. k = GolombParameter(rtype); // Golomb-decode the error symbol. merr = GolombDecode(k,m_lLimit - m_lJ[m_lRunIndex[0]] - 1); // Inverse the error mapping procedure. errval = InverseErrorMapping(merr + rtype,ErrorMappingOffset(rtype,rtype || merr,k)); // Compute the reconstructed value. rx = Reconstruct(negative,rtype?a:b,errval); // Update so that the next process gets the correct value. UpdateContext(0,rx); // Fill in the value into the line *lp = rx << preshift; #ifdef DEBUG_LS printf("%4d:<%2x> ",xpos++,*lp); #endif // Update the variables of the run mode. UpdateState(rtype,errval); // Update the run index now. This is not part of // EncodeRun because the non-reduced run-index is // required for the golomb coder length limit. if (m_lRunIndex[0] > 0) m_lRunIndex[0]--; } else break; // end of line. } else { UWORD ctxt; bool negative; // the sign variable. LONG px; // the predicted variable. LONG rx; // the reconstructed value. LONG errval; // the error value. LONG merr; // the mapped error value. UBYTE k; // the Golomb parameter. // Quantize the gradients. d1 = QuantizedGradient(d1); d2 = QuantizedGradient(d2); d3 = QuantizedGradient(d3); // Compute the context. ctxt = Context(negative,d1,d2,d3); // Compute the predicted value. px = Predict(a,b,c); // Correct the prediction. px = CorrectPrediction(ctxt,negative,px); // Compute the golomb parameter k from the context. k = GolombParameter(ctxt); // Decode the error symbol. merr = GolombDecode(k,m_lLimit); // Inverse the error symbol into an error value. errval = InverseErrorMapping(merr,ErrorMappingOffset(ctxt,k)); // Update the variables. UpdateState(ctxt,errval); // Compute the reconstructed value. rx = Reconstruct(negative,px,errval); // Update so that the next process gets the correct value. UpdateContext(0,rx); // And insert the value into the target line as well. *lp = rx << preshift; #ifdef DEBUG_LS printf("%4d:<%2x> ",xpos++,*lp); #endif } } while(++lp,--length); } // No error handling here. EndLine(0); line = line->m_pNext; } while(--lines); // // If this is the last line, gobble up all the // bits from bitstuffing the last byte may have left. // As SkipStuffing is idempotent, we can also do that // all the time. m_Stream.SkipStuffing(); #endif return false; }
/// SingleComponentLSScan::WriteMCU // Write a single MCU in this scan. bool SingleComponentLSScan::WriteMCU(void) { #if ACCUSOFT_CODE int lines = m_ulRemaining[0]; // total number of MCU lines processed. UBYTE preshift = m_ucLowBit + FractionalColorBitsOf(); struct Line *line = CurrentLine(0); assert(m_ucCount == 1); // // A "MCU" in respect to the code organization is eight lines. if (lines > 8) { lines = 8; } m_ulRemaining[0] -= lines; assert(lines > 0); // Loop over lines and columns do { LONG length = m_ulWidth[0]; LONG *lp = line->m_pData; BeginWriteMCU(m_Stream.ByteStreamOf()); // MCU is a single line. StartLine(0); do { LONG a,b,c,d,x; // neighbouring values. LONG d1,d2,d3; // local gradients. GetContext(0,a,b,c,d); x = *lp >> preshift; d1 = d - b; // compute local gradients d2 = b - c; d3 = c - a; if (isRunMode(d1,d2,d3)) { LONG runval = a; LONG runcnt = 0; do { x = *lp >> preshift; if (x - runval < -m_lNear || x - runval > m_lNear) break; // Update so that the next process gets the correct value. // Also updates the line pointers. UpdateContext(0,runval); } while(lp++,runcnt++,--length); // Encode the run. Depends on whether the run was interrupted // by the end of the line. EncodeRun(runcnt,length == 0,m_lRunIndex[0]); // Continue the encoding of the end of the run if there are more // samples to encode. if (length) { bool negative; // the sign variable bool rtype; // run interruption type LONG errval; // the prediction error LONG merr; // the mapped error (symbol) LONG rx; // the reconstructed value UBYTE k; // golomb parameter // Get the neighbourhood. GetContext(0,a,b,c,d); // Get the prediction mode. rtype = InterruptedPredictionMode(negative,a,b); // Compute the error value. errval = x - ((rtype)?(a):(b)); if (negative) errval = -errval; // Quantize the error. errval = QuantizePredictionError(errval); // Compute the reconstructed value. rx = Reconstruct(negative,rtype?a:b,errval); // Update so that the next process gets the correct value. UpdateContext(0,rx); // Get the golomb parameter for run interruption coding. k = GolombParameter(rtype); // Map the error into a symbol. merr = ErrorMapping(errval,ErrorMappingOffset(rtype,errval != 0,k)) - rtype; // Golomb-coding of the error. GolombCode(k,merr,m_lLimit - m_lJ[m_lRunIndex[0]] - 1); // Update the variables of the run mode. UpdateState(rtype,errval); // Update the run index now. This is not part of // EncodeRun because the non-reduced run-index is // required for the golomb coder length limit. if (m_lRunIndex[0] > 0) m_lRunIndex[0]--; } else break; // Line ended, abort the loop over the line. } else { UWORD ctxt; bool negative; // the sign variable. LONG px; // the predicted variable. LONG rx; // the reconstructed value. LONG errval; // the error value. LONG merr; // the mapped error value. UBYTE k; // the Golomb parameter. // Quantize the gradients. d1 = QuantizedGradient(d1); d2 = QuantizedGradient(d2); d3 = QuantizedGradient(d3); // Compute the context. ctxt = Context(negative,d1,d2,d3); // Compute the predicted value. px = Predict(a,b,c); // Correct the prediction. px = CorrectPrediction(ctxt,negative,px); // Compute the error value. errval = x - px; if (negative) errval = -errval; // Quantize the prediction error if NEAR > 0 errval = QuantizePredictionError(errval); // Compute the reconstructed value. rx = Reconstruct(negative,px,errval); // Update so that the next process gets the correct value. UpdateContext(0,rx); // Compute the golomb parameter k from the context. k = GolombParameter(ctxt); // Map the error into a symbol merr = ErrorMapping(errval,ErrorMappingOffset(ctxt,k)); // Golomb-coding of the error. GolombCode(k,merr,m_lLimit); // Update the variables. UpdateState(ctxt,errval); } } while(++lp,--length); EndLine(0); line = line->m_pNext; } while(--lines);
void GraphicsLayerUpdater::update(RenderLayer& layer, Vector<RenderLayer*>& layersNeedingPaintInvalidation) { TRACE_EVENT0("blink", "GraphicsLayerUpdater::update"); updateRecursive(layer, DoNotForceUpdate, UpdateContext(), layersNeedingPaintInvalidation); layer.compositor()->updateRootLayerPosition(); }