void qPBReaderDocView::ShrinkFonts(double step) { TRSCOPE(view, "qPBReaderDocView::ShrinkFonts"); double dm = GetMultiplier(); if (dm > step) { SetViewZoom(dm - step); } }
void WaningEffectMapAbstract::Update(float dt) { float multiplier = GetMultiplier( m_TimeSinceStart ); m_EffectCurrent = multiplier * m_EffectOriginal; if( m_ExpireAtDurationMapEnd ) { m_Expired = m_DurationMap.isAtEnd( m_TimeSinceStart ); } m_TimeSinceStart += dt; }
void Clock::Tick( bool GamePaused /*= false*/, const bool DoGameTick /*= true*/ ) { XTRACE_FUNCTION; #if BUILD_WINDOWS_NO_SDL LARGE_INTEGER Counter; QueryPerformanceCounter( &Counter ); CLOCK_T PhysicalTime = ( Counter.QuadPart - m_PhysicalBaseTime ); #endif #if BUILD_SDL Uint64 Counter = SDL_GetPerformanceCounter(); CLOCK_T PhysicalTime = ( Counter - m_PhysicalBaseTime ); #endif m_PhysicalDeltaTime = PhysicalTime - m_PhysicalCurrentTime; m_MachineDeltaTime = m_UseFixedMachineDeltaTime ? m_FixedMachineDeltaTime : CounterToSeconds( m_PhysicalDeltaTime ); m_PhysicalCurrentTime = PhysicalTime; m_MachineCurrentTime = m_UseFixedMachineDeltaTime ? ( m_MachineCurrentTime + m_FixedMachineDeltaTime ) : CounterToSeconds( m_PhysicalCurrentTime ); if( DoGameTick ) { if( GamePaused ) { m_GameDeltaTime = 0.0f; } else if( m_MultiplierRequests.Size() ) { TickMultiplierRequests( m_MachineDeltaTime ); m_GameDeltaTime = m_MachineDeltaTime * GetMultiplier(); } else { m_GameDeltaTime = m_MachineDeltaTime; } // Clamp the upper range of game delta time to prevent hitches from // causing instability in the sim. This is done here instead of when // returning the value so that it actually does affect the game // current time as well. if( m_GameDeltaTimeMax > 0.0f && m_GameDeltaTime > m_GameDeltaTimeMax ) { m_GameDeltaTime = m_GameDeltaTimeMax; } m_GameCurrentTime = m_GameCurrentTime + m_GameDeltaTime; // NOTE: Accumulates drift } ++m_TickCount; }
void qPBReaderDocView::SetMultiplier(double val) { TRSCOPE(view, "qPBReaderDocView::SetMultiplier"); double oldVal = GetMultiplier(); setZoomFactor(val); if (val != oldVal) { qPBReaderPlatform::ShowHourGlass(); _pDoc->UpdateContentsSizeForPagedMode(); emit MagnificationChanged(val); } }
long SkewInt(long nLow, long nHigh, long nStream, double skewVal, long n) /* * */ { double zipf; double dRange; long nTemp; double multiplier; double Czn; long numDistinctValuesGenerated; /* check for validity of skewVal */ if(skewVal < 0 || skewVal > 5) zipf = 0; /* assume uniform */ else if(skewVal==5.0) { /* special case */ /* check if any values have been generated for this column */ if(NumDistinctValuesGenerated[nStream]==0) { /* pick a skew value to be used for this column*/ zipf = (int) UnifInt(0, 4, 0); ColumnSkewValue[nStream] = zipf; } else { /* column skew value has been initialized before */ zipf = ColumnSkewValue[nStream]; } } else { /* skewVal is between 0 and 4 */ zipf = skewVal; } /* If no values have been generated for this stream as yet, get multiplier */ if(NumDistinctValuesGenerated[nStream]==0) { Multiplier[nStream] = GetMultiplier(n, zipf); } multiplier = Multiplier[nStream]; /* * Check how many copies of the current value * have already been generated for this stream. * If we have generated enough, proceed to * next value, and decide how many copies of * this value should be generated. */ if(CurrentValueCounter[nStream] == CurrentValueTarget[nStream]) { /* proceed to next value */ if (nStream < 0 || nStream > MAX_STREAM) nStream = 0; if (nLow == nHigh) nTemp = nLow; else { if (nLow > nHigh) { nTemp = nLow; nLow = nHigh; nHigh = nTemp; } dRange = (double) (nHigh - nLow + 1); Seed[nStream] = NextRand(Seed[nStream]); nTemp = (long) (((double) Seed[nStream] / dM) * (dRange)); nTemp += nLow; CurrentValue[nStream] = nTemp; } } else { /* return another copy of current value */ nTemp = CurrentValue[nStream]; CurrentValueCounter[nStream]++; return nTemp; } /* * check how many distinct values for this column * have already been generated. */ numDistinctValuesGenerated = NumDistinctValuesGenerated[nStream] + 1; if(n<1) n = (nHigh - nLow + 1); /* * zipf is guaranteed to be in the range 0..4 * pick the multiplier if(zipf == 0) multiplier = n; else if(zipf==1) multiplier = log(n) + 0.577 ; else if(zipf==2) multiplier = (PI*PI)/6.0; else if(zipf==3) multiplier = 1.202; else if(zipf==4) multiplier = (PI*PI*PI*PI)/90.0; */ Czn = n/multiplier; CurrentValueTarget[nStream]= (long) (Czn/pow((double)numDistinctValuesGenerated, zipf)); /* ensure that there is at least one value*/ CurrentValueTarget[nStream] = (CurrentValueTarget[nStream] < 1) ? 1: CurrentValueTarget[nStream]; CurrentValueCounter[nStream] = 1; NumDistinctValuesGenerated[nStream]++; return nTemp; }
void qPBReaderDocView::MagnifyFonts(double step) { TRSCOPE(view, "qPBReaderDocView::MagnifyFonts"); SetViewZoom(GetMultiplier() + step); }
wxBitmap FbSearchCombo::RenderButtonBitmap() { wxSize sizeText = GetBestSize(); int y = sizeText.y - 4; int x = sizeText.y - 4; //=============================================================================== // begin drawing code //=============================================================================== // image stats // force width:height ratio if ( 14*x > y*20 ) { // x is too big x = y*20/14; } else { // y is too big y = x*14/20; } // glass 11x11, top left corner // handle (9,9)-(13,13) // drop (13,16)-(19,6)-(16,9) int multiplier = GetMultiplier(); int penWidth = multiplier * 1; penWidth = penWidth * x / 20; wxBitmap bitmap( multiplier*x, multiplier*y ); wxMemoryDC mem; wxColour bg = GetBackgroundColour(); wxColour fg = mem.GetTextForeground(); bg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); mem.SelectObject(bitmap); // clear background mem.SetBrush( wxBrush(bg) ); mem.SetPen( wxPen(bg) ); mem.DrawRectangle(0,0,bitmap.GetWidth(),bitmap.GetHeight()); // draw drop glass mem.SetBrush( wxBrush(fg) ); mem.SetPen( wxPen(fg) ); int glassBase = 5 * x / 20; int glassFactor = 2*glassBase + 1; int radius = multiplier*glassFactor/2; mem.DrawCircle(radius,radius,radius); mem.SetBrush( wxBrush(bg) ); mem.SetPen( wxPen(bg) ); mem.DrawCircle(radius,radius,radius-penWidth); penWidth = penWidth * 2; // draw handle int lineStart = radius + (radius-penWidth/2) * 707 / 1000; // 707 / 1000 = 0.707 = 1/sqrt(2); mem.SetPen( wxPen(fg) ); mem.SetBrush( wxBrush(fg) ); int handleCornerShift = penWidth * 707 / 1000 / 2; // 707 / 1000 = 0.707 = 1/sqrt(2); handleCornerShift = handleCornerShift > 0 ? handleCornerShift : 1; int handleBase = 4 * x / 20; int handleLength = 2*handleBase+1; wxPoint handlePolygon[] = { wxPoint(-handleCornerShift,+handleCornerShift), wxPoint(+handleCornerShift,-handleCornerShift), wxPoint(multiplier*handleLength/2+handleCornerShift,multiplier*handleLength/2-handleCornerShift), wxPoint(multiplier*handleLength/2-handleCornerShift,multiplier*handleLength/2+handleCornerShift), }; mem.DrawPolygon(WXSIZEOF(handlePolygon),handlePolygon,lineStart,lineStart); //=============================================================================== // end drawing code //=============================================================================== if ( multiplier != 1 ) { wxImage image = bitmap.ConvertToImage(); image.Rescale(x,y); bitmap = wxBitmap( image ); } mem.SelectObject(wxNullBitmap); // Finalize transparency with a mask wxMask *mask = new wxMask(bitmap, bg); bitmap.SetMask(mask); bitmap = bitmap.GetSubBitmap(wxRect(0,0, y,y)); return bitmap; }