void CBitmapUi::OnPostUpdate( float fDeltaTime ) { Draw(); }
void kGUISystemWin::Init(HINSTANCE hInstance,int nCmdShow) { int startwidth,startheight; int fullwidth,fullheight,maximages; MSG msg; m_showwindow=false; m_mousex=0; m_mousey=0; m_mousewheeldelta=0; m_waskilled=false; m_mouseleftbutton=false; m_mouserightbutton=false; GetPrinters(); // Initialize global strings kGUI::Trace("------------------------------------------------------------------------------\n"); #if 0 strcpy(m_szTitle,APPNAME); strcpy(m_szWindowClass,APPNAME); #else LoadString(hInstance, IDS_APP_TITLE, m_szTitle, MAX_LOADSTRING); kGUI::Trace(" LoadString(hInstance, IDS_APP_TITLE, m_szTitle, MAX_LOADSTRING);\n"); LoadString(hInstance, IDC_APP_NAME, m_szWindowClass, MAX_LOADSTRING); kGUI::Trace(" LoadString(hInstance, IDC_APP_NAME, m_szWindowClass, MAX_LOADSTRING);\n"); #endif { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; #if defined(IDI_LARGEICON) wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_LARGEICON); #else wcex.hIcon=0; #endif wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = 0; wcex.lpszClassName = m_szWindowClass; #if defined(IDI_SMALLICON) wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALLICON); #else wcex.hIconSm=0; #endif kGUI::Trace(" RegisterClass(&wcex);\n"); RegisterClassEx(&wcex); } /* get the full screen size */ fullwidth=GetSystemMetrics(SM_CXSCREEN); fullheight=GetSystemMetrics(SM_CYSCREEN); /* this is the size of that app window, use fullscreen */ /* unless overridden by the user requested dimensions */ #ifdef DEFSCREENWIDTH startwidth=DEFSCREENWIDTH; #else startwidth=fullwidth; #endif #ifdef DEFSCREENHEIGHT startheight=DEFSCREENHEIGHT; #else startheight=fullheight-35; #endif #ifdef DEFMAXIMAGES maximages=DEFMAXIMAGES; #else maximages=200; #endif m_lasttickcount=GetTickCount(); m_hInst = hInstance; // Store instance handle in our global variable kGUI::Trace(" hWnd = CreateWindow(m_szWindowClass, m_szTitle, WS_POPUP | WS_VISIBLE, 0, 0, ScreenWidth, ScreenHeight, NULL, NULL, hInstance, NULL);\n"); m_hWnd = CreateWindow(m_szWindowClass, m_szTitle, WS_POPUP | WS_VISIBLE /*|WS_EX_LAYERED*/ , (fullwidth-startwidth)/2, (fullheight-startheight)/2, startwidth, startheight, NULL, NULL, hInstance, NULL); if (!m_hWnd) { kGUI::Trace(" Last Function failed, program aborting!\n"); return; } // Allocate BMP data for screen kGUI::Trace(" GetClientRect(hWnd,&m_WinRect);\n"); GetClientRect(m_hWnd,&m_WinRect); /* initialize kGUI engine */ kGUI::Trace(" kGUI::Init(m_WinRect.right-m_WinRect.left,m_WinRect.bottom-m_WinRect.top);\n"); if(kGUI::Init(g_sys,m_WinRect.right-m_WinRect.left,m_WinRect.bottom-m_WinRect.top,fullwidth,fullheight,maximages)==false) { kGUI::Trace(" Last Function failed, program aborting!\n"); return; } // kGUI::Trace(" LoadAccelerators(hInstance, (LPCTSTR)IDC_APP_NAME);\n"); // m_hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_APP_NAME); kGUI::Trace(" WSAStartup(0x0202,&m_SockData);\n"); if(WSAStartup(0x0202,&m_SockData)) { kGUI::Trace(" error initing WSAStartup;\n"); return; } /* call the application init code */ kGUI::Trace(" AppInit();\n"); AppInit(); /* show the window if the application has not already done so */ if(m_showwindow==false) ShowWindow(); kGUI::Trace(" UpdateWindow(m_hWnd);\n"); UpdateWindow(m_hWnd); kGUI::Trace(" Draw(m_hWnd);\n"); Draw(m_hWnd,0,0,0,0); kGUI::Trace(" SetTimer(m_hWnd, 0, 1000 / FRAMES_PER_SECOND, NULL);\n"); SetTimer(m_hWnd, 0, 1000 / FRAMES_PER_SECOND, NULL); // Main message event loop: kGUI::Trace(" Entering Main loop: GetMessage(&msg, NULL, 0, 0);\n"); while (GetMessage(&msg, NULL, 0, 0)) { // if (!TranslateAccelerator(msg.hwnd, m_hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } kGUI::Trace(" Exited Main loop, program done.\n"); }
void findtruthPbPb(int binMin, int binMax) { TFile *fmc = new TFile(config.getFileName_djt("mcPbbfa")); buildNamesuffix = TString::Format("_bin_%d_%d",binMin, binMax); // buildTitlesuffix = TString::Format("%d-%d %%",binMin/2, binMax/2); seth(10,0,1); auto hmcPbPbxJTrue = geth("hmcPbPbxJTrue","PbPb true;x_{J};Event fractions"); auto hmcPbPbxJTrueTag = geth("hmcPbPbxJTrueTag","PbPb true tagged;x_{J};Event fractions"); auto hmcPbPbxJTrueTagCorr = geth("hmcPbPbxJTrueTagCorr","PbPb true tagged corrected;x_{J};Event fractions"); auto hmcPbPbxJTrueTagCorrPt = geth("hmcPbPbxJTrueTagCorrPt","PbPb true tagged corrected pt;x_{J};Event fractions"); auto hmcPbPbxJTrueTagCorrEta = geth("hmcPbPbxJTrueTagCorrEta","PbPb true tagged corrected eta;x_{J};Event fractions"); auto hmcPbPbxJTrueTagCorrBin = geth("hmcPbPbxJTrueTagCorrBin","PbPb true tagged corrected bin;x_{J};Event fractions"); seth(12,20,140);//10,40,100); auto hpt2true = geth("hpt2true","true;p_{T,2} GeV"); auto hpt2truetag = geth("hpt2truetag","true tagged;p_{T,2} GeV"); auto hpt2truetagovertrue = geth("hpt2truetagovertrue","true tagged/true;p_{T,2} GeV"); auto hpt2truetagcorr = geth("hpt2truetagcorr","true tagged corrected;p_{T,2} GeV"); auto hpt2truetagcorrovertrue = geth("hpt2truetagcorrovertrue","true tagged corrected/true;p_{T,2} GeV"); seth(10,100,200); auto hpt1true = geth("hpt1true","true;p_{T,1} GeV"); auto hpt1truetag = geth("hpt1truetag","true tagged;p_{T,1} GeV"); auto hpt1truetagovertrue = geth("hpt1truetagovertrue","true tagged/true;p_{T,1} GeV"); auto hpt1truetagcorr = geth("hpt1truetagcorr","true tagged corrected;p_{T,1} GeV"); auto hpt1truetagcorrovertrue = geth("hpt1truetagcorrovertrue","true tagged corrected/true;p_{T,1} GeV"); seth(10,0,200); auto hbintrue = geth("hbintrue","true;bin"); auto hbintruetag = geth("hbintruetag","true tagged;bin"); auto hbintruetagovertrue = geth("hbintruetagovertrue","true tagged/true;bin"); auto hbintruetagcorr = geth("hbintruetagcorr","true tagged corrected;bin"); auto hbintruetagcorrovertrue = geth("hbintruetagcorrovertrue","true tagged corrected/true;bin"); seth(20,-2,2); auto heta2true = geth("heta2true","true;#eta_{2}"); auto heta2truetag = geth("heta2truetag","true tagged;#eta_{2}"); auto heta2truetagovertrue = geth("heta2truetagovertrue","true tagged/true;#eta_{2}"); auto heta2truetagcorr = geth("heta2truetagcorr","true tagged corrected;#eta_{2}"); auto heta2truetagcorrovertrue = geth("heta2truetagcorrovertrue","true tagged corrected/true;#eta_{2}"); auto heta1true = geth("heta1true","true;#eta_{1}"); auto heta1truetag = geth("heta1truetag","true tagged;#eta_{1}"); auto heta1truetagovertrue = geth("heta1truetagovertrue","true tagged/true;#eta_{1}"); auto heta1truetagcorr = geth("heta1truetagcorr","true tagged corrected;#eta_{1}"); auto heta1truetagcorrovertrue = geth("heta1truetagcorrovertrue","true tagged corrected/true;#eta_{1}"); unordered_set<int> eventstodiscard = {1805770,1116573,1084397};//, // 5755734,1599758,395810, // 1363321,211625,3195128}; // Fill(fmc,[&] (dict &m) { if (m["bin"]<binMin || m["bin"]>=binMax) return; if (m["pthat"]<pthatcut) return; if (m[pairCodeSB1]!=0) return; // if (m["bProdCode"]>1) return; if (eventstodiscard.find(m["event"])!=eventstodiscard.end()) return; //kill large-weight GSP event float w = m["weight"]*processweight((int)m["bProdCode"]); //because we have only b-dijets float corr = tageffcorrectionPbPb(m["jtpt1"],m["jteta1"],m[jtptSB],m[jtetaSB],m["bin"]); // float corrpt = getPbPbcorrectionPt(m["jtpt1"],m[jtptSB]); // float correta = getPbPbcorrectionEta(m["jteta1"],m[jtetaSB]); // float corrbin = getPbPbcorrectionBin(m["bin"]); float wb = w*corr; if (m["jtpt1"]>pt1cut && m["refpt1"]>50 && abs(m["refparton_flavorForB1"])==5 && m[jtptSB]>pt2cut && m[refptSB]>20 && m[dphiSB1]>PI23) { hmcPbPbxJTrue->Fill(m[jtptSB]/m["jtpt1"],w); hpt2true->Fill(m[jtptSB],w); hpt1true->Fill(m["jtpt1"],w); heta2true->Fill(m[jtetaSB],w); heta1true->Fill(m["jteta1"],w); hbintrue->Fill(m["bin"],w); } if (m["jtpt1"]>pt1cut && m["refpt1"]>50 && abs(m["refparton_flavorForB1"])==5 && m[jtptSB]>pt2cut && m[refptSB]>20 && m[dphiSB1]>PI23 && m["discr_csvV1_1"]>0.9 && m[discr_csvV1_SB]>0.9) { // //corrpt *= m[jtptSB] < 60 ? 1./0.7 : 1; //wb *= m[jtptSB] < 60 ? 1./0.7 : 1; hmcPbPbxJTrueTag->Fill(m[jtptSB]/m["jtpt1"],w); hmcPbPbxJTrueTagCorr->Fill(m[jtptSB]/m["jtpt1"],wb); // hmcPbPbxJTrueTagCorrPt->Fill(m[jtptSB]/m["jtpt1"],w*corrpt); // hmcPbPbxJTrueTagCorrEta->Fill(m[jtptSB]/m["jtpt1"],w*corrpt*correta); // hmcPbPbxJTrueTagCorrBin->Fill(m[jtptSB]/m["jtpt1"],w*corrpt*correta*corrbin); hpt2truetag->Fill(m[jtptSB],w); hpt1truetag->Fill(m["jtpt1"],w); heta2truetag->Fill(m[jtetaSB],w); heta1truetag->Fill(m["jteta1"],w); hbintruetag->Fill(m["bin"],w); hpt2truetagcorr->Fill(m[jtptSB],wb); hpt1truetagcorr->Fill(m["jtpt1"],wb); heta2truetagcorr->Fill(m[jtetaSB],wb); heta1truetagcorr->Fill(m["jteta1"],wb); hbintruetagcorr->Fill(m["bin"],wb); } }); NormalizeAllHists(); //plotymax = 9999; aktstring = TString::Format("PbPb %d-%d %%",binMin/2, binMax/2);//TString::Format("PbPb#Delta#phi>2/3#pi %d-%d %%",binMin/2, binMax/2); SetMC({hmcPbPbxJTrue,hmcPbPbxJTrueTag,hmcPbPbxJTrueTagCorr}); SetData({hmcPbPbxJTrue}); hmcPbPbxJTrue->SetMinimum(0); hmcPbPbxJTrue->SetMaximum(0.3); hmcPbPbxJTrue->SetLineWidth(2); hmcPbPbxJTrue->SetMarkerStyle(kNone); hmcPbPbxJTrue->SetFillStyle(0); hmcPbPbxJTrueTag->SetMarkerStyle(kOpenCircle); hmcPbPbxJTrueTagCorr->SetMarkerStyle(kOpenSquare); plotymax = 0.3; Draw({hmcPbPbxJTrue,hmcPbPbxJTrueTag,hmcPbPbxJTrueTagCorr}); SetB({hmcPbPbxJTrue,hmcPbPbxJTrueTag,hmcPbPbxJTrueTagCorr}); float xjtrue = hmcPbPbxJTrue->GetMean(); float xjtruetag = hmcPbPbxJTrueTag->GetMean(); float xjtruetagcorr = hmcPbPbxJTrueTagCorr->GetMean(); float exjtrue = hmcPbPbxJTrue->GetMeanError(); float exjtruetag = hmcPbPbxJTrueTag->GetMeanError(); float exjtruetagcorr = hmcPbPbxJTrueTagCorr->GetMeanError(); auto c = getc(); hmcPbPbxJTrue->Draw("hist"); hmcPbPbxJTrueTag->Draw("E1,same"); hmcPbPbxJTrueTagCorr->Draw("E1,same"); plotlegendpos = TopLeft; auto l = getLegend(); l->AddEntry(hmcPbPbxJTrue,Form("b-dijets, #LTx_{J}#GT=%.3f#pm%.3f",xjtrue,exjtrue),"L"); l->AddEntry(hmcPbPbxJTrueTag,Form("uncorrected, #LTx_{J}#GT=%.3f#pm%.3f",xjtruetag,exjtruetag),"P"); l->AddEntry(hmcPbPbxJTrueTagCorr,Form("corrected, #LTx_{J}#GT=%.3f#pm%.3f",xjtruetagcorr,exjtruetagcorr),"P"); l->Draw(); TLatex *Tl = new TLatex(); Tl->DrawLatexNDC(0.2, 0.8, aktstring); SavePlot(c,Form("closure%d%d",binMin,binMax)); // //if (binMin==0 && binMax==200) { // Draw({hmcPbPbxJTrueTag,hmcPbPbxJTrueTagCorrPt,hmcPbPbxJTrueTagCorrEta,hmcPbPbxJTrueTagCorrBin}); // SetMC({hpt2truetag,hpt1truetag,heta2truetag,heta1truetag,hbintruetag}); // plotputmean = false; // plotymax = 0.2; // Draw({hpt2true,hpt2truetag,hpt2truetagcorr}); // plotymax = 0.3; // Draw({hpt1true,hpt1truetag,hpt1truetagcorr}); // plotymax = 0.2; // Draw({heta2true,heta2truetag,heta2truetagcorr}); // Draw({heta1true,heta1truetag,heta1truetagcorr}); // plotymax = 1; // Draw({hbintrue,hbintruetag,hbintruetagcorr}); plotymin = 0; plotymax = 0.2; Draw({hpt2truetag,hpt2true}); Draw({hpt2truetagcorr,hpt2true}); hpt2truetagovertrue->Divide(hpt2truetag,hpt2true,1,1); //"B" hpt1truetagovertrue->Divide(hpt1truetag,hpt1true,1,1); //"B" heta2truetagovertrue->Divide(heta2truetag,heta2true,1,1); //"B" heta1truetagovertrue->Divide(heta1truetag,heta1true,1,1); //"B" hbintruetagovertrue->Divide(hbintruetag,hbintrue,1,1); //"B" hpt2truetagcorrovertrue->Divide(hpt2truetagcorr,hpt2true,1,1); //"B" hpt1truetagcorrovertrue->Divide(hpt1truetagcorr,hpt1true,1,1); //"B" heta2truetagcorrovertrue->Divide(heta2truetagcorr,heta2true,1,1); //"B" heta1truetagcorrovertrue->Divide(heta1truetagcorr,heta1true,1,1); //"B" hbintruetagcorrovertrue->Divide(hbintruetagcorr,hbintrue,1,1); //"B" NormalizeAllHists(); Draw({hpt2truetagovertrue,hpt2truetagcorrovertrue}); Draw({hpt1truetagovertrue,hpt1truetagcorrovertrue}); Draw({heta2truetagovertrue,heta2truetagcorrovertrue}); Draw({heta1truetagovertrue,heta1truetagcorrovertrue}); Draw({hbintruetagovertrue,hbintruetagcorrovertrue}); // } }
eOSState cPvrMenuMain::ProcessKey(eKeys Key) { eOSState state = cOsdObject::ProcessKey(Key); if (state == osUnknown) { switch (Key & ~k_Repeat) { case kUp: mode--; if (mode < ePicPropBrightness) mode = ePicPropHue; Draw(); break; case kDown: mode++; if (mode > ePicPropHue) mode = ePicPropBrightness; Draw(); break; case kLeft: switch (mode) { case ePicPropBrightness: if (PvrSetup.Brightness.value > PvrSetup.Brightness.queryctrl.minimum) { PvrSetup.Brightness.value--; for (int i = 0; i < cPvrDevice::Count(); i++) { cPvrDevice *pvr = cPvrDevice::Get(i); if (pvr) pvr->SetControlValue(&PvrSetup.Brightness, PvrSetup.Brightness.value); } } break; case ePicPropContrast: if (PvrSetup.Contrast.value > PvrSetup.Contrast.queryctrl.minimum) { PvrSetup.Contrast.value--; for (int i = 0; i < cPvrDevice::Count(); i++) { cPvrDevice *pvr = cPvrDevice::Get(i); if (pvr) pvr->SetControlValue(&PvrSetup.Contrast, PvrSetup.Contrast.value); } } break; case ePicPropSaturation: if (PvrSetup.Saturation.value > PvrSetup.Saturation.queryctrl.minimum) { PvrSetup.Saturation.value--; for (int i = 0; i < cPvrDevice::Count(); i++) { cPvrDevice *pvr = cPvrDevice::Get(i); if (pvr) pvr->SetControlValue(&PvrSetup.Saturation, PvrSetup.Saturation.value); } } break; case ePicPropHue: if (PvrSetup.Hue.value > PvrSetup.Hue.queryctrl.minimum) { PvrSetup.Hue.value--; for (int i = 0; i < cPvrDevice::Count(); i++) { cPvrDevice *pvr = cPvrDevice::Get(i); if (pvr) pvr->SetControlValue(&PvrSetup.Hue, PvrSetup.Hue.value); } } break; } Draw(); break; case kRight: switch (mode) { case ePicPropBrightness: if (PvrSetup.Brightness.value < PvrSetup.Brightness.queryctrl.maximum) { PvrSetup.Brightness.value++; for (int i = 0; i < cPvrDevice::Count(); i++) { cPvrDevice *pvr = cPvrDevice::Get(i); if (pvr) pvr->SetControlValue(&PvrSetup.Brightness, PvrSetup.Brightness.value); } } break; case ePicPropContrast: if (PvrSetup.Contrast.value < PvrSetup.Contrast.queryctrl.maximum) { PvrSetup.Contrast.value++; for (int i = 0; i < cPvrDevice::Count(); i++) { cPvrDevice *pvr = cPvrDevice::Get(i); if (pvr) pvr->SetControlValue(&PvrSetup.Contrast, PvrSetup.Contrast.value); } } break; case ePicPropSaturation: if (PvrSetup.Saturation.value < PvrSetup.Saturation.queryctrl.maximum) { PvrSetup.Saturation.value++; for (int i = 0; i < cPvrDevice::Count(); i++) { cPvrDevice *pvr = cPvrDevice::Get(i); if (pvr) pvr->SetControlValue(&PvrSetup.Saturation, PvrSetup.Saturation.value); } } break; case ePicPropHue: if (PvrSetup.Hue.value < PvrSetup.Hue.queryctrl.maximum) { PvrSetup.Hue.value++; for (int i = 0; i < cPvrDevice::Count(); i++) { cPvrDevice *pvr = cPvrDevice::Get(i); if (pvr) pvr->SetControlValue(&PvrSetup.Hue, PvrSetup.Hue.value); } } break; } Draw(); break; case kOk: PluginPvrInput->SetupStore("Brightness", PvrSetup.Brightness.value); PluginPvrInput->SetupStore("Contrast", PvrSetup.Contrast.value); PluginPvrInput->SetupStore("Saturation", PvrSetup.Saturation.value); PluginPvrInput->SetupStore("Hue", PvrSetup.Hue.value); return osEnd; case kBack: return osEnd; default: return state; } state = osContinue; } return state; }
void App::Run() { SDL_Init(SDL_INIT_EVERYTHING); Engine::Get().Resize(Engine::Get().getWindowWidth(), Engine::Get().getWindowHeigth()); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); glClearColor(0.3, 0.66, 0.89, 0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); const std::string atlas_filename = "data/tex.png"; Engine& engine = Engine::Get(); engine.Load(); engine.getRenderer()->LoadTexture(atlas_filename); if (Engine::Get().getPlayerSprite() == PT::Ninja) { m_player->setSprites(SpritePtr(new Sprite(engine.getSpriteConfig()->Get("ninja_right"))), SpritePtr(new Sprite(engine.getSpriteConfig()->Get("ninja_left"))), SpritePtr(new Sprite(engine.getSpriteConfig()->Get("ninja_stop")))); } else if (Engine::Get().getPlayerSprite() == PT::Samurai) { m_player->setSprites(SpritePtr(new Sprite(engine.getSpriteConfig()->Get("samurai_right"))), SpritePtr(new Sprite(engine.getSpriteConfig()->Get("samurai_left"))), SpritePtr(new Sprite(engine.getSpriteConfig()->Get("samurai_stop")))); } in_game = true; size_t last_ticks = SDL_GetTicks(); Engine::Get().setGameState(GS::Menu); while (Engine::Get().getState() != GS::Quit) { switch (Engine::Get().getState()) { case GS::InGame: ProcessEvents(); break; case GS::HallOfFame: if (!m_hall_of_fame->isActual()) m_hall_of_fame.reset(new HallOfFame()); m_hall_of_fame->proccessEvents(); break; case GS::ScoreSubmit: m_score_submit->ProcessEvents(); break; case GS::Menu: m_menu->ProcessEvents(); break; case GS::Options: m_options->processEvents(); } size_t ticks = SDL_GetTicks(); delta_time = (ticks - last_ticks) / (CLOCKS_PER_SEC/10.0); if ((delta_time*(CLOCKS_PER_SEC / 10.0)) < ((CLOCKS_PER_SEC / 10.0) / Engine::Get().fps)) SDL_Delay(((CLOCKS_PER_SEC / 10.0) / Engine::Get().fps) - (delta_time*(CLOCKS_PER_SEC / 10.0))); delta_time = ((CLOCKS_PER_SEC / 10.0) / Engine::Get().fps)/ (CLOCKS_PER_SEC / 10.0); last_ticks = ticks; switch (Engine::Get().getState()) { case GS::InGame: if (delta_time > 0.0) { Update(delta_time); } Draw(); break; case GS::HallOfFame: m_hall_of_fame->draw(); break; case GS::ScoreSubmit: m_score_submit->Draw(); break; case GS::Menu: m_menu->Draw(); break; case GS::Options: m_options->draw(); break; } } SDL_Quit(); }
void VertexManager::vFlush(bool useDstAlpha) { GLVertexFormat *nativeVertexFmt = (GLVertexFormat*)VertexLoaderManager::GetCurrentVertexFormat(); u32 stride = nativeVertexFmt->GetVertexStride(); if (m_last_vao != nativeVertexFmt->VAO) { glBindVertexArray(nativeVertexFmt->VAO); m_last_vao = nativeVertexFmt->VAO; } PrepareDrawBuffers(stride); // Makes sure we can actually do Dual source blending bool dualSourcePossible = g_ActiveConfig.backend_info.bSupportsDualSourceBlend; // If host supports GL_ARB_blend_func_extended, we can do dst alpha in // the same pass as regular rendering. if (useDstAlpha && dualSourcePossible) { ProgramShaderCache::SetShader(DSTALPHA_DUAL_SOURCE_BLEND, current_primitive_type); } else { ProgramShaderCache::SetShader(DSTALPHA_NONE, current_primitive_type); } // upload global constants ProgramShaderCache::UploadConstants(); // setup the pointers nativeVertexFmt->SetupVertexPointers(); Draw(stride); // run through vertex groups again to set alpha if (useDstAlpha && !dualSourcePossible) { ProgramShaderCache::SetShader(DSTALPHA_ALPHA_PASS, current_primitive_type); // only update alpha glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); glDisable(GL_BLEND); Draw(stride); // restore color mask g_renderer->SetColorMask(); if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract) glEnable(GL_BLEND); } #if defined(_DEBUG) || defined(DEBUGFAST) if (g_ActiveConfig.iLog & CONF_SAVESHADERS) { // save the shaders ProgramShaderCache::PCacheEntry prog = ProgramShaderCache::GetShaderProgram(); std::string filename = StringFromFormat("%sps%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); std::ofstream fps; OpenFStream(fps, filename, std::ios_base::out); fps << prog.shader.strpprog.c_str(); filename = StringFromFormat("%svs%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); std::ofstream fvs; OpenFStream(fvs, filename, std::ios_base::out); fvs << prog.shader.strvprog.c_str(); } if (g_ActiveConfig.iLog & CONF_SAVETARGETS) { std::string filename = StringFromFormat("%starg%.3d.png", File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), g_ActiveConfig.iSaveTargetId); TargetRectangle tr; tr.left = 0; tr.right = Renderer::GetTargetWidth(); tr.top = 0; tr.bottom = Renderer::GetTargetHeight(); g_renderer->SaveScreenshot(filename, tr); } #endif g_Config.iSaveTargetId++; ClearEFBCache(); }
void CSkinVerticleScrollbar::OnPaint() { CPaintDC dc(this); Draw(); }
void CUnit::DrawS3O(void) { unitDrawer->SetS3OTeamColour(team); Draw(); }
void gMenuItem::Update() { SetColor(); Draw(); }
int main(int argc, char *argv[]) { DrawState *drawstates; int i, done; SDL_Event event; int frames; Uint32 then, now; /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); if (!state) { return 1; } for (i = 1; i < argc;) { int consumed; consumed = SDLTest_CommonArg(state, i); if (consumed == 0) { fprintf(stderr, "Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); return 1; } i += consumed; } if (!SDLTest_CommonInit(state)) { quit(2); } drawstates = SDL_stack_alloc(DrawState, state->num_windows); for (i = 0; i < state->num_windows; ++i) { DrawState *drawstate = &drawstates[i]; drawstate->window = state->windows[i]; drawstate->renderer = state->renderers[i]; drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE); drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE); if (!drawstate->sprite || !drawstate->background) { quit(2); } SDL_QueryTexture(drawstate->sprite, NULL, NULL, &drawstate->sprite_rect.w, &drawstate->sprite_rect.h); drawstate->scale_direction = 1; } /* Main render loop */ frames = 0; then = SDL_GetTicks(); done = 0; while (!done) { /* Check for events */ ++frames; while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); } for (i = 0; i < state->num_windows; ++i) { Draw(&drawstates[i]); } } /* Print out some timing information */ now = SDL_GetTicks(); if (now > then) { double fps = ((double) frames * 1000) / (now - then); printf("%2.2f frames per second\n", fps); } SDL_stack_free(drawstates); quit(0); return 0; }
void CPropPageFrameDefault::OnPaint() { CPaintDC dc(this); Draw(&dc); }
CIconSelectMenu* CIconImgList::CreateIconSelectMenu( CWnd* pcWnd, BOOL blForce) const { CIconSelectMenu* pcIconSelectMenu = NULL; HMENU hMenuPopup = NULL; HMENU hMenuExitIcon = ::CreatePopupMenu(); if( hMenuExitIcon) { CDC* pcDC = pcWnd->GetDC(); if( pcDC) { CDC cMemDC; cMemDC.CreateCompatibleDC( pcDC); pcWnd->ReleaseDC( pcDC); HMENU* pahMenuGroup = NULL; pahMenuGroup = new HMENU [ m_nGroupCount]; if( pahMenuGroup) { ZeroMemory( pahMenuGroup, sizeof( HMENU) * m_nGroupCount); for( int nIndex = 0; nIndex < m_nGroupCount; nIndex++) { if( blForce || m_astGroupData[ nIndex]->blEnable) { pahMenuGroup[ nIndex] = ::CreatePopupMenu(); if( NULL != pahMenuGroup[ nIndex]) { //InsertIcons( pahMenuGroup[ nIndex], nIndex + 1, cMemDC, blForce); HMENU hWork = ( 0 >= ( m_astGroupData[ nIndex]->nParent)) ? hMenuExitIcon : pahMenuGroup[ m_astGroupData[ nIndex]->nParent - 1]; ::AppendMenu( hWork, MF_POPUP, ( int)pahMenuGroup[ nIndex], m_astGroupData[ nIndex]->szName); } } } for( int nIndex = 0; nIndex < m_nGroupCount; nIndex++) { if( blForce || m_astGroupData[ nIndex]->blEnable) { InsertIconsEx( pahMenuGroup[ nIndex], nIndex + 1, cMemDC, blForce); } } delete [] pahMenuGroup; } InsertIconsEx( hMenuExitIcon, 0, cMemDC, blForce); // ぐへ、汚にゃい hMenuPopup = ::CreatePopupMenu(); if( hMenuPopup) { if( 0 < GetMenuItemCount( hMenuExitIcon)) { // なんか、イヤーンな感じだ HBITMAP hBitmapTemp; HBITMAP hBitmap = ::CreateCompatibleBitmap( cMemDC, _ICON_WIDTH, _ICON_HEIGHT); hBitmapTemp = ( HBITMAP)::SelectObject( cMemDC, hBitmap); Draw( COUNT_DEFAULTICON, cMemDC, CRect( 0, 0, _ICON_WIDTH, _ICON_HEIGHT)); ::SelectObject( cMemDC, hBitmapTemp); ::AppendMenu( hMenuPopup, MF_POPUP | MF_BITMAP, ( int)hMenuExitIcon, ( LPCTSTR)hBitmap); ::AppendMenu( hMenuPopup, MF_SEPARATOR, 0, 0); } // デフォルトのアイコンさんたち! for( int nIndex = 0; nIndex < COUNT_DEFAULTICON; nIndex++) { HBITMAP hBitmapTemp; HBITMAP hBitmap = ::CreateCompatibleBitmap( cMemDC, _ICON_WIDTH, _ICON_HEIGHT); hBitmapTemp = ( HBITMAP)::SelectObject( cMemDC, hBitmap); Draw( nIndex, cMemDC, CRect( 0, 0, _ICON_WIDTH, _ICON_HEIGHT)); ::SelectObject( cMemDC, hBitmapTemp); ::AppendMenu( hMenuPopup, MF_BITMAP, IDM_ICONIMG00 + nIndex, ( LPCTSTR)hBitmap); } pcIconSelectMenu = new CIconSelectMenu(); pcIconSelectMenu->Attach( hMenuPopup); } else { DestroyMenu( hMenuExitIcon); } } } return pcIconSelectMenu; }
int CIconImgList::InsertIcons( HMENU hMenu, int nID, CDC& cDCWork, BOOL blForce) const { int nResult = 0; HMENU hMenuTemp = hMenu; int nCount = 0; for( int nIndex = 0; nIndex < m_nEnableCount; nIndex++) { if( nID == m_astIconStatus4Menu[ nIndex]->nParent) { if( blForce || m_astIconStatus4Menu[ nIndex]->blEnable) { if( 20 <= nCount) { HMENU hMenuWork = ::CreatePopupMenu(); ::InsertMenu( hMenuTemp, 0, MF_BYPOSITION | MF_SEPARATOR, NULL, NULL); ::InsertMenu( hMenuTemp, 0, MF_BYPOSITION | MF_POPUP, ( int)hMenuWork, ( LPCTSTR)TEXT( "&next")); nCount = 0; hMenuTemp = hMenuWork; } HBITMAP hBitmapTemp; HBITMAP hBitmap = ::CreateCompatibleBitmap( cDCWork, _ICON_WIDTH, _ICON_HEIGHT); hBitmapTemp = ( HBITMAP)::SelectObject( cDCWork, hBitmap); Draw( m_astIconStatus4Menu[ nIndex]->nID + GetExtendStartIndex(), cDCWork, CRect( 0, 0, _ICON_WIDTH, _ICON_HEIGHT)); ::SelectObject( cDCWork, hBitmapTemp); ::AppendMenu( hMenuTemp, MF_BITMAP, ( IDM_ICONIMG13 + 1) + 1 + m_astIconStatus4Menu[ nIndex]->nID, ( LPCTSTR)hBitmap); nResult++; nCount++; } } } /* int nIconIndex; for( int nIndex = 0; nIndex < GetExtendCount(); nIndex++) { nIconIndex = nIndex + GetExtendStartIndex(); if( IsInvalid( nIconIndex)) { if( nID == GetParentGroup( nIconIndex)) { HBITMAP hBitmapTemp; HBITMAP hBitmap = ::CreateCompatibleBitmap( cDCWork, _ICON_WIDTH, _ICON_HEIGHT); hBitmapTemp = ( HBITMAP)::SelectObject( cDCWork, hBitmap); Draw( nIconIndex, cDCWork, CRect( 0, 0, _ICON_WIDTH, _ICON_HEIGHT)); ::SelectObject( cDCWork, hBitmapTemp); ::AppendMenu( hMenuTemp, MF_BITMAP, ( IDM_ICONIMG13 + 1) + 1 + nIndex, ( LPCTSTR)hBitmap); nResult++; nCount++; if( 20 <= nCount) { HMENU hMenuWork = ::CreatePopupMenu(); ::InsertMenu( hMenuTemp, 0, MF_BYPOSITION | MF_SEPARATOR, NULL, NULL); ::InsertMenu( hMenuTemp, 0, MF_BYPOSITION | MF_POPUP, ( int)hMenuWork, ( LPCTSTR)TEXT( "&next")); nCount = 0; hMenuTemp = hMenuWork; } } } } */ return nResult; }
LRESULT kGUISystemWin::Event(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; int key; int newtick,deltatick; switch (message) { case WM_COMMAND: wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); // Parse the menu selections: return DefWindowProc(hWnd, message, wParam, lParam); break; case WM_PAINT: // Get the Windows update region // while(kGUI::GetInDraw()==true || kGUI::GetInThread()==true); // kGUI::SetInDraw(true); GetUpdateRect(hWnd, &m_UpdateWinRect, FALSE); hdc = BeginPaint(hWnd, &ps); Draw(hWnd,m_UpdateWinRect.left,m_UpdateWinRect.right,m_UpdateWinRect.top,m_UpdateWinRect.bottom); EndPaint(hWnd, &ps); // kGUI::SetInDraw(false); break; case WM_TIMER: newtick=GetTickCount(); deltatick=newtick-m_lasttickcount; if(deltatick<0) deltatick=0; m_lasttickcount=newtick; #if DEBUGPRINT kGUI::Trace("Delta tick=%d\n",deltatick); #endif kGUI::Tick(deltatick); if(GetAsyncKeyState(VK_LSHIFT) || GetAsyncKeyState(VK_RSHIFT)) kGUI::SetKeyShift(true); else kGUI::SetKeyShift(false); if(GetAsyncKeyState(VK_CONTROL)) kGUI::SetKeyControl(true); else kGUI::SetKeyControl(false); if(kGUI::GetTempMouse()>=0) { int t=kGUI::GetTempMouse(); kGUI::SetTempMouse(t-1); if(!t) kGUI::SetMouseCursor(MOUSECURSOR_DEFAULT); } if(kGUI::GetMouseCursor()!=MOUSECURSOR_DEFAULT) /* if not default arrow */ kGUI::ChangeMouse(); kGUI::UpdateInput(); m_mousewheeldelta=0; // while(kGUI::GetInDraw()==true || kGUI::GetInThread()==true); // kGUI::SetInDraw(true); Draw(hWnd,0,0,0,0); // kGUI::SetInDraw(false); /* is the application shutting down? */ if(kGUI::IsAppClosed()==true) DestroyWindow(hWnd); else SetTimer(hWnd, 0, 1000 / FRAMES_PER_SECOND, NULL); break; case WM_DESTROY: /* sometimes this event get's called more than once, so allow only once! */ if(m_waskilled==false) { m_waskilled=true; AppClose(); kGUI::Close(); PostQuitMessage(0); WSACleanup(); } break; case WM_MOUSEWHEEL: //values are increments of 120 m_mousewheeldelta = GET_WHEEL_DELTA_WPARAM(wParam)/120; kGUI::SetMouse(m_mousex,m_mousey,m_mousewheeldelta,m_mouseleftbutton,m_mouserightbutton); break; case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_RBUTTONDOWN: case WM_RBUTTONUP: case WM_MOUSEMOVE: if(kGUI::GetMouseCursor()!=MOUSECURSOR_DEFAULT) /* if not default arrow */ kGUI::ChangeMouse(); m_mousex=GET_X_LPARAM(lParam); m_mousey=GET_Y_LPARAM(lParam); m_mouseleftbutton=(wParam&MK_LBUTTON)!=0; m_mouserightbutton=(wParam&MK_RBUTTON)!=0; /* this tells windows to keep updating me even if the mouse is moved off of */ /* my window area */ if(m_mouseleftbutton || m_mouserightbutton) SetCapture(hWnd); else ReleaseCapture(); kGUI::SetMouse(m_mousex,m_mousey,m_mousewheeldelta,m_mouseleftbutton,m_mouserightbutton); kGUI::Tick(0); kGUI::UpdateInput(); return DefWindowProc(hWnd, message, wParam, lParam); break; case WM_CHAR: key=(int)wParam; switch(key) { case 1: //'ctrl-a' key=GUIKEY_SELECTALL; break; case 3: //'ctrl-c' key=GUIKEY_COPY; break; case 6: //'ctrl-f' key=GUIKEY_FIND; break; // case 8: //'ctrl-h' // key=GUIKEY_REPLACE; // break; case 22: //'ctrl-v' key=GUIKEY_PASTE; break; case 24: //'ctrl-x' key=GUIKEY_CUT; break; case 26: //'ctrl-z' key=GUIKEY_UNDO; break; case 187: //'ctrl +' key=GUIKEY_CTRL_PLUS; break; case 189: //'ctrl -' key=GUIKEY_CTRL_MINUS; break; case VK_BACK: key=GUIKEY_BACKSPACE; break; case VK_RETURN: key=GUIKEY_RETURN; break; case VK_TAB: if(GetAsyncKeyState(VK_LSHIFT) || GetAsyncKeyState(VK_RSHIFT)) key=GUIKEY_SHIFTTAB; else key=GUIKEY_TAB; break; case VK_ESCAPE: key=GUIKEY_ESC; break; case VK_SHIFT: case VK_CONTROL: key=0; break; } if(key) kGUI::KeyPressed(key); break; case WM_KEYDOWN: key=ConvertKey((int)wParam,0); if(key) kGUI::KeyPressed(key); key=ConvertKey((int)wParam,(int)wParam); if(key) kGUI::SetKeyState(key,true); break; case WM_KEYUP: key=ConvertKey((int)wParam,(int)wParam); if(key) kGUI::SetKeyState(key,false); break; default: return DefWindowProc(hWnd, message, wParam, lParam); break; } return 0; }
void SourceWindow::OnPaint() { Draw(CPaintDC(this)); }
void TextRenderHdc::Draw(const char *s, size_t sLen, RectF& bb, bool isRtl) { size_t strLen = str::Utf8ToWcharBuf(s, sLen, txtConvBuf, dimof(txtConvBuf)); return Draw(txtConvBuf, strLen, bb, isRtl); }
void cPowerUp :: Update( void ) { Draw( screen ); }
/* --------------------------------------------------------------------------- * set a new mode and update X cursor */ void SetMode (int Mode) { static bool recursing = false; /* protect the cursor while changing the mode * perform some additional stuff depending on the new mode * reset 'state' of attached objects */ if (recursing) { return; } recursing = true; notify_crosshair_change (false); addedLines = 0; Crosshair.AttachedObject.Type = NO_TYPE; Crosshair.AttachedObject.State = STATE_FIRST; Crosshair.AttachedPolygon.PointN = 0; if (PCB->RatDraw) { if (Mode == ARC_MODE || Mode == RECTANGLE_MODE || Mode == VIA_MODE || Mode == POLYGON_MODE || Mode == POLYGONHOLE_MODE || Mode == TEXT_MODE || Mode == INSERTPOINT_MODE || Mode == THERMAL_MODE) { Message (_("That mode is NOT allowed when drawing ratlines!\n")); Mode = NO_MODE; } } if (Settings.Mode == LINE_MODE && Mode == ARC_MODE && Crosshair.AttachedLine.State != STATE_FIRST) { Crosshair.AttachedLine.State = STATE_FIRST; Crosshair.AttachedBox.State = STATE_SECOND; Crosshair.AttachedBox.Point1.X = Crosshair.AttachedBox.Point2.X = Crosshair.AttachedLine.Point1.X; Crosshair.AttachedBox.Point1.Y = Crosshair.AttachedBox.Point2.Y = Crosshair.AttachedLine.Point1.Y; AdjustAttachedObjects (); } else if (Settings.Mode == ARC_MODE && Mode == LINE_MODE && Crosshair.AttachedBox.State != STATE_FIRST) { Crosshair.AttachedBox.State = STATE_FIRST; Crosshair.AttachedLine.State = STATE_SECOND; Crosshair.AttachedLine.Point1.X = Crosshair.AttachedLine.Point2.X = Crosshair.AttachedBox.Point1.X; Crosshair.AttachedLine.Point1.Y = Crosshair.AttachedLine.Point2.Y = Crosshair.AttachedBox.Point1.Y; Settings.Mode = Mode; AdjustAttachedObjects (); } /* Cancel rubberband move */ else if (Settings.Mode == MOVE_MODE) MoveObjectAndRubberband (Crosshair.AttachedObject.Type, Crosshair.AttachedObject.Ptr1, Crosshair.AttachedObject.Ptr2, Crosshair.AttachedObject.Ptr3, 0, 0); else { if (Settings.Mode == ARC_MODE || Settings.Mode == LINE_MODE) { SetLocalRef (0, 0, false); } Crosshair.AttachedBox.State = STATE_FIRST; Crosshair.AttachedLine.State = STATE_FIRST; if (Mode == LINE_MODE && TEST_FLAG (AUTODRCFLAG, PCB)) { if (ClearFlagOnAllObjects (true, CONNECTEDFLAG | FOUNDFLAG)) { IncrementUndoSerialNumber (); Draw (); } } } Settings.Mode = Mode; if (Mode == PASTEBUFFER_MODE) /* do an update on the crosshair range */ { SetCrosshairRangeToBuffer (); } else { SetCrosshairRange (0, 0, PCB->MaxWidth, PCB->MaxHeight); } recursing = false; /* force a crosshair grid update because the valid range * may have changed */ FitCrosshairIntoGrid (Crosshair.X, Crosshair.Y); notify_crosshair_change (true); }
/*--------------------------------------------------------------------------*/ void PegBitmapWindow::SetBackgroundColor(UCHAR FillColor) { mFillColor = FillColor; Invalidate(mReal); Draw(); }
void Farre::Launch() { _mapLevel = new MapLevel(Render::GetSingleton()->GetRenderWindow().GetWidth(), Render::GetSingleton()->GetRenderWindow().GetHeight()); _mapLevel->LoadMap("data/mapTest.map"); _battleMap = new Battlefield(Render::GetSingleton()->GetRenderWindow().GetWidth(), Render::GetSingleton()->GetRenderWindow().GetHeight()); _player.push_back(EntityPlayer(0, "Okara")); _player[0].SetAI(1000); _player[0].SetPointerMapLevel(_mapLevel); _player[0].SetPointerBattlefield(_battleMap); _player[0].WarpTo(16, 5); // _player[0].WarpTo(0, 17); // _player[0].MoveTo(0, 1); AddNpcToMap(4, "PnjTest", 15, 5); _npc.back().SetScript("data/Script/NpcTest.npc"); AddNpcToMap(5, "PnjCombat", 17, 5); _npc.back().SetScript("data/Script/NpcCombat.npc"); _menuArmy = new MenuArmy(); _menuArmy->AddItem(&_player[0]); _frameSelectUnit = new FrameSelectUnit(); _frameSelectUnit->AddItem(&_player[0]); _battleInterface = new BattleInterface(); _uiNpc = new NpcDialogFrame(); /*sf::Clock timerFPS; unsigned int fps = 0; sf::String strFPS;*/ while(_loop) { Render::GetSingleton()->GetRenderWindow().GetEvent(_event); if(_event.Type == sf::Event::Closed) _loop = false; if(_battleStarted) { EventDuringBattle(); _battleMap->AnimationUnits(); if(_bFrameSelectUnit) _frameSelectUnit->Animation(); Render::GetSingleton()->GetRenderWindow().Clear(); DrawBattlefield(); } else { if(_bMenuArmy) _menuArmy->EventManagement(_event, Render::GetSingleton()->GetRenderWindow().GetInput().GetMouseX(), Render::GetSingleton()->GetRenderWindow().GetInput().GetMouseY()); EventManagement(); for(unsigned int i=0;i<_player.size();i++) _player[i].Animation(); if(_bMenuArmy) _menuArmy->Animation(); _mapLevel->Scrolling(_player[0].GetPos()); Render::GetSingleton()->GetRenderWindow().Clear(); Draw(); } //_window.Draw(strFPS); Render::GetSingleton()->GetRenderWindow().Display(); /*fps++; if(timerFPS.GetElapsedTime() >= 1.0f) { std::ostringstream oss; oss << fps; fps = 0; timerFPS.Reset(); strFPS.SetText("FPS : "+oss.str()); }*/ } }
/*--------------------------------------------------------------------------*/ void PegBitmapWindow::SetBitmap(PegBitmap* pNewBitmap) { mpBitmap = pNewBitmap; Invalidate(mReal); Draw(); }
void Hruler::mouseMoveEvent(QMouseEvent *m) { if (m_doc->isLoading()) return; if (textEditMode) { double ColWidth = (textWidth() - ColGap * (Cols - 1)) / Cols; int ColEnd, ColStart; double oldInd; if (RulerCode == rc_leftFrameDist || RulerCode == rc_rightFrameDist) { ColStart = 0; //textPosToLocal(0); ColEnd = width(); //textPosToLocal(textWidth()); } else { ColStart = textPosToLocal((ColWidth+ColGap)*(ActCol-1)); ColEnd = textPosToLocal((ColWidth+ColGap)*(ActCol-1) + ColWidth); } if ((Mpressed) && (m->y() < height()) && (m->y() > 0) && (m->x() > ColStart - m_doc->guidesPrefs().grabRadius) && (m->x() < ColEnd + m_doc->guidesPrefs().grabRadius)) { qApp->changeOverrideCursor(QCursor(Qt::SizeHorCursor)); double toplimit = textWidth() + RExtra - (ColGap * (Cols - 1))-1; double toplimit2 = textWidth() + Extra - (ColGap * (Cols - 1))-1; switch (RulerCode) { case rc_leftFrameDist: Extra -= (MouseX - m->x()) / Scaling; if (Extra < 0) Extra = 0; if (Extra > toplimit2) Extra = toplimit2; emit MarkerMoved(currItem->xPos(), textBase()-currItem->xPos()); repaint(); break; case rc_rightFrameDist: RExtra += (MouseX - m->x()) / Scaling; if (RExtra < 0) RExtra = 0; if (RExtra > toplimit) RExtra = toplimit; emit MarkerMoved(textBase(), toplimit -RExtra); repaint(); break; case rc_indentFirst: First -= (MouseX - m->x()) / Scaling; if (First+Indent < 0) First = -Indent; if (First+Indent > ColWidth) First = ColWidth-Indent; emit MarkerMoved(textBase(), First+Indent); repaint(); break; case rc_leftMargin: oldInd = Indent+First; Indent -= (MouseX - m->x()) / Scaling; if (Indent < 0) Indent = 0; if (Indent > ColWidth-1) Indent = ColWidth-1; First = oldInd - Indent; emit MarkerMoved(textBase(), Indent); repaint(); break; case rc_rightMargin: RMargin -= (MouseX - m->x()) / Scaling; if (RMargin < 0) RMargin = 0; if (RMargin > ColWidth-1) RMargin = ColWidth-1; emit MarkerMoved(textBase(), RMargin); repaint(); break; case rc_tab: TabValues[ActTab].tabPosition -= (MouseX - m->x()) / Scaling; if (TabValues[ActTab].tabPosition < 0) TabValues[ActTab].tabPosition = 0; if (TabValues[ActTab].tabPosition > ColWidth-1) TabValues[ActTab].tabPosition = ColWidth-1; emit MarkerMoved(textBase(), TabValues[ActTab].tabPosition); UpdateTabList(); repaint(); break; default: break; } MouseX = m->x(); /* if (RulerCode != rc_none) { QPoint py = m_view->viewport()->mapFromGlobal(m->globalPos()); QPainter p; p.begin(m_view->viewport()); p.setCompositionMode(QPainter::CompositionMode_Xor); p.setPen(QPen(Qt::white, 1, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin)); QPoint out = m_view->contentsToViewport(QPoint(0, qRound(m_doc->currentPage()->yOffset() * Scaling))); p.drawLine(Markp, out.y(), Markp, out.y()+qRound(m_doc->currentPage()->height() * Scaling)); p.drawLine(py.x(), out.y(), py.x(), out.y()+qRound(m_doc->currentPage()->height() * Scaling)); p.end(); Markp = py.x(); }*/ return; } if ((!Mpressed) && (m->y() < height()) && (m->y() > 0) && (m->x() > ColStart - 2*m_doc->guidesPrefs().grabRadius) && (m->x() < ColEnd + 2*m_doc->guidesPrefs().grabRadius)) { setCursor(IconManager::instance()->loadCursor("tab.png", 3)); switch(findRulerHandle(m->pos(), m_doc->guidesPrefs().grabRadius)) { case rc_leftFrameDist: setCursor(QCursor(Qt::SplitHCursor)); break; case rc_rightFrameDist: setCursor(QCursor(Qt::SplitHCursor)); break; case rc_indentFirst: setCursor(QCursor(Qt::SizeHorCursor)); break; case rc_leftMargin: setCursor(QCursor(Qt::SizeHorCursor)); break; case rc_rightMargin: setCursor(QCursor(Qt::SizeHorCursor)); break; case rc_tab: setCursor(QCursor(Qt::SizeHorCursor)); break; } Draw(m->x()); double marker = localToTextPos(m->x()); emit MarkerMoved(textBase(), marker); return; } if ((Mpressed) && (RulerCode == rc_tab) && ((m->y() > height()) || (m->y() < 0))) { setCursor(IconManager::instance()->loadCursor("DelPoint.png", 1, 1)); return; } setCursor(QCursor(Qt::ArrowCursor)); } else { if (Mpressed) { rulerGesture->mouseMoveEvent(m); } else setCursor(QCursor(Qt::ArrowCursor)); } }
static void * MoveLineToLayer (LayerType *Layer, LineType *Line) { struct via_info info; BoxType sb; LineType *newone; void *ptr1, *ptr2, *ptr3; if (TEST_FLAG (LOCKFLAG, Line)) { Message (_("Sorry, the object is locked\n")); return NULL; } if (Dest == Layer && Layer->On) { DrawLine (Layer, Line); Draw (); } if (((long int) Dest == -1) || Dest == Layer) return (Line); AddObjectToMoveToLayerUndoList (LINE_TYPE, Layer, Line, Line); if (Layer->On) EraseLine (Line); RestoreToPolygon (PCB->Data, LINE_TYPE, Layer, Line); newone = (LineType *)MoveLineToLayerLowLevel (Layer, Line, Dest); Line = NULL; ClearFromPolygon (PCB->Data, LINE_TYPE, Dest, newone); if (Dest->On) DrawLine (Dest, newone); Draw (); if (!PCB->ViaOn || MoreToCome || GetLayerGroupNumberByPointer (Layer) == GetLayerGroupNumberByPointer (Dest) || TEST_SILK_LAYER(Layer) || TEST_SILK_LAYER(Dest)) return (newone); /* consider via at Point1 */ sb.X1 = newone->Point1.X - newone->Thickness / 2; sb.X2 = newone->Point1.X + newone->Thickness / 2; sb.Y1 = newone->Point1.Y - newone->Thickness / 2; sb.Y2 = newone->Point1.Y + newone->Thickness / 2; if ((SearchObjectByLocation (PIN_TYPES, &ptr1, &ptr2, &ptr3, newone->Point1.X, newone->Point1.Y, Settings.ViaThickness / 2) == NO_TYPE)) { info.X = newone->Point1.X; info.Y = newone->Point1.Y; if (setjmp (info.env) == 0) r_search (Layer->line_tree, &sb, NULL, moveline_callback, &info); } /* consider via at Point2 */ sb.X1 = newone->Point2.X - newone->Thickness / 2; sb.X2 = newone->Point2.X + newone->Thickness / 2; sb.Y1 = newone->Point2.Y - newone->Thickness / 2; sb.Y2 = newone->Point2.Y + newone->Thickness / 2; if ((SearchObjectByLocation (PIN_TYPES, &ptr1, &ptr2, &ptr3, newone->Point2.X, newone->Point2.Y, Settings.ViaThickness / 2) == NO_TYPE)) { info.X = newone->Point2.X; info.Y = newone->Point2.Y; if (setjmp (info.env) == 0) r_search (Layer->line_tree, &sb, NULL, moveline_callback, &info); } Draw (); return (newone); }
void findtruthpp() { seth(10,0,1); auto hmcppxJTrue = geth("hmcppxJTrue","true;x_{J};Event fractions"); auto hmcppxJTrueTag = geth("hmcppxJTrueTag","true tagged;x_{J};Event fractions"); auto hmcppxJTrueTagCorr = geth("hmcppxJTrueTagCorr","true tagged corrected;x_{J};Event fractions"); TFile *fmcpp = new TFile(config.getFileName_djt("mcppbfa")); Fill(fmcpp,[&] (dict &m) { if (m["pthat"]<pthatcut) return; if (m[pairCodeSB1]!=0) return; // if (m["pthat"]<80) return; // if (m["bProdCode"]!=1) return; float w = m["weight"]*processweight((int)m["bProdCode"]); // float w = m["weight"]; // if (m["bProdCode"]==2) return; float corr = tageffcorrectionpp(m["jtpt1"],m["jteta1"],m[jtptSB],m[jtetaSB]); float wb = w*corr; if (m["jtpt1"]>pt1cut && m["refpt1"]>50 && abs(m["refparton_flavorForB1"])==5 && m[jtptSB]>pt2cut && m[dphiSB1]>PI23) hmcppxJTrue->Fill(m[jtptSB]/m["jtpt1"],w); if (m["jtpt1"]>pt1cut && m["refpt1"]>50 && abs(m["refparton_flavorForB1"])==5 && m[jtptSB]>pt2cut && m[dphiSB1]>PI23 && m["discr_csvV1_1"]>0.9 && m[discr_csvV1_SB]>0.9) { hmcppxJTrueTag->Fill(m[jtptSB]/m["jtpt1"],w); hmcppxJTrueTagCorr->Fill(m[jtptSB]/m["jtpt1"],wb); } }); NormalizeAllHists(); plotputmean = true; plotytitle = "Event fractions"; plotdivide = false; // aktstring += "R=0.4 |#eta|<2.0"; // plotsecondline = Form("p_{T,1}>%d GeV, p_{T,2}>%d GeV", (int)pt1cut, (int)pt2cut); // plotthirdline = "#Delta#phi>2/3#pi"; plottextposy = 0.8; plottextposx = 0.2; plotmeanposy = 0.43; plotymax = 0.2; plotymin = 0; plotlegendpos = BottomRight;//TopLeft; aktstring = "pp"; SetMC({hmcppxJTrue,hmcppxJTrueTag,hmcppxJTrueTagCorr}); SetData({hmcppxJTrue}); Draw({hmcppxJTrue,hmcppxJTrueTag,hmcppxJTrueTagCorr}); hmcppxJTrue->SetMinimum(0); hmcppxJTrue->SetMaximum(0.3); hmcppxJTrue->SetLineWidth(2); hmcppxJTrue->SetMarkerStyle(kNone); hmcppxJTrue->SetFillStyle(0); hmcppxJTrueTag->SetMarkerStyle(kOpenCircle); hmcppxJTrueTagCorr->SetMarkerStyle(kOpenSquare); plotymax = 0.3; SetB({hmcppxJTrue,hmcppxJTrueTag,hmcppxJTrueTagCorr}); float xjtrue = hmcppxJTrue->GetMean(); float xjtruetag = hmcppxJTrueTag->GetMean(); float xjtruetagcorr = hmcppxJTrueTagCorr->GetMean(); float exjtrue = hmcppxJTrue->GetMeanError(); float exjtruetag = hmcppxJTrueTag->GetMeanError(); float exjtruetagcorr = hmcppxJTrueTagCorr->GetMeanError(); auto c = getc(); hmcppxJTrue->Draw("hist"); hmcppxJTrueTag->Draw("E1,same"); hmcppxJTrueTagCorr->Draw("E1,same"); plotlegendpos = TopLeft; auto l = getLegend(); l->AddEntry(hmcppxJTrue,Form("b-dijets, #LTx_{J}#GT=%.3f#pm%.3f",xjtrue,exjtrue),"L"); l->AddEntry(hmcppxJTrueTag,Form("uncorrected, #LTx_{J}#GT=%.3f#pm%.3f",xjtruetag,exjtruetag),"P"); l->AddEntry(hmcppxJTrueTagCorr,Form("corrected, #LTx_{J}#GT=%.3f#pm%.3f",xjtruetagcorr,exjtruetagcorr),"P"); l->Draw(); TLatex *Tl = new TLatex(); Tl->DrawLatexNDC(0.2, 0.8, aktstring); SavePlot(c,"closurepp"); }
NS_IMETHODIMP MediaEngineTabVideoSource::Notify(nsITimer*) { Draw(); return NS_OK; }