DrawImageRect preventing HTML5 from working
Monkey Forums/Monkey Bug Reports/DrawImageRect preventing HTML5 from working
| ||
Not really sure if this falls under bugs or not, however... In the following code the error on the line 'DrawImageRect cImg,88,88,0,0,65,65' stops all drawing from working in chrome HTML5. But will work in others. Strict Import mojo 'Main program Function Main:Int() New Bug_c() Return 0 End 'Main bug example Class Bug_c Extends App Const iFRAME_RATE:Int = 30 Field cImg:Image=Null Method OnCreate:Int() SetUpdateRate iFRAME_RATE cImg=CreateImage(64,64) 'Make a empty image (white) Return 0 End Method OnRender:Int() Cls 100,120,130 'Colour the backgground so we can see the above image DrawImage cImg,8,8 'Shows that the image is valid DrawImageRect cImg,8,88,0,0,64,64 'Works on all as far as i can tell DrawImageRect cImg,88,88,0,0,65,65 'Stops all drawing! - debug shows nothing 'NOTE: The above command is using a area bigger then the size of the sprite Return 0 End End However after just trying it in IE9 I can see the following error generated in the output window... So maybe the issue is that no errors are reported in the chrome browser? Monkey Runtime Error : DOM Exception: INDEX_SIZE_ERR (1) C:/Development/Monkey/MonkeyPro67a/modules/mojo/graphics.monkey<490> C:/Users/SGreener/Desktop/Turtles/DrawImageRectBug.monkey<32> C:/Development/Monkey/MonkeyPro67a/modules/mojo/app.monkey<71> |
| ||
On my version of Chrome it displays a dialog:Monkey Runtime Error: Error: INDEX_SIZE_ERR: DOM Exception 1 I would not say this is a bug with Monkey, but a coding error since you are drawing outside of the image. Image is 64x64, but you are trying to draw it as 65x65. |
| ||
This is a bug with monkey. Debug mode should throw a runtime error when parameters are clearly illegal. |
| ||
It does throw a runtime error though??? (On my machine at least...) |
| ||
Imho a Dom exception is not a monkey runtime error. Monkey should be protecting users from illegible exceptions by doing proper parameter validation if at all possible. |
| ||
Only in debug mode a check should be implemented. |
| ||
To add to this, in debug mode my Chrome throws no warning / errors / dialogs. therevills: Is there a setting that you have enabled to show that error? |
| ||
therevills: Is there a setting that you have enabled to show that error? Okay, I'm at home now and just installed Chrome (just recently installed Win8 and haven't installed everything yet)... and now it doesn't display anything. Wonder what version I have at work!?! I'll check tomorrow. @Skid, yeah that sounds good and really helpful to catch these sort of errors. Hopefully Mark will take it on board. |
| ||
For the record my current version is 23.0.1271.97 |
| ||
My work version of Chrome Portable 12.0.742.122, so quite a bit behind but it does display the error message. |
| ||
I've added some more error checking here to v67b. |