usablePlan static method

StripPlan? usablePlan(
  1. StripPlan? plan, {
  2. required PdfMatrix pageToDevice,
  3. required int deviceWidth,
  4. required int deviceHeight,
  5. bool slugEnabled = false,
})

Validates plan for a device about to be constructed with this geometry: null when no plan, when any debug-delegate flag forces local binning (the flags change ROUTING and the plan's producer ran without them), or - counted in totalPlanMismatches - when the plan was binned for different geometry (stale zoom/region). The matrix comparison is exact: the six coefficients round-trip bit-exactly through the worker.

Implementation

static StripPlan? usablePlan(
  StripPlan? plan, {
  required PdfMatrix pageToDevice,
  required int deviceWidth,
  required int deviceHeight,
  bool slugEnabled = false,
}) {
  if (plan == null) return null;
  if (plan.slugGlyphs != slugEnabled) return null;
  if (debugDelegateAll ||
      debugDelegateFills ||
      debugDelegateStrokes ||
      debugDelegateText) {
    return null;
  }
  final m = plan.pageToDevice;
  if (plan.deviceWidth != deviceWidth ||
      plan.deviceHeight != deviceHeight ||
      plan.tolerance != stripFlattenTolerance ||
      m.a != pageToDevice.a ||
      m.b != pageToDevice.b ||
      m.c != pageToDevice.c ||
      m.d != pageToDevice.d ||
      m.e != pageToDevice.e ||
      m.f != pageToDevice.f) {
    totalPlanMismatches++;
    return null;
  }
  return plan;
}