cpp: VariantPixelBuffer: Generalise ConstructRange test and fix identified problems