Changed creation of canvas context for 2d drawing