3/17/2023 0 Comments Runner canvas google chrome hack![]() As the size of your canvas increases this difference drops. I've just done some profiling and (in Chrome) it is about 10% faster to clear a 300x150 (default size) canvas without resetting the transform. Use the identity matrix while clearing the canvasĬontext.clearRect(0, 0, canvas.width, canvas.height) The solution? Reset the transformation matrix prior to clearing the canvas: // Store the current transformation matrix using scale, rotate, or translate) then context.clearRect(0,0,canvas.width,canvas.height) will likely not clear the entire visible portion of the canvas. If you have modified the transformation matrix (e.g. transformations, lineWidth, strokeStyle, etc.), it is very slow (compared to clearRect), it doesn't work in all browsers, and it doesn't describe what you are actually trying to do. Resetting canvas.width resets all canvas state (e.g. ![]() This is the fastest and most descriptive way to clear the entire canvas. ![]() Use: context.clearRect(0, 0, canvas.width, canvas.height) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |