void GlueMapWindow::RenderTrail(Canvas &canvas, const RasterPoint aircraft_pos) const { unsigned min_time = 0; if (GetDisplayMode() == DM_CIRCLING) { min_time = max(0, (int)Basic().time - 600); } else { switch(SettingsMap().trail_length) { case TRAIL_OFF: return; case TRAIL_LONG: min_time = max(0, (int)Basic().time - 3600); break; case TRAIL_SHORT: min_time = max(0, (int)Basic().time - 600); break; case TRAIL_FULL: min_time = 0; // full break; } } DrawTrail(canvas, aircraft_pos, min_time, SettingsMap().EnableTrailDrift && GetDisplayMode() == DM_CIRCLING); }
void GlueMapWindow::UpdateMapScale() { /* not using MapWindowBlackboard here because these methods are called by the main thread */ const DerivedInfo &calculated = CommonInterface::Calculated(); const MapSettings &settings = CommonInterface::GetMapSettings(); if (GetDisplayMode() == DM_CIRCLING && settings.circle_zoom_enabled) return; if (!IsNearSelf()) return; fixed wpd = calculated.auto_zoom_distance; if (settings.auto_zoom_enabled && positive(wpd)) { // Calculate distance percentage between plane symbol and map edge // 50: centered 100: at edge of map int AutoZoomFactor = (GetDisplayMode() == DM_CIRCLING) ? 50 : 100 - settings.glider_screen_position; // Leave 5% of full distance for target display AutoZoomFactor -= 5; // Adjust to account for map scale units AutoZoomFactor *= 8; wpd = wpd / ((fixed) AutoZoomFactor / fixed_int_constant(100)); // Clip map auto zoom range to reasonable values wpd = max(fixed_int_constant(525), min(settings.max_auto_zoom_distance / fixed_int_constant(10), wpd)); visible_projection.SetFreeMapScale(wpd); } }
void GlueMapWindow::DrawFlightMode(Canvas &canvas, const PixelRect &rc) const { PixelScalar offset = 0; // draw logger status if (logger != nullptr && logger->IsLoggerActive()) { bool flip = (Basic().date_time_utc.second % 2) == 0; const MaskedIcon &icon = flip ? look.logger_on_icon : look.logger_off_icon; offset = icon.GetSize().cx; icon.Draw(canvas, rc.right - offset, rc.bottom - icon.GetSize().cy); } // draw flight mode const MaskedIcon *bmp; if (Calculated().common_stats.task_type == TaskType::ABORT) bmp = &look.abort_mode_icon; else if (GetDisplayMode() == DisplayMode::CIRCLING) bmp = &look.climb_mode_icon; else if (GetDisplayMode() == DisplayMode::FINAL_GLIDE) bmp = &look.final_glide_mode_icon; else bmp = &look.cruise_mode_icon; offset += bmp->GetSize().cx + Layout::Scale(6); bmp->Draw(canvas, rc.right - offset, rc.bottom - bmp->GetSize().cy - Layout::Scale(4)); // draw flarm status if (!GetMapSettings().show_flarm_alarm_level) // Don't show indicator when the gauge is indicating the traffic anyway return; const FlarmStatus &flarm = Basic().flarm.status; if (!flarm.available) return; switch (flarm.alarm_level) { case FlarmTraffic::AlarmType::NONE: bmp = &look.traffic_safe_icon; break; case FlarmTraffic::AlarmType::LOW: case FlarmTraffic::AlarmType::INFO_ALERT: bmp = &look.traffic_warning_icon; break; case FlarmTraffic::AlarmType::IMPORTANT: case FlarmTraffic::AlarmType::URGENT: bmp = &look.traffic_alarm_icon; break; }; offset += bmp->GetSize().cx + Layout::Scale(6); bmp->Draw(canvas, rc.right - offset, rc.bottom - bmp->GetSize().cy - Layout::Scale(2)); }
void GlueMapWindow::DrawFlightMode(Canvas &canvas, const PixelRect &rc) const { int offset = 0; // draw logger status if (logger != NULL && logger->isLoggerActive()) { bool flip = (Basic().date_time_utc.second % 2) == 0; MaskedIcon &icon = flip ? Graphics::hLogger : Graphics::hLoggerOff; offset = icon.get_size().cx; icon.draw(canvas, rc.right - offset, rc.bottom - icon.get_size().cy); } // draw flight mode MaskedIcon *bmp; if (task != NULL && (task->get_mode() == TaskManager::MODE_ABORT)) bmp = &Graphics::hAbort; else if (GetDisplayMode() == DM_CIRCLING) bmp = &Graphics::hClimb; else if (GetDisplayMode() == DM_FINAL_GLIDE) bmp = &Graphics::hFinalGlide; else bmp = &Graphics::hCruise; offset += bmp->get_size().cx + Layout::Scale(6); bmp->draw(canvas, rc.right - offset, rc.bottom - bmp->get_size().cy - Layout::Scale(4)); // draw flarm status if (CommonInterface::GetUISettings().enable_flarm_gauge) // Don't show indicator when the gauge is indicating the traffic anyway return; const FLARM_STATE &flarm = Basic().flarm; if (!flarm.available || flarm.GetActiveTrafficCount() == 0) return; switch (flarm.alarm_level) { case 0: bmp = &Graphics::hBmpTrafficSafe; break; case 1: bmp = &Graphics::hBmpTrafficWarning; break; case 2: case 3: bmp = &Graphics::hBmpTrafficAlarm; break; }; offset += bmp->get_size().cx + Layout::Scale(6); bmp->draw(canvas, rc.right - offset, rc.bottom - bmp->get_size().cy - Layout::Scale(2)); }
//-------------------------------------------------------------------------- bool WindowsVideoDevice::AddDisplay(const VeChar8* pcDeviceName) noexcept { VeDebugOutputCore("Display: %s\n", pcDeviceName); VeDisplayMode kMode; if (!GetDisplayMode(pcDeviceName, ENUM_CURRENT_SETTINGS, &kMode)) { return false; } m_kDisplayList.resize(m_kDisplayList.size() + 1); VeVideoDisplay& kDisplay = m_kDisplayList.back(); VeDisplayData* pkDisplayData = VE_NEW VeDisplayData; VE_ASSERT(pkDisplayData); DISPLAY_DEVICEA device; device.cb = sizeof(device); if (EnumDisplayDevicesA(pcDeviceName, 0, &device, 0)) { kDisplay.m_kName = device.DeviceString; } kDisplay.m_kDesktopMode = kMode; kDisplay.m_kCurrentMode = kMode; kDisplay.m_spDriverData = pkDisplayData; return true; }
void GlueMapWindow::SwitchZoomClimb() { bool isclimb = (GetDisplayMode() == DM_CIRCLING); if (CommonInterface::GetMapSettings().circle_zoom_enabled) { if (isclimb != zoomclimb.last_isclimb) { if (isclimb) { // save cruise scale zoomclimb.CruiseScale = visible_projection.GetScale(); // switch to climb scale visible_projection.SetScale(zoomclimb.ClimbScale); } else { // leaving climb // save cruise scale zoomclimb.ClimbScale = visible_projection.GetScale(); // switch to climb scale visible_projection.SetScale(zoomclimb.CruiseScale); } SaveDisplayModeScales(); zoomclimb.last_isclimb = isclimb; } } }
void GlueMapWindow::DrawThermalBand(Canvas &canvas, const PixelRect &rc) const { if (Calculated().task_stats.total.solution_remaining.IsOk() && Calculated().task_stats.total.solution_remaining.altitude_difference > fixed(50) && GetDisplayMode() == DM_FINAL_GLIDE) return; PixelRect tb_rect; tb_rect.left = rc.left; tb_rect.right = rc.left+Layout::Scale(20); tb_rect.top = Layout::Scale(4); tb_rect.bottom = tb_rect.top+(rc.bottom-rc.top)/2-Layout::Scale(30); const ThermalBandRenderer &renderer = thermal_band_renderer; if (task != NULL) { ProtectedTaskManager::Lease task_manager(*task); renderer.DrawThermalBand(Basic(), Calculated(), SettingsComputer(), canvas, tb_rect, SettingsComputer().task, true, &task_manager->get_ordered_task_behaviour()); } else { renderer.DrawThermalBand(Basic(), Calculated(), SettingsComputer(), canvas, tb_rect, SettingsComputer().task, true); } }
//-------------------------------------------------------------------------- VE_BOOL VeWindows::AddDisplay(LPSTR DeviceName) { VeDevice::VideoDisplay kDisplay; DisplayData* pkDisplayData; VeDevice::DisplayMode kMode; DISPLAY_DEVICE kDevice; if(!GetDisplayMode(DeviceName, ENUM_CURRENT_SETTINGS, &kMode)) { return VE_FALSE; } pkDisplayData = VE_NEW DisplayData; if(!pkDisplayData) { return VE_FALSE; } VeStrcpy(pkDisplayData->m_acDeviceName, DeviceName); kDevice.cb = sizeof(kDevice); if (EnumDisplayDevices(DeviceName, 0, &kDevice, 0)) { kDisplay.m_kName = kDevice.DeviceString; } kDisplay.m_kDesktopMode = kMode; kDisplay.m_kCurrentMode = kMode; kDisplay.m_spDriverData = pkDisplayData; m_kDisplays.PushBack(kDisplay); return VE_TRUE; }
void GlueMapWindow::DrawThermalBand(Canvas &canvas, const PixelRect &rc) const { if (Calculated().task_stats.total.solution_remaining.IsOk() && Calculated().task_stats.total.solution_remaining.altitude_difference > 50 && GetDisplayMode() == DisplayMode::FINAL_GLIDE) return; PixelRect tb_rect; tb_rect.left = rc.left; tb_rect.right = rc.left+Layout::Scale(20); tb_rect.top = Layout::Scale(2); tb_rect.bottom = (rc.bottom-rc.top)/5 - Layout::Scale(2); const ThermalBandRenderer &renderer = thermal_band_renderer; if (task != nullptr) { ProtectedTaskManager::Lease task_manager(*task); renderer.DrawThermalBand(Basic(), Calculated(), GetComputerSettings(), canvas, tb_rect, GetComputerSettings().task, true, &task_manager->GetOrderedTask().GetOrderedTaskSettings()); } else { renderer.DrawThermalBand(Basic(), Calculated(), GetComputerSettings(), canvas, tb_rect, GetComputerSettings().task, true); } }
void GlueMapWindow::UpdateScreenAngle() { /* not using MapWindowBlackboard here because these methods are called by the main thread */ const NMEAInfo &basic = CommonInterface::Basic(); const DerivedInfo &calculated = CommonInterface::Calculated(); const MapSettings &settings = CommonInterface::GetMapSettings(); DisplayOrientation orientation = (GetDisplayMode() == DM_CIRCLING) ? settings.circling_orientation : settings.cruise_orientation; if (orientation == TARGETUP && calculated.task_stats.current_leg.vector_remaining.IsValid()) visible_projection.SetScreenAngle(calculated.task_stats.current_leg. vector_remaining.bearing); else if (orientation == NORTHUP || !basic.track_available) visible_projection.SetScreenAngle(Angle::Zero()); else // normal, glider forward visible_projection.SetScreenAngle(basic.track); compass_visible = orientation != NORTHUP; }
int SCREENMODE (int x, int y, int c) { int i = FindArg (ScrSizeArg (x, y)); if (i && (i < Num_args)) { bScreenModeOverride = 1; return gameStates.gfx.nStartScrMode = GetDisplayMode (SM (x, y)); } return -1; }
int SCREENMODE (int x, int y, int c) { int i = FindArg (ScrSizeArg (x, y)); if (i && (i < Num_args)) { gameStates.gfx.bOverride = 1; Game_window_w = x; Game_window_h = y; return gameStates.gfx.nStartScrMode = GetDisplayMode (SM (x, y)); } return -1; }
int SCREENMODE (int x, int y, int c) { int i = FindArg (ScrSizeArg (x, y)); if (i && (i < nArgCount)) { gameStates.gfx.bOverride = 1; gameData.render.window.w = x; gameData.render.window.h = y; return gameStates.gfx.nStartScrSize = GetDisplayMode (SM (x, y)); } return -1; }
void CMatchingDlg::UpdateChart(CCatalog &cat) { cmpack_chart_view_set_model(CMPACK_CHART_VIEW(m_Preview), NULL); if (m_ChartData) g_object_unref(m_ChartData); cat.SelectSelection(0); m_ChartData = cat.ToChartData(true, true, GetDisplayMode() == DISPLAY_IMAGE); cmpack_chart_view_set_negative(CMPACK_CHART_VIEW(m_Preview), m_Negative); cmpack_chart_view_set_orientation(CMPACK_CHART_VIEW(m_Preview), (m_RowsUpward ? CMPACK_ROWS_UPWARDS : CMPACK_ROWS_DOWNWARDS)); cmpack_chart_view_set_model(CMPACK_CHART_VIEW(m_Preview), m_ChartData); cmpack_chart_view_set_auto_zoom(CMPACK_CHART_VIEW(m_Preview), TRUE); }
void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event ) { int oldMode = GetDisplayMode(); switch( event.GetId() ) { case ID_TB_OPTIONS_SHOW_GBR_MODE_0: SetDisplayMode( 0 ); break; case ID_TB_OPTIONS_SHOW_GBR_MODE_1: SetDisplayMode( 1 ); break; case ID_TB_OPTIONS_SHOW_GBR_MODE_2: SetDisplayMode( 2 ); break; } if( GetDisplayMode() != oldMode ) m_canvas->Refresh(); }
void ChmModel::UpdateDisplayState(DisplayState *ds) { if (!ds->filePath || !str::EqI(ds->filePath, fileName)) str::ReplacePtr(&ds->filePath, fileName); ds->useDefaultState = !gGlobalPrefs->rememberStatePerDocument; str::ReplacePtr(&ds->displayMode, prefs::conv::FromDisplayMode(GetDisplayMode())); prefs::conv::FromZoom(&ds->zoom, GetZoomVirtual(), ds); ds->pageNo = CurrentPageNo(); ds->scrollPos = PointI(); }
void GlueMapWindow::SetMapScale(const fixed x) { MapWindow::SetMapScale(x); if (GetDisplayMode() == DM_CIRCLING && CommonInterface::GetMapSettings().circle_zoom_enabled) // save cruise scale zoomclimb.ClimbScale = visible_projection.GetScale(); else zoomclimb.CruiseScale = visible_projection.GetScale(); SaveDisplayModeScales(); }
void EbookController::UpdateDisplayState(DisplayState *ds) { if (!ds->filePath || !str::EqI(ds->filePath, doc.GetFilePath())) str::ReplacePtr(&ds->filePath, doc.GetFilePath()); ds->useDefaultState = !gGlobalPrefs->rememberStatePerDocument; // don't modify any of the other DisplayState values // as long as they're not used, so that the same // DisplayState settings can also be used for EbookEngine; // we get reasonable defaults from DisplayState's constructor anyway ds->reparseIdx = currPageReparseIdx; str::ReplacePtr(&ds->displayMode, prefs::conv::FromDisplayMode(GetDisplayMode())); }
/** * @brief * Sets a new display mode */ void WindowConnection::SetDisplayMode(const DisplayMode &sDisplayMode) { // Even if there's no change within the display mode, the real widget size currently may be another than the display size - // in this situation, it's usually nice if the widget size is updated to the set display size, so, we don't perform an early escape test // Are we currently within fullscreen mode? if (IsFullscreen()) { // Any state change? if (m_sDisplayMode.vSize != sDisplayMode.vSize || m_sDisplayMode.nColorBits != sDisplayMode.nColorBits || m_sDisplayMode.nFrequency != sDisplayMode.nFrequency) { // Copy over the new settings m_sDisplayMode = sDisplayMode; // Backup information const SurfaceWindow *pSurface = static_cast<SurfaceWindow*>(GetSurface()); if (pSurface && pSurface->GetNativeWindowHandle()) { // Backup information bool bFullscreen = IsFullscreen(); SurfacePainter *pPainter = GetSurface()->GetPainter(); GetSurface()->SetPainter(nullptr, false); // De-init window DeInit(); // Set new widget size m_pWidget->SetWindowState(StateNormal); m_pWidget->SetSize(GetDisplayMode().vSize); // Init widget InitWidget(bFullscreen); // Set widget into fullscreen state? (the display should now already have the proper size) m_pWidget->SetWindowState(StateFullscreen); // Set previous surface painter GetSurface()->SetPainter(pPainter, false); } } } else { // Just copy over the new settings m_sDisplayMode = sDisplayMode; } // Emit event by using the proper virtual method OnDisplayMode(); }
void GlueMapWindow::DrawThermalEstimate(Canvas &canvas) const { if (GetDisplayMode() == DM_CIRCLING) { // in circling mode, draw thermal at actual estimated location const MapWindowProjection &projection = render_projection; const ThermalLocatorInfo &thermal_locator = Calculated().thermal_locator; if (thermal_locator.estimate_valid) { RasterPoint sc; if (projection.GeoToScreenIfVisible(thermal_locator.estimate_location, sc)) { Graphics::hBmpThermalSource.draw(canvas, sc); } } } else { MapWindow::DrawThermalEstimate(canvas); } }
status_t ScreenMode::Set(const screen_mode& mode, int32 workspace) { if (!fUpdatedModes) UpdateOriginalModes(); BScreen screen(fWindow); if (workspace == ~0) workspace = current_workspace(); display_mode displayMode; if (!GetDisplayMode(mode, displayMode)) return B_ENTRY_NOT_FOUND; return screen.SetMode(workspace, &displayMode, true); }
status_t ScreenMode::GetRefreshLimits(const screen_mode& mode, float& min, float& max) { uint32 minClock, maxClock; display_mode displayMode; if (!GetDisplayMode(mode, displayMode)) return B_ERROR; BScreen screen(fWindow); if (screen.GetPixelClockLimits(&displayMode, &minClock, &maxClock) < B_OK) return B_ERROR; uint32 total = displayMode.timing.h_total * displayMode.timing.v_total; min = minClock * 1000.0 / total; max = maxClock * 1000.0 / total; return B_OK; }
//-------------------------------------------------------------------------- void VeWindows::_GetDisplayModes(VideoDisplay& kDisplay) { DisplayData* pkData = (DisplayData*)(VeRefObject*)(kDisplay.m_spDriverData); DisplayMode kMode; for(VeDWord i(0); ; ++i) { if(!GetDisplayMode(pkData->m_acDeviceName, i, &kMode)) { break; } if(VE_ISPIXELFORMAT_INDEXED(kMode.m_u32Format)) { continue; } if(kMode.m_u32Format != VE_PIXELFORMAT_UNKNOWN) { kDisplay.m_kDisplayModes[kMode.GetValue()] = kMode; } } }
//-------------------------------------------------------------------------- void WindowsVideoDevice::_GetDisplayModes(VeVideoDisplay* pkDisplay) noexcept { VeDisplayData* data = (VeDisplayData*)pkDisplay->m_spDriverData; VeDisplayMode mode; for (VeUInt32 i = 0;; ++i) { if (!GetDisplayMode(data->DeviceName, i, &mode)) { break; } if (VE_ISPIXELFORMAT_INDEXED(mode.m_u32Format)) { continue; } if (mode.m_u32Format != VE_PIXELFORMAT_UNKNOWN) { pkDisplay->m_kDisplayModes.push_back(mode); } } }
/** * @brief * Sets the window's fullscreen mode */ void WindowConnection::SetFullscreen(bool bFullscreen) { // Set fullscreen mode if (IsFullscreen() != bFullscreen) { // Backup information const SurfaceWindow *pSurface = static_cast<SurfaceWindow*>(GetSurface()); if (pSurface && pSurface->GetNativeWindowHandle()) { // Backup information SurfacePainter *pPainter = GetSurface()->GetPainter(); GetSurface()->SetPainter(nullptr, false); // De-init window DeInit(); // [HACK] If the widget is currently maximized, change back to normal - if we don't do this and changing from // maximized to fullscreen, the window title is visible within the fullscreen mode... if (bFullscreen && m_pWidget->GetWindowState() == StateMaximized) m_pWidget->SetWindowState(StateNormal); // Init widget InitWidget(bFullscreen); // Set previous surface painter GetSurface()->SetPainter(pPainter, false); // Set widget into fullscreen state? (the display should now already have the proper size) if (bFullscreen) { m_pWidget->SetWindowState(StateFullscreen); } else { m_pWidget->SetWindowState(StateNormal); m_pWidget->SetSize(GetDisplayMode().vSize); } // Emit event by using the proper virtual method OnFullscreenMode(); } } }
static M4Err DD_SetFullScreen(VideoOutput *dr, Bool bOn, u32 *outWidth, u32 *outHeight) { M4Err e; char *sOpt; u32 MaxWidth, MaxHeight; DDCONTEXT; if (!dd->width ||!dd->height) return M4BadParam; if (bOn == dd->fullscreen) return M4OK; dd->fullscreen = bOn; /*whenever changing card display mode relocate fastest YUV format for blit (since it depends on the dest pixel format)*/ dd->yuv_init = 0; if (dd->fullscreen) { char *sOpt = PMI_GetOpt(dr, "Video", "SwitchResolution"); if (sOpt && !stricmp(sOpt, "yes")) dd->switch_res = 1; /*get current or best fitting mode*/ if (GetDisplayMode(dd) != M4OK) return M4IOErr; } MaxWidth = MaxHeight = 0; sOpt = PMI_GetOpt(dr, "Video", "MaxResolution"); if (sOpt) sscanf(sOpt, "%dx%d", &MaxWidth, &MaxHeight); dd->is_resizing = 1; if (dd->is_3D_out) { DEVMODE settings; e = M4OK; /*recreate the GL context whenever changing display settings, it's safer...*/ DestroyObjects(dd); /*Setup FS*/ if (dd->fullscreen) { /*change display mode*/ if (dd->switch_res) { /*when switching res weird messages are sent to parent -> store current rect and post a size/pos message on restore */ if (!dd->owns_hwnd) { HWND hWnd = GetParent(dd->hWnd); if (!hWnd) hWnd = dd->hWnd; GetWindowRect(hWnd, &dd->rcWnd); } } if ((MaxWidth && (dd->fs_width >= MaxWidth)) || (MaxHeight && (dd->fs_height >= MaxHeight)) ) { dd->fs_width = MaxWidth; dd->fs_height = MaxHeight; } /*force size change (we do it whether we own or not the window)*/ dd->prev_styles = GetWindowLong(dd->hWnd, GWL_STYLE); GetWindowRect(dd->hWnd, &dd->rcChildWnd); SetWindowLong(dd->hWnd, GWL_STYLE, WS_POPUP); SetWindowPos(dd->hWnd, NULL, 0, 0, dd->fs_width, dd->fs_height, SWP_NOZORDER | SWP_SHOWWINDOW); SetForegroundWindow(dd->hWnd); memset(&settings, 0, sizeof(DEVMODE)); settings.dmSize = sizeof(DEVMODE); settings.dmPelsWidth = dd->fs_width; settings.dmPelsHeight = dd->fs_height; settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL ) { fprintf(stdout, "cannot change display settings...\n"); e = M4IOErr; } dd->NeedRestore = 1; dd->fs_store_width = dd->fs_width; dd->fs_store_height = dd->fs_height; } if (!e) e = DD_SetupOpenGL(dr); } else { e = InitDirectDraw(dr, dd->width, dd->height); } dd->is_resizing = 0; if (bOn) { dd->store_width = *outWidth; dd->store_height = *outHeight; *outWidth = dd->fs_width; *outHeight = dd->fs_height; } else { *outWidth = dd->store_width; *outHeight = dd->store_height; } return e; }
void GlueMapWindow::UpdateProjection() { const PixelRect rc = get_client_rect(); /* not using MapWindowBlackboard here because these methods are called by the main thread */ const NMEAInfo &basic = CommonInterface::Basic(); const DerivedInfo &calculated = CommonInterface::Calculated(); const MapSettings &settings_map = CommonInterface::GetMapSettings(); RasterPoint center; center.x = (rc.left + rc.right) / 2; center.y = (rc.top + rc.bottom) / 2; if (GetDisplayMode() == DM_CIRCLING || !IsNearSelf()) visible_projection.SetScreenOrigin(center.x, center.y); else if (settings_map.cruise_orientation == NORTHUP) { RasterPoint offset{0, 0}; if (settings_map.glider_screen_position != 50 && settings_map.map_shift_bias != MAP_SHIFT_BIAS_NONE) { fixed x = fixed_zero; fixed y = fixed_zero; if (settings_map.map_shift_bias == MAP_SHIFT_BIAS_TRACK) { if (basic.track_available && basic.ground_speed_available && /* 8 m/s ~ 30 km/h */ basic.ground_speed > fixed_int_constant(8)) { const auto sc = basic.track.Reciprocal().SinCos(); x = sc.first; y = sc.second; } } else if (settings_map.map_shift_bias == MAP_SHIFT_BIAS_TARGET) { if (calculated.task_stats.current_leg.solution_remaining.IsDefined()) { const auto sc =calculated.task_stats.current_leg.solution_remaining .vector.bearing.Reciprocal().SinCos(); x = sc.first; y = sc.second; } } fixed gspFactor = (fixed) (50 - settings_map.glider_screen_position) / 100; offset.x = PixelScalar(x * (rc.right - rc.left) * gspFactor); offset.y = PixelScalar(y * (rc.top - rc.bottom) * gspFactor); offsetHistory.add(offset); offset = offsetHistory.average(); } visible_projection.SetScreenOrigin(center.x + offset.x, center.y + offset.y); } else visible_projection.SetScreenOrigin(center.x, ((rc.top - rc.bottom) * settings_map.glider_screen_position / 100) + rc.bottom); if (!IsNearSelf()) { /* no-op - the Projection's location is updated manually */ } else if (GetDisplayMode() == DM_CIRCLING && calculated.thermal_locator.estimate_valid) { const fixed d_t = calculated.thermal_locator.estimate_location.Distance(basic.location); if (!positive(d_t)) { SetLocationLazy(basic.location); } else { const fixed d_max = Double(visible_projection.GetMapScale()); const fixed t = std::min(d_t, d_max)/d_t; SetLocation(basic.location.Interpolate(calculated.thermal_locator.estimate_location, t)); } } else // Pan is off SetLocationLazy(basic.location); visible_projection.UpdateScreenBounds(); }