restructure Canvas.cpp