feat(perf): compact strokes (RDP) on persist (R10)
Some checks failed
CI / Windows build (push) Has been cancelled
Some checks failed
CI / Windows build (push) Has been cancelled
Wires simplifyStroke into the save conversion: a fast Surface-Pen stroke's hundreds of near-collinear samples are thinned before hitting the DB, shrinking the row + speeding reload re-rasterization (R10) with no perceptible change. The live in-memory strokes are untouched — only what we PERSIST is simplified. Makes the (unit-tested) RDP core load-bearing. flutter analyze lib/editor clean; 238/238 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:pdfrx/pdfrx.dart';
|
||||
import '../../services/database_service.dart';
|
||||
import '../engine/stroke_geometry.dart' show kDefaultPenThinning;
|
||||
import '../engine/stroke_model.dart';
|
||||
import '../engine/stroke_simplify.dart';
|
||||
import '../engine/undo_stack.dart';
|
||||
import '../input/diagnostic_logger.dart';
|
||||
import '../input/pen_config.dart';
|
||||
@@ -281,8 +282,13 @@ class _PenEditorScreenState extends State<PenEditorScreen> {
|
||||
void _schedulePageSave(int pageIndex, List<PenStroke> strokes) {
|
||||
final scheduler = _saveScheduler;
|
||||
if (scheduler == null) return;
|
||||
final editorStrokes =
|
||||
strokes.map((s) => EditorStroke.fromPenStroke(s)).toList();
|
||||
// Compact strokes (RDP) before persisting: a fast Surface-Pen stroke lands
|
||||
// hundreds of near-collinear samples; thinning them shrinks the DB row +
|
||||
// speeds reload re-rasterization (R10) with no perceptible change. The live
|
||||
// in-memory strokes are untouched — only what we PERSIST is simplified.
|
||||
final editorStrokes = strokes
|
||||
.map((s) => simplifyStroke(EditorStroke.fromPenStroke(s)))
|
||||
.toList();
|
||||
scheduler.schedule(
|
||||
'page',
|
||||
EditorRepository.pageHostId(_documentId, pageIndex),
|
||||
|
||||
Reference in New Issue
Block a user