Energy gaps and optical properties of ferromagnetic semiconductors CdCr2S4 and CdCr2Se4: Improved density-functional-theory study