setQuality method

void setQuality(
  1. int quality
)

Implementation

void setQuality(int quality) {
  quality = quality.clamp(1, 100).toInt();

  if (currentQuality == quality) {
    // don't re-calc if unchanged
    return;
  }

  var sf = 0;
  if (quality < 50) {
    sf = (5000 / quality).floor();
  } else {
    sf = (200 - quality * 2).floor();
  }

  _initQuantTables(sf);
  currentQuality = quality;
}