void
ChartWindow::OnPaint(Canvas &canvas)
{
  canvas.ClearWhite();
  ChartRenderer renderer(look, canvas, canvas.GetRect());
  DrawChart(renderer);
}
void
LargeTextWindow::OnPaint(Canvas &canvas)
{
    canvas.ClearWhite();

    PixelRect rc(0, 0, canvas.GetWidth() - 1, canvas.GetHeight() - 1);
    canvas.DrawOutlineRectangle(rc.left, rc.top, rc.right, rc.bottom,
                                COLOR_BLACK);

    if (value.empty())
        return;

    const PixelScalar padding = Layout::GetTextPadding();
    rc.Grow(-padding);

    canvas.SetBackgroundTransparent();
    canvas.SetTextColor(COLOR_BLACK);

    rc.top -= origin * GetFont().GetHeight();

#ifndef USE_GDI
    canvas.Select(GetFont());
#endif
    canvas.DrawFormattedText(&rc, value.c_str(), DT_LEFT | DT_WORDBREAK);
}
void
TerrainPreviewWindow::OnPaint(Canvas &canvas)
{
  const GlueMapWindow *map = UIGlobals::GetMap();
  if (map == nullptr)
    return;

  MapWindowProjection projection = map->VisibleProjection();
  if (!projection.IsValid()) {
    /* TODO: initialise projection to middle of map instead of bailing
       out */
    canvas.ClearWhite();
    return;
  }

  projection.SetScreenSize(canvas.GetSize());
  projection.SetScreenOrigin(canvas.GetWidth() / 2, canvas.GetHeight() / 2);

  Angle sun_azimuth(Angle::Degrees(-45));
  if (renderer.GetSettings().slope_shading == SlopeShading::SUN &&
      CommonInterface::Calculated().sun_data_available)
    sun_azimuth = CommonInterface::Calculated().sun_azimuth;

  renderer.Generate(projection, sun_azimuth);

#ifdef ENABLE_OPENGL
  /* enable clipping because the OpenGL terrain renderer uses a large
     texture that exceeds the window dimensions */
  GLCanvasScissor scissor(canvas);
#endif

  renderer.Draw(canvas, projection);
}
void
InfoBoxPreview::OnPaint(Canvas &canvas)
{
  const unsigned i = this - previews;
  const bool is_current = i == current_preview;

  if (is_current)
    canvas.Clear(COLOR_BLACK);
  else
    canvas.ClearWhite();

  canvas.SelectHollowBrush();
  canvas.SelectBlackPen();
  canvas.Rectangle(0, 0, canvas.GetWidth() - 1, canvas.GetHeight() - 1);

  InfoBoxFactory::Type type = data.contents[i];
  const TCHAR *caption = type < InfoBoxFactory::NUM_TYPES
    ? InfoBoxFactory::GetCaption(type)
    : NULL;
  if (caption == NULL)
    caption = _("Invalid");
  else
    caption = gettext(caption);

  canvas.Select(*look->title.font);
  canvas.SetBackgroundTransparent();
  canvas.SetTextColor(is_current ? COLOR_WHITE : COLOR_BLACK);
  canvas.DrawText(2, 2, caption);
}
void
InfoBoxPreview::OnPaint(Canvas &canvas)
{
  const bool is_current = i == parent->GetCurrentInfoBox();

  if (is_current)
    canvas.Clear(COLOR_BLACK);
  else
    canvas.ClearWhite();

  canvas.SelectHollowBrush();
  canvas.SelectBlackPen();
  canvas.Rectangle(0, 0, canvas.GetWidth() - 1, canvas.GetHeight() - 1);

  InfoBoxFactory::Type type = parent->GetContents(i);
  const TCHAR *caption = type < InfoBoxFactory::NUM_TYPES
    ? InfoBoxFactory::GetCaption(type)
    : NULL;
  if (caption == NULL)
    caption = _("Invalid");
  else
    caption = gettext(caption);

  canvas.Select(parent->GetInfoBoxLook().title_font);
  canvas.SetBackgroundTransparent();
  canvas.SetTextColor(is_current ? COLOR_WHITE : COLOR_BLACK);
  canvas.DrawText(2, 2, caption);
}
  virtual void OnPaint(Canvas &canvas) override {
    canvas.ClearWhite();

    const GeoPoint a(Angle::Degrees(7.70722),
                     Angle::Degrees(51.052));
    const GeoPoint b(Angle::Degrees(11.5228),
                     Angle::Degrees(50.3972));

    WindowProjection projection;
    projection.SetScreenOrigin(canvas.GetWidth() / 2, canvas.GetHeight() / 2);
    projection.SetGeoLocation(a.Middle(b));
    projection.SetScreenSize(canvas.GetSize());
    projection.SetScaleFromRadius(fixed(400000));
    projection.UpdateScreenBounds();

    canvas.SelectBlackPen();
    canvas.SelectHollowBrush();

    RasterPoint pa = projection.GeoToScreen(a);
    canvas.DrawCircle(pa.x, pa.y, 4);

    RasterPoint pb = projection.GeoToScreen(b);
    canvas.DrawCircle(pb.x, pb.y, 4);

    RenderFAISector(canvas, projection, a, b, false, settings);
  }
Exemple #7
0
void
FlarmTrafficControl::OnPaint(Canvas &canvas)
{
  canvas.ClearWhite();

  PaintTaskDirection(canvas);
  FlarmTrafficWindow::Paint(canvas);
  PaintTrafficInfo(canvas);
}
  void OnPaint(Canvas &canvas) {
    canvas.ClearWhite();
    
    PixelRect rc = {
      0, 0, (PixelScalar)canvas.get_width(), (PixelScalar)canvas.get_height()
    };

    renderer.Draw(canvas, rc, calculated, glide_settings, true);
  }
Exemple #9
0
  /* virtual methods from AntiFlickerWindow */
  void OnPaintBuffer(Canvas &canvas) override {
    canvas.ClearWhite();

    if (!CommonInterface::Basic().attitude.IsBankAngleUseable() &&
        !CommonInterface::Basic().attitude.IsPitchAngleUseable())
      // TODO: paint "no data" hint
      return;

    HorizonRenderer::Draw(canvas, canvas.GetRect(), look, attitude);
  }
void
TaskMapButtonRenderer::DrawButton(Canvas &canvas, const PixelRect &rc,
                                  gcc_unused bool enabled,
                                  gcc_unused bool focused,
                                  bool pressed) const
{
  if (task == nullptr) {
    canvas.ClearWhite();
    return;
  }

  const PixelSize new_size(rc.right - rc.left,
                           rc.bottom - rc.top);
  if (!IsBufferValid(new_size)) {
    if (!buffer.IsDefined()) {
#ifdef ENABLE_OPENGL
      buffer.Create(new_size);
#else
      buffer.Create(canvas, new_size);
#endif
    } else
      buffer.Grow(new_size);

    size = new_size;

#ifdef ENABLE_OPENGL
    buffer.Begin(canvas);
#endif

    const PixelRect buffer_rc(0, 0, new_size.cx, new_size.cy);
    DrawTask(buffer, buffer_rc, look, *task);

#ifdef ENABLE_OPENGL
    buffer.Commit(canvas);
#endif
  } else {
#ifdef ENABLE_OPENGL
    buffer.CopyTo(canvas);
#endif
  }

#ifndef ENABLE_OPENGL
  canvas.Copy(buffer);
#endif

  if (pressed) {
#ifdef ENABLE_OPENGL
    const ScopeAlphaBlend alpha_blend;
    canvas.DrawFilledRectangle(rc, COLOR_YELLOW.WithAlpha(80));
#else
    canvas.InvertRectangle(rc);
#endif
  }
}
  virtual void OnPaint(Canvas &canvas) override {
    canvas.ClearWhite();

    const PixelRect rc = canvas.GetRect();
    PixelPoint pt = rc.GetCenter();

    canvas.SelectBlackPen();
    canvas.SelectHollowBrush();
    canvas.DrawCircle(pt.x, pt.y, 2);

    renderer.Draw(canvas, Angle::Zero(), wind, pt, rc, WindArrowStyle::ARROW_HEAD);
  }
Exemple #12
0
void
TextWindow::OnPaint(Canvas &canvas)
{
#ifndef ENABLE_OPENGL
  canvas.ClearWhite();
#endif

  if (!text.empty()) {
    canvas.SetTextColor(COLOR_BLACK);
    canvas.SetBackgroundTransparent();
    canvas.DrawText(1, 1, text.c_str());
  }
}
Exemple #13
0
void
OZWindow::OnPaint(Canvas &canvas)
{
  canvas.ClearWhite();
  if (oz == NULL)
    return;

  const int offset = 0;

  roz.Draw(canvas, OZRenderer::LAYER_SHADE, projection, *oz, offset);
  roz.Draw(canvas, OZRenderer::LAYER_INACTIVE, projection, *oz, offset);
  roz.Draw(canvas, OZRenderer::LAYER_ACTIVE, projection, *oz, offset);
}
Exemple #14
0
  virtual void OnPaint(Canvas &canvas) override {
#ifndef ENABLE_OPENGL
    if (!buffered) {
#endif
      canvas.ClearWhite();

      paint(canvas);
#ifndef ENABLE_OPENGL
    } else
      canvas.Copy(buffer);
#endif

    SingleWindow::OnPaint(canvas);
  }
void
SimulatorPromptWindow::OnPaint(Canvas &canvas)
{
  canvas.ClearWhite();
  logo_view.draw(canvas, logo_rect);

  canvas.Select(look.text_font);
  canvas.SetTextColor(COLOR_BLACK);
  canvas.SetBackgroundTransparent();
  canvas.DrawText(label_position.x, label_position.y,
                  _("What do you want to do?"));

  ContainerWindow::OnPaint(canvas);
}
Exemple #16
0
int main(int argc, char **argv)
{
  /* enable FreeType anti-aliasing, because we don't use dithering in
     this program */
  FreeType::mono = false;

  ScreenGlobalInit screen_init;
  Layout::Initialize({600, 800});

  Font::Initialise();
  Display::Rotate(DisplayOrientation::PORTRAIT);

  InitialiseFonts();

  {
    TopCanvas screen;
    screen.Create(PixelSize(100, 100), true, false);

    Canvas canvas = screen.Lock();
    if (canvas.IsDefined()) {
      /* all black first, to eliminate E-ink ghost images */
      canvas.Clear(COLOR_BLACK);
      screen.Flip();
      screen.Wait();

      /* disable dithering, render with 16 shades of gray, to make the
         (static) display more pretty */
      screen.SetEnableDither(false);

      /* draw the pictuer */
      canvas.ClearWhite();
      Draw(canvas);

      /* finish */
      screen.Unlock();
      screen.Flip();
      screen.Wait();
    }
  }

  /* now we can power off the Kobo; the picture remains on the
     screen */
  if (DetectKoboModel() == KoboModel::GLO_HD)
    //The GloHD needs -f to not clear screen
    execl("/sbin/poweroff", "poweroff", "-f", nullptr);
  else
    execl("/sbin/poweroff", "poweroff", nullptr);

  return 0;
}
Exemple #17
0
void
TopWindow::OnDestroy()
{
  /* clear the screen before exiting XCSoar */
  Canvas canvas = screen->Lock();
  if (canvas.IsDefined()) {
    canvas.Clear(COLOR_BLACK);
    screen->Flip();
    screen->Wait();

    canvas.ClearWhite();
    screen->Unlock();
    screen->Flip();
  }

  ContainerWindow::OnDestroy();
}
Exemple #18
0
  void OnPaint(Canvas &canvas) {
    canvas.ClearWhite();

    PixelRect rc = {
      0, 0, (PixelScalar)canvas.get_width(), (PixelScalar)canvas.get_height()
    };

    RasterPoint pt = {
      (PixelScalar)(rc.right / 2), (PixelScalar)(rc.bottom / 2)
    };

    canvas.SelectBlackPen();
    canvas.SelectHollowBrush();
    canvas.DrawCircle(pt.x, pt.y, 2);

    renderer.Draw(canvas, Angle::Zero(), wind, pt, rc, false);
  }
static void
OnImagePaint(gcc_unused WndOwnerDrawFrame *Sender, Canvas &canvas)
{
    canvas.ClearWhite();
    if (page >= 3 && page < 3 + (int)images.size()) {
        Bitmap &img = images[page-3];
        static const int zoom_factors[] = { 1, 2, 4, 8, 16, 32 };
        RasterPoint img_pos, screen_pos;
        PixelSize screen_size;
        PixelSize img_size = img.GetSize();
        fixed scale = std::min((fixed)canvas.get_width() / (fixed)img_size.cx,
                               (fixed)canvas.get_height() / (fixed)img_size.cy) *
                      zoom_factors[zoom];

        // centered image and optionally zoomed into the center of the image
        fixed scaled_size = img_size.cx * scale;
        if (scaled_size <= (fixed)canvas.get_width()) {
            img_pos.x = 0;
            screen_pos.x = (int) (((fixed)canvas.get_width() - scaled_size) / 2);
            screen_size.cx = (int) scaled_size;
        } else {
            scaled_size = (fixed)canvas.get_width() / scale;
            img_pos.x = (int) (((fixed)img_size.cx - scaled_size) / 2);
            img_size.cx = (int) scaled_size;
            screen_pos.x = 0;
            screen_size.cx = canvas.get_width();
        }
        scaled_size = img_size.cy * scale;
        if (scaled_size <= (fixed)canvas.get_height()) {
            img_pos.y = 0;
            screen_pos.y = (int) (((fixed)canvas.get_height() - scaled_size) / 2);
            screen_size.cy = (int) scaled_size;
        } else {
            scaled_size = (fixed)canvas.get_height() / scale;
            img_pos.y = (int) (((fixed)img_size.cy - scaled_size) / 2);
            img_size.cy = (int) scaled_size;
            screen_pos.y = 0;
            screen_size.cy = canvas.get_height();
        }
        canvas.Stretch(screen_pos.x, screen_pos.y, screen_size.cx, screen_size.cy,
                       img, img_pos.x, img_pos.y, img_size.cx, img_size.cy);
    }
}
Exemple #20
0
static void
OnLogoPaint(gcc_unused WndOwnerDrawFrame *Sender, Canvas &canvas)
{
  const UPixelScalar width = canvas.GetWidth();
  PixelScalar x = Layout::FastScale(10), y = x;

  canvas.ClearWhite();

  Bitmap title(width > 360 ? IDB_TITLE_HD : IDB_TITLE);

  // Determine title image size
  PixelSize title_size = title.GetSize();

  // Draw 'XCSoar N.N' title
  canvas.Copy(x, y, title_size.cx, title_size.cy, title, 0, 0);
  y += title_size.cy + Layout::FastScale(20);

  Font font;
  font.Load(GetStandardFontFace(), Layout::FastScale(16));
  canvas.Select(font);
  canvas.SetTextColor(COLOR_BLACK);
  canvas.SetBackgroundTransparent();

  canvas.DrawText(x, y, _T("version: "));
  canvas.DrawText(x + Layout::FastScale(80), y, XCSoar_VersionString);
  y += Layout::FastScale(22);

  canvas.DrawText(x, y, _T("date: "));
  canvas.DrawText(x + Layout::FastScale(80), y, _T(__DATE__));
#ifdef GIT_COMMIT_ID
  y += Layout::FastScale(22);

  canvas.DrawText(x, y, _T("git: "));
  canvas.DrawText(x + Layout::FastScale(80), y, _T(GIT_COMMIT_ID));
#endif
  y += Layout::FastScale(37);

  canvas.DrawText(x, y, _T("more information at"));
  y += Layout::FastScale(22);

  canvas.SetTextColor(COLOR_XCSOAR);
  canvas.DrawText(x, y, _T("http://www.xcsoar.org"));
}
Exemple #21
0
void
BackgroundRenderer::Draw(Canvas& canvas,
                         const WindowProjection& proj,
                         const TerrainRendererSettings &terrain_settings)
{
  canvas.ClearWhite();

  if (terrain_settings.enable && terrain != nullptr) {
    if (!renderer)
      // defer creation until first draw because
      // the buffer size, smoothing etc is set by the
      // loaded terrain properties
      renderer.reset(new TerrainRenderer(*terrain));

    renderer->SetSettings(terrain_settings);
    if (renderer->Generate(proj, shading_angle))
      renderer->Draw(canvas, proj);
  }
}
Exemple #22
0
void
WaypointDetailsWidget::OnImagePaint(Canvas &canvas, const PixelRect &rc)
{
  canvas.ClearWhite();
  if (page >= 3 && page < 3 + (int)images.size()) {
    Bitmap &img = images[page-3];
    static constexpr int zoom_factors[] = { 1, 2, 4, 8, 16, 32 };
    RasterPoint img_pos, screen_pos;
    PixelSize screen_size;
    PixelSize img_size = img.GetSize();
    fixed scale = std::min((fixed)canvas.GetWidth() / (fixed)img_size.cx,
                           (fixed)canvas.GetHeight() / (fixed)img_size.cy) *
                  zoom_factors[zoom];

    // centered image and optionally zoomed into the center of the image
    fixed scaled_size = img_size.cx * scale;
    if (scaled_size <= (fixed)canvas.GetWidth()) {
      img_pos.x = 0;
      screen_pos.x = (int) (((fixed)canvas.GetWidth() - scaled_size) / 2);
      screen_size.cx = (int) scaled_size;
    } else {
      scaled_size = (fixed)canvas.GetWidth() / scale;
      img_pos.x = (int) (((fixed)img_size.cx - scaled_size) / 2);
      img_size.cx = (int) scaled_size;
      screen_pos.x = 0;
      screen_size.cx = canvas.GetWidth();
    }
    scaled_size = img_size.cy * scale;
    if (scaled_size <= (fixed)canvas.GetHeight()) {
      img_pos.y = 0;
      screen_pos.y = (int) (((fixed)canvas.GetHeight() - scaled_size) / 2);
      screen_size.cy = (int) scaled_size;
    } else {
      scaled_size = (fixed)canvas.GetHeight() / scale;
      img_pos.y = (int) (((fixed)img_size.cy - scaled_size) / 2);
      img_size.cy = (int) scaled_size;
      screen_pos.y = 0;
      screen_size.cy = canvas.GetHeight();
    }
    canvas.Stretch(screen_pos.x, screen_pos.y, screen_size.cx, screen_size.cy,
                   img, img_pos.x, img_pos.y, img_size.cx, img_size.cy);
  }
}
Exemple #23
0
void
PopupMessage::OnPaint(Canvas &canvas)
{
  canvas.ClearWhite();

  auto rc = GetClientRect();
#ifndef USE_WINUSER
  canvas.DrawOutlineRectangle(rc.left, rc.top, rc.right, rc.bottom,
                              COLOR_BLACK);
#endif

  const int padding = Layout::GetTextPadding();
  rc.Grow(-padding);

  canvas.SetTextColor(look.text_color);
  canvas.SetBackgroundTransparent();
  canvas.Select(look.text_font);

  renderer.Draw(canvas, rc, text);
}
Exemple #24
0
void
TaskMapWindow::OnPaintBuffer(Canvas &canvas)
{
  if (task == nullptr) {
    canvas.ClearWhite();
    return;
  }

#ifdef ENABLE_OPENGL
  /* enable clipping */
  GLCanvasScissor scissor(canvas);
#endif

  const NMEAInfo &basic = CommonInterface::Basic();
  PaintTask(canvas, GetClientRect(), *task,
            basic.location_available ? basic.location : GeoPoint::Invalid(),
            CommonInterface::GetMapSettings(),
            look.task, look.airspace,
            terrain, &airspace_database,
            true);

}
Exemple #25
0
void
TaskListPanel::OnTaskPaint(WndOwnerDrawFrame *Sender, Canvas &canvas)
{
  OrderedTask* ordered_task = get_task_to_display();

  if (ordered_task == NULL) {
    canvas.ClearWhite();
    return;
  }

#ifdef ENABLE_OPENGL
  /* enable clipping */
  GLCanvasScissor scissor(canvas);
#endif

  const Look &look = CommonInterface::main_window.GetLook();
  PaintTask(canvas, Sender->get_client_rect(), *ordered_task,
            XCSoarInterface::Basic().location,
            XCSoarInterface::GetMapSettings(),
            look.map.task, look.map.airspace,
            terrain);
}
Exemple #26
0
void
OZWindow::OnPaint(Canvas &canvas)
{
    canvas.ClearWhite();
    if (oz == NULL)
        return;

    const int offset = 0;

    roz.Draw(canvas, OZRenderer::LAYER_SHADE, projection, *oz, offset);
    roz.Draw(canvas, OZRenderer::LAYER_INACTIVE, projection, *oz, offset);
    roz.Draw(canvas, OZRenderer::LAYER_ACTIVE, projection, *oz, offset);

    /* debugging for ObservationZone::GetBoundary() */
    Pen pen(1, COLOR_RED);
    canvas.Select(pen);
    const OZBoundary boundary = oz->GetBoundary();
    for (auto i = boundary.begin(), end = boundary.end(); i != end; ++i) {
        RasterPoint p = projection.GeoToScreen(*i);
        canvas.DrawLine(p.x - 3, p.y - 3, p.x + 3, p.y + 3);
        canvas.DrawLine(p.x + 3, p.y - 3, p.x - 3, p.y + 3);
    }
}
Exemple #27
0
void
MapWindow::OnPaint(Canvas &canvas)
{
#ifdef ENABLE_OPENGL
  DoubleBufferWindow::OnPaint(canvas);
#else /* !ENABLE_OPENGL */
  if (buffer_generation == ui_generation)
    DoubleBufferWindow::OnPaint(canvas);
  else if (scale_buffer > 0) {
    /* while zooming/panning, project the current buffer into the
       Canvas */

    --scale_buffer;

    /* do the projection */

    const UPixelScalar buffer_width = buffer_projection.GetScreenWidth();
    const UPixelScalar buffer_height = buffer_projection.GetScreenHeight();

    const RasterPoint top_left =
      visible_projection.GeoToScreen(buffer_projection.ScreenToGeo(0, 0));
    RasterPoint bottom_right =
      visible_projection.GeoToScreen(buffer_projection.ScreenToGeo(buffer_width,
                                                                   buffer_height));

    /* compensate for rounding errors in destination area */

    if (abs(buffer_width - (bottom_right.x - top_left.x)) < 5)
      bottom_right.x = top_left.x + buffer_width;

    if (abs(buffer_height - (bottom_right.y - top_left.y)) < 5)
      bottom_right.y = top_left.y + buffer_height;

    /* clear the areas around the buffer */

    canvas.SelectNullPen();
    canvas.SelectWhiteBrush();

    if (top_left.x > 0)
      canvas.Rectangle(0, 0, top_left.x, canvas.get_height());

    if (bottom_right.x < (int)canvas.get_width())
      canvas.Rectangle(bottom_right.x, 0,
                       canvas.get_width(), canvas.get_height());

    if (top_left.y > 0)
      canvas.Rectangle(top_left.x, 0, bottom_right.x, top_left.y);

    if (bottom_right.y < (int)canvas.get_height())
      canvas.Rectangle(top_left.x, bottom_right.y,
                       bottom_right.x, canvas.get_height());

    /* now stretch the buffer into the window Canvas */

    ScopeLock protect(DoubleBufferWindow::mutex);
    const Canvas &src = get_visible_canvas();
    canvas.stretch(top_left.x, top_left.y,
                   bottom_right.x - top_left.x, bottom_right.y - top_left.y,
                   src, 0, 0, buffer_width, buffer_height);
  } else
    /* the UI has changed since the last DrawThread iteration has
       started: the buffer has invalid data, paint a white window
       instead */
    canvas.ClearWhite();
#endif /* !ENABLE_OPENGL */
}
 virtual void OnPaint(Canvas &canvas) override {
   canvas.ClearWhite();
   renderer.Draw(canvas, canvas.GetRect(), calculated, glide_settings, true);
 }
Exemple #29
0
void
MapWindow::Render(Canvas &canvas, const PixelRect &rc)
{ 
  const NMEAInfo &basic = Basic();

  // reset label over-write preventer
  label_block.reset();

  render_projection = visible_projection;

  if (!render_projection.IsValid()) {
    canvas.ClearWhite();
    return;
  }

  // Calculate screen position of the aircraft
  RasterPoint aircraft_pos{0,0};
  if (basic.location_available)
      aircraft_pos = render_projection.GeoToScreen(basic.location);

  // Render terrain, groundline and topography
  draw_sw.Mark("RenderTerrain");
  RenderTerrain(canvas);

  draw_sw.Mark("RenderTopography");
  RenderTopography(canvas);

  draw_sw.Mark("RenderFinalGlideShading");
  RenderFinalGlideShading(canvas);

  // Render track bearing (ground track)
  draw_sw.Mark("DrawTrackBearing");
  DrawTrackBearing(canvas, aircraft_pos);

  // Render airspace
  draw_sw.Mark("RenderAirspace");
  RenderAirspace(canvas);

  // Render task, waypoints
  draw_sw.Mark("DrawContest");
  DrawContest(canvas);

  draw_sw.Mark("DrawTask");
  DrawTask(canvas);

  draw_sw.Mark("DrawWaypoints");
  DrawWaypoints(canvas);

  draw_sw.Mark("DrawNOAAStations");
  RenderNOAAStations(canvas);

  draw_sw.Mark("RenderMisc1");
  // Render weather/terrain max/min values
  DrawTaskOffTrackIndicator(canvas);

  // Render the snail trail
  if (basic.location_available)
    RenderTrail(canvas, aircraft_pos);

  RenderMarkers(canvas);

  // Render estimate of thermal location
  DrawThermalEstimate(canvas);

  // Render topography on top of airspace, to keep the text readable
  draw_sw.Mark("RenderTopographyLabels");
  RenderTopographyLabels(canvas);

  // Render glide through terrain range
  draw_sw.Mark("RenderGlide");
  RenderGlide(canvas);

  draw_sw.Mark("RenderMisc2");

  DrawBestCruiseTrack(canvas, aircraft_pos);

  airspace_renderer.DrawIntersections(canvas, render_projection);

  // Draw wind vector at aircraft
  if (basic.location_available)
    DrawWind(canvas, aircraft_pos, rc);

  // Draw traffic

#ifdef HAVE_SKYLINES_TRACKING_HANDLER
  DrawSkyLinesTraffic(canvas);
#endif

  DrawTeammate(canvas);

  if (basic.location_available)
    DrawFLARMTraffic(canvas, aircraft_pos);

  // Finally, draw you!
  if (basic.location_available)
    AircraftRenderer::Draw(canvas, GetMapSettings(), look.aircraft,
                           basic.attitude.heading - render_projection.GetScreenAngle(),
                           aircraft_pos);

  // Render compass
  DrawCompass(canvas, rc);
}
/**
 * This function is called when the Radar needs repainting.
 * @param canvas The canvas to paint on
 */
void
FlarmTrafficWindow::OnPaint(Canvas &canvas)
{
  canvas.ClearWhite();
  Paint(canvas);
}