| 23 | |
| 24 | |
| 25 | void ImagePanel::render(wxDC& dc) { |
| 26 | |
| 27 | double imagew = image.GetWidth(); |
| 28 | double imageh = image.GetHeight(); |
| 29 | |
| 30 | wxSize destSize = dc.GetSize(); |
| 31 | |
| 32 | double destw = destSize.GetWidth(); |
| 33 | double desth = destSize.GetHeight(); |
| 34 | |
| 35 | double sf, wf, hf; |
| 36 | |
| 37 | wf = destw / imagew; |
| 38 | hf = desth / imageh; |
| 39 | |
| 40 | sf = (wf < hf)?wf:hf; |
| 41 | |
| 42 | double resulth = imageh * sf; |
| 43 | double resultw = imagew * sf; |
| 44 | |
| 45 | dc.SetUserScale(sf, sf); |
| 46 | dc.DrawBitmap( image, (destw/2 - resultw/2)/sf, (desth/2 - resulth/2)/sf, false ); |
| 47 | } |
| 48 | |
| 49 | |
| 50 |
nothing calls this directly
no outgoing calls
no test coverage detected