layers: Redo draw_state locking--all in top-level functions.

All locking is now done in top-level, API-entrypoint functions.  Before,
locking was done at all levels of functions, which caused unnecessary locking
(e.g. within inner loops), and was not very maintainable.  This is cleaner,
easier to maintain, and should perform better.
1 file changed