docs: public static MapBounds adjustBoundsToScaleAndMapSize(
              final GenericMapAttributeValues mapValues,
              final Rectangle paintArea,
              final MapBounds bounds,
              final double dpi) {
          MapBounds newBounds = bounds;
          if (mapValues.isUseNearestScale()) {
              newBounds = newBounds.adjustBoundsToNearestScale(
                      mapValues.getZoomLevels(),
                      mapValues.getZoomSnapTolerance(),
                      mapValues.getZoomLevelSnapStrategy(),
                      mapValues.getZoomSnapGeodetic(),
                      paintArea, dpi);
          }
  
          newBounds = new BBoxMapBounds(newBounds.toReferencedEnvelope(paintArea));
  
          if (mapValues.isUseAdjustBounds()) {
              newBounds = newBounds.adjustedEnvelope(paintArea);
          }
          return newBounds;
      }