Fix some viewer crashes when switching color mode

The whole idea of immediate mode GUIs is to put your GUI code and the
resulting action close together. Unfortunately, for actions that tear
down the backend (possibly freeing the surfaces we're drawing to), we
can't do that. So defer that action until the next frame (really, the
next idle). Only required when an action might call setDisplayParams.

BUG=skia:

Change-Id: I3eb95fdb462526cb6d95819612ad2725c6f1050b
Reviewed-on: https://skia-review.googlesource.com/8953
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2 files changed