On a partial refund the total discount is refunded.

Magento calculates the refunded amount of a discount based on the price of the refunded item in relation to the order total.

See Mage_Sales_Model_Order_Creditmemo_Total_Discount::collect() in app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Discount.php for reference.

This behaviour was NOT reflected here.

This change fixes the behaviour.