matrix-stack: Prune stack entries when loading a replacement matrix
matrix-stack: Prune stack entries when loading a replacement matrix

Previously if an application does not use the matrix stack as a stack
but instead just loads its own matrices for each frame using
cogl_framebuffer_set_modelview_matrix then it will continously push
OP_LOAD entries on the stack and the stack will grow forever. This
patch fixes that use case by resetting the top of the stack to the
last save entry whenever something is pushed that replaces the
previous matrix on the stack.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit d31ed33241a9e9e3bc25f01b2614678827a7a9aa)

Distrotech/cogl,Distrotech/cogl,Distrotech/cogl,Distrotech/cogl