"Give a man a fish and he can eat for a day. Teach a man to fish and he can eat for the rest of his life."
(1) Try checking the return values of the method calls into the various CGapiSurface objects. Are they returning success or failure? If success, is your code doing what you think it's doing? If failure, why?
(2) Try using breakpoints to determine if values you think are set really are. (Hint: they aren't)
(3) Try using breakpoints, and determing if the code you assume is running really is running. (Hint: it's not)
(These are basic software debugging steps, so it's important to learn them. Otherwise, you might as well just contract someone to write your code for you.)