Skip to content

Refactor waveform rendering from SVG to QPainter #342

@darktorres

Description

@darktorres

Description

Investigate whether the BeWavedDolphin waveform rendering can be made more efficient by replacing SVG-based rendering with direct QPainter drawing. SVG parsing and rendering has overhead that may be unnecessary for simple waveform shapes.

Acceptance Criteria

  • Benchmark shows measurable performance improvement
  • Visual quality is equal or better
  • Code is simpler to maintain
  • All existing waveform features preserved

Implementation Guide

1. Benchmark current performance

  • Profile SignalDelegate::paint() with large waveforms (1000+ time steps)
  • Measure SVG load time vs. draw time
  • Identify if SVG rendering is actually the bottleneck

2. QPainter implementation

  • Replace SVG pixmap rendering in SignalDelegate with direct QPainter calls
  • Rising/falling edges: drawLine() calls with appropriate coordinates
  • High/low levels: horizontal lines at fixed Y positions
  • Transition markers: diagonal lines or X-crossings
  • Use QPen styles for signal state (active=green, inactive=gray, unknown=yellow)

3. Caching strategy

  • Cache rendered segments for stable signal regions
  • Only re-render cells that changed between simulation steps

Key files

  • App/BeWavedDolphin/SignalDelegate.h/.cpp — waveform cell rendering
  • App/BeWavedDolphin/SignalModel.h/.cpp — signal data model
  • App/BeWavedDolphin/WaveformView.h/.cpp — view widget

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions