NS_INTERFACE_MAP_END NS_IMETHODIMP ImageLoader::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData) { if (aType == imgINotificationObserver::SIZE_AVAILABLE) { nsCOMPtr<imgIContainer> image; aRequest->GetImage(getter_AddRefs(image)); return OnStartContainer(aRequest, image); } if (aType == imgINotificationObserver::IS_ANIMATED) { return OnImageIsAnimated(aRequest); } if (aType == imgINotificationObserver::LOAD_COMPLETE) { return OnStopFrame(aRequest); } if (aType == imgINotificationObserver::FRAME_UPDATE) { return FrameChanged(aRequest); } return NS_OK; }
void XDLink::SwitchToFrame ( const JUInt64 id ) { if (id != itsStackFrameIndex) { itsStackFrameIndex = id; Broadcast(FrameChanged()); } const CMStackFrameNode* frame; JString fileName; JIndex lineIndex; if (CMGetCommandDirector()->GetStackDir()->GetStackWidget()->GetStackFrame(id, &frame) && frame->GetFile(&fileName, &lineIndex)) { if (fileName.BeginsWith("file://")) { fileName.RemoveSubstring(1, 7); } Broadcast(ProgramStopped(CMLocation(fileName, lineIndex))); } }
void AnimatedLabel::AdvanceFrame() { //check if an animation is loaded and there is at least one frame if(IsAnimationLoaded() && framePixmaps.count() > 0) { //and that the animation is playing if(playing) { //loop the current frame back if it exceeds the number of frames if(currentFrame >= framePixmaps.count()) currentFrame = 0; emit FrameChanged(currentFrame); //set the pixmap to the correct one in the list setPixmap(framePixmaps.at(currentFrame)); //set the timer to the frame delay specified in the frame frameTimer.start(currentAnimation->GetFrameAtIndex(currentFrame)->GetDelay()); //advance the current frame currentFrame++; } } }
/* * imgIContainerObserver impl */ NS_IMETHODIMP nsImageLoadingContent::FrameChanged(imgIContainer* aContainer, const nsIntRect* aDirtyRect) { LOOP_OVER_OBSERVERS(FrameChanged(aContainer, aDirtyRect)); return NS_OK; }
NS_IMETHODIMP otPr0nObserver::OnStopFrame(imgIRequest *aRequest, PRUint32 aFrame) { DEBUG_DUMP("otPr0nObserver::OnStopFrame (entered)"); nsCOMPtr<imgIContainer> container; aRequest->GetImage(getter_AddRefs(container)); FrameChanged(container, (nsIntRect*)nsnull); return NS_OK; }
void WidgetTimeCoursePlot::keyPressEvent(QKeyEvent *e) { if (e->key() == Qt::Key_Left) { if (m_nCurrentFrame > 0) { m_nCurrentFrame--; update(); emit FrameChanged(m_nCurrentFrame); } } else if (e->key() == Qt::Key_Right) { if (m_nCurrentFrame < m_data.size()-1) { m_nCurrentFrame++; update(); emit FrameChanged(m_nCurrentFrame); } } }
void WidgetTimeCoursePlot::mouseMoveEvent(QMouseEvent *e) { if (e->buttons() & Qt::LeftButton && m_rectPlot.contains(e->posF())) { double dSpacing = m_rectPlot.width() / (m_data.size()-1); int n = (int)((e->x() - m_rectPlot.left() ) / dSpacing + 0.5); if (n >= 0 && n < m_data.size()) { m_nCurrentFrame = n; update(); emit FrameChanged(n); } } }
CBasicAnimation::CBasicAnimation(const std::string& filename, size_t rows, size_t cols, double fps) : IAnimationBase(rows, cols, fps) , m_animationSheet() , m_frame() , m_frameW(DEFAULTFRAMEW) , m_frameH(DEFAULTFRAMEH) { m_animationSheet = CBitmap(al_load_bitmap(filename.c_str())); if (m_animationSheet) { m_frameW = m_animationSheet.GetWidth() / GetCols(); m_frameH = m_animationSheet.GetHeight() / GetRows(); // Create the bitmap for the initial frame FrameChanged(); } }
void AnimatedLabel::PrevFrame() { if(IsAnimationLoaded() && framePixmaps.count() > 0) { if(!playing) { //advance the current frame currentFrame--; //loop the current frame back if it exceeds the number of frames if(currentFrame < 0) currentFrame = (framePixmaps.count() - 1); //set the pixmap to the correct one in the list setPixmap(framePixmaps.at(currentFrame)); emit FrameChanged(currentFrame); } } }
CBasicAnimation::CBasicAnimation(ALLEGRO_BITMAP* sheet, size_t rows, size_t cols, double fps) : IAnimationBase(rows, cols, fps) , m_animationSheet(sheet) , m_frame() , m_frameW(DEFAULTFRAMEW) , m_frameH(DEFAULTFRAMEH) { assert(m_animationSheet.IsValid() == true); assert(rows > 0); assert(cols > 0); assert(fps > 0.0); if (!m_animationSheet || !GetRows() || !GetCols() || (GetFPS() <= 0)) abort(); if (m_animationSheet) { m_frameW = m_animationSheet.GetWidth() / GetCols(); m_frameH = m_animationSheet.GetHeight() / GetRows(); FrameChanged(); } }
NS_IMETHODIMP otPr0nObserver::OnStopFrame(imgIRequest *aRequest, gfxIImageFrame1_9 *aFrame) { DEBUG_DUMP("otPr0nObserver::OnStopFrame1.9 (entered)"); return FrameChanged(nsnull, aFrame, nsnull); }
NS_IMETHODIMP otPr0nObserver::FrameChanged(imgIContainer *aContainer, const nsIntRect *aDirtyRect) { return FrameChanged(aContainer, (nsIntRect*)aDirtyRect); }
void AbstractBTGenerator::Run(HANDLE hThread, bool bFaultingThread) { assert(m_process.IsValid()); assert(hThread); if (!Init()) { assert(false); return; } if (bFaultingThread) { const QString threadInfo = QString("Faulting thread (%1)").arg( reinterpret_cast<quintptr>(hThread) ); emit DebugLine(threadInfo); } else { const QString threadInfo = QString("Thread %1").arg( reinterpret_cast<quintptr>(hThread) ); emit DebugLine(threadInfo); } //HANDLE hFile = CreateFile(L"C:\\test\\test.dmp", FILE_ALL_ACCESS, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, CREATE_ALWAYS, 0, NULL); //if (!MiniDumpWriteDump(m_process.GetHandle(), m_process.GetId(), hFile, // MiniDumpNormal, NULL, NULL, NULL)) //{ // HRESULT hres = (HRESULT) GetLastError(); // printf("%08X\n\n", hres); //} //SafeCloseHandle(hFile); DWORD dw = SuspendThread(hThread); assert(dw != DWORD(-1)); if (dw == DWORD(-1)) { qCritical() << "SuspendThread() failed: " << GetLastError(); return; } CONTEXT context; ZeroMemory(&context, sizeof(context)); if (!bFaultingThread) { // if it's not the faulting thread, get its context context.ContextFlags = CONTEXT_FULL; if (!GetThreadContext(hThread, &context)) { ResumeThread(hThread); assert(false); qCritical() << "GetThreadContext() failed: " << GetLastError(); return; } } else { // if it is, get it from KCrash HANDLE hMapFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, sharedMemoryName); if (hMapFile == NULL) { qCritical() << "OpenFileMapping() failed: " << GetLastError(); return; } CONTEXT *othercontext = (CONTEXT*) MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(CONTEXT)); if (othercontext == NULL) { qCritical() << "MapViewOfFile() failed: " << GetLastError(); SafeCloseHandle(hMapFile); return; } CopyMemory(&context, othercontext, sizeof(CONTEXT)); UnmapViewOfFile(othercontext); // continue even if it fails SafeCloseHandle(hMapFile); } // some of this stuff is taken from StackWalker ZeroMemory(&m_currentFrame, sizeof(m_currentFrame)); DWORD machineType = IMAGE_FILE_MACHINE_UNKNOWN; #if defined(_M_IX86) machineType = IMAGE_FILE_MACHINE_I386; m_currentFrame.AddrPC.Offset = context.Eip; m_currentFrame.AddrFrame.Offset = context.Ebp; m_currentFrame.AddrStack.Offset = context.Esp; #elif defined(_M_X64) machineType = IMAGE_FILE_MACHINE_AMD64; m_currentFrame.AddrPC.Offset = context.Rip; m_currentFrame.AddrFrame.Offset = context.Rbp; m_currentFrame.AddrStack.Offset = context.Rsp; #else # error This architecture is not supported. #endif m_currentFrame.AddrPC.Mode = AddrModeFlat; m_currentFrame.AddrFrame.Mode = AddrModeFlat; m_currentFrame.AddrStack.Mode = AddrModeFlat; SymSetOptions(SymGetOptions() | SYMOPT_UNDNAME | SYMOPT_LOAD_LINES); SymInitialize(m_process.GetHandle(), NULL, FALSE); LoadSymbols(); for (int i = 0; /*nothing*/; i++) { SetLastError(0); if (!StackWalk64( machineType, m_process.GetHandle(), hThread, &m_currentFrame, &context, &Callbacks::ReadProcessMemory, &Callbacks::SymFunctionTableAccess64, &Callbacks::SymGetModuleBase64, NULL)) { emit Finished(); qDebug() << "Stackwalk finished; GetLastError=" << GetLastError(); break; } FrameChanged(); QString modulename = GetModuleName(); QString functionname = GetFunctionName(); QString file = GetFile(); int line = GetLine(); QString address = QString::number(m_currentFrame.AddrPC.Offset, 16); QString debugLine = QString::fromLatin1(BACKTRACE_FORMAT). arg(modulename).arg(functionname).arg(file).arg(line).arg(address); emit DebugLine(debugLine); } // Resume the target thread now, or else the crashing process will not // be terminated ResumeThread(hThread); SymCleanup(m_process.GetHandle()); emit DebugLine(QString()); }