Rewrite the pooling in ximagesink to extend from the bufferpool base class in core. Move some code to a comon place and refactor.