void FOSVRHMD::AdjustViewRect(EStereoscopicPass StereoPass, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const { float screenScale = GetScreenScale(); if (mCustomPresent && mCustomPresent->IsInitialized()) { mCustomPresent->CalculateRenderTargetSize(SizeX, SizeY, screenScale); // FCustomPresent is expected to account for screenScale, // so we need to back it out here SizeX = int(float(SizeX) * (1.0f / screenScale)); SizeY = int(float(SizeY) * (1.0f / screenScale)); } else { auto leftEye = HMDDescription.GetDisplaySize(OSVRHMDDescription::LEFT_EYE); auto rightEye = HMDDescription.GetDisplaySize(OSVRHMDDescription::RIGHT_EYE); SizeX = leftEye.X + rightEye.X; SizeY = leftEye.Y; } SizeX = SizeX / 2; if (StereoPass == eSSP_RIGHT_EYE) { X += SizeX; } }
void MLIFont::Reinit() { EnsureUIThread(); // clean up first if (pTtfFont != NULL) { TTF_CloseFont(pTtfFont); } pTtfFont = NULL; free(pTtfFontMem); pTtfFontMem = NULL; cache.clear(); kernedWidthCache.clear(); #if defined(GAME_EXECUTABLE) || defined(UPDATER) if (fontId.length() > 0) { ttfFilePath = gpLocalizableContent->GetFontInfo(fontId).Filename; fontSize = gpLocalizableContent->GetFontInfo(fontId).PointSize; } #endif // setup scale scale = (GetIsFullscreen() ? GetScreenScale() : 1.0); // setup font #if defined(GAME_EXECUTABLE) || defined(UPDATER) pTtfFont = ResourceLoader::GetInstance()->LoadFont(ttfFilePath, fontSize * scale, &pTtfFontMem); #else pTtfFont = TTF_OpenFont(ttfFilePath.c_str(), fontSize * scale + 0.5); #endif }
bool MathPrintout::OnPrintPage(int num) { double screenScaleX, screenScaleY; double ppiScale; GroupCell* tmp; wxDC* dc = GetDC(); int marginX, marginY; GetPageMargins(&marginX, &marginY); ppiScale = GetPPIScale(); GetScreenScale(&screenScaleX, &screenScaleY); marginX += SCALE_PX(MC_BASE_INDENT, ppiScale); dc->SetUserScale(screenScaleX, screenScaleY); // Go to current page tmp = (GroupCell *)m_pages[num - 1]; // Print page if (tmp != NULL) { if (tmp->GetGroupType() == GC_TYPE_PAGEBREAK) tmp = (GroupCell *)tmp->m_next; if (tmp == NULL) return true; wxPoint point; point.x = marginX; point.y = marginY + tmp->GetMaxCenter() + GetHeaderHeight(); wxConfigBase* config = wxConfig::Get(); int fontsize = 12; int drop = tmp->GetMaxDrop(); config->Read(wxT("fontsize"), &fontsize); PrintHeader(num, dc, ppiScale); CellParser parser(*dc, ppiScale); parser.SetIndent(marginX); while (tmp != NULL && tmp->GetGroupType() != GC_TYPE_PAGEBREAK) { tmp->Draw(parser, point, fontsize, false); if (tmp->m_next != NULL) { point.x = marginX; point.y += drop + tmp->m_next->GetMaxCenter(); point.y += SCALE_PX(MC_GROUP_SKIP, ppiScale); drop = tmp->m_next->GetMaxDrop(); } tmp = (GroupCell *)tmp->m_next; if (tmp == NULL || tmp->BreakPageHere()) break; } return true; } return false; }
void CSprite::Resize(void) { Type2<float> scale = GetScreenScale(); SDL_RenderSetScale(this->m_pRen, scale.x, scale.y); }
bool MathPrintout::OnPrintPage(int num) { double screenScaleX, screenScaleY; double ppiScale; GroupCell* tmp; wxDC* dc = GetDC(); int marginX, marginY; GetPageMargins(&marginX, &marginY); ppiScale = GetPPIScale(); GetScreenScale(&screenScaleX, &screenScaleY); marginX += SCALE_PX(MC_BASE_INDENT, ppiScale); dc->SetUserScale(screenScaleX, screenScaleY); // Go to current page tmp = (GroupCell *)m_pages[num - 1]; // Print page if (tmp != NULL) { if (tmp->GetGroupType() == GC_TYPE_PAGEBREAK) tmp = (GroupCell *)tmp->m_next; if (tmp == NULL) return true; wxPoint point; point.x = marginX; point.y = marginY + tmp->GetMaxCenter() + GetHeaderHeight(); wxConfigBase* config = wxConfig::Get(); int fontsize = 12; int drop = tmp->GetMaxDrop(); config->Read(wxT("fontsize"), &fontsize); PrintHeader(num, dc, ppiScale); CellParser parser(*dc, ppiScale); parser.SetIndent(marginX); // Inform the output routines that we are printing parser.SetPrinter(true); // Make sure that during print nothing is outside the crop rectangle MathCell::ClipToDrawRegion(true); while (tmp != NULL && tmp->GetGroupType() != GC_TYPE_PAGEBREAK) { // The following line seems to misteriously fix the "subsequent text // cells aren't printed" problem on linux. // No Idea why, though. dc->SetPen(wxPen(wxT("light grey"), 1, wxPENSTYLE_SOLID)); tmp->Draw(point, fontsize); if (tmp->m_next != NULL) { point.x = marginX; point.y += drop + tmp->m_next->GetMaxCenter(); point.y += SCALE_PX(MC_GROUP_SKIP, ppiScale); drop = tmp->m_next->GetMaxDrop(); } tmp = (GroupCell *)tmp->m_next; if (tmp == NULL || tmp->BreakPageHere()) break; } MathCell::ClipToDrawRegion(false); return true; } MathCell::ClipToDrawRegion(false); return false; }