Index: uspace/lib/draw/codec/tga.c
===================================================================
--- uspace/lib/draw/codec/tga.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,277 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <stdlib.h>
-#include <byteorder.h>
-#include <align.h>
-#include <stdbool.h>
-#include <pixconv.h>
-#include <draw/codec.h>
-
-typedef struct {
-	uint8_t id_length;
-	uint8_t cmap_type;
-	uint8_t img_type;
-
-	uint16_t cmap_first_entry;
-	uint16_t cmap_entries;
-	uint8_t cmap_bpp;
-
-	uint16_t startx;
-	uint16_t starty;
-	uint16_t width;
-	uint16_t height;
-	uint8_t img_bpp;
-	uint8_t img_descr;
-} __attribute__((packed)) tga_header_t;
-
-typedef enum {
-	CMAP_NOT_PRESENT = 0,
-	CMAP_PRESENT = 1,
-	CMAP_RESERVED_START = 2,
-	CMAP_PRIVATE_START = 128
-} cmap_type_t;
-
-typedef enum {
-	IMG_EMTPY = 0,
-	IMG_CMAP = 1,
-	IMG_BGRA = 2,
-	IMG_GRAY = 3,
-	IMG_CMAP_RLE = 9,
-	IMG_BGRA_RLE = 10,
-	IMG_GRAY_RLE = 11
-} img_type_t;
-
-typedef struct {
-	cmap_type_t cmap_type;
-	img_type_t img_type;
-
-	uint16_t cmap_first_entry;
-	uint16_t cmap_entries;
-	uint8_t cmap_bpp;
-
-	uint16_t startx;
-	uint16_t starty;
-	uint16_t width;
-	uint16_t height;
-	uint8_t img_bpp;
-	uint8_t img_alpha_bpp;
-	uint8_t img_alpha_dir;
-
-	void *id_data;
-	size_t id_length;
-
-	void *cmap_data;
-	size_t cmap_length;
-
-	void *img_data;
-	size_t img_length;
-} tga_t;
-
-/** Decode Truevision TGA header
- *
- * @param[in]  data Memory representation of TGA.
- * @param[in]  size Size of the representation (in bytes).
- * @param[out] tga  Decoded TGA.
- *
- * @return True on succesful decoding.
- * @return False on failure.
- *
- */
-static bool decode_tga_header(void *data, size_t size, tga_t *tga)
-{
-	/* Header sanity check */
-	if (size < sizeof(tga_header_t))
-		return false;
-
-	tga_header_t *head = (tga_header_t *) data;
-
-	/* Image ID field */
-	tga->id_data = data + sizeof(tga_header_t);
-	tga->id_length = head->id_length;
-
-	if (size < sizeof(tga_header_t) + tga->id_length)
-		return false;
-
-	/* Color map type */
-	tga->cmap_type = head->cmap_type;
-
-	/* Image type */
-	tga->img_type = head->img_type;
-
-	/* Color map specification */
-	tga->cmap_first_entry = uint16_t_le2host(head->cmap_first_entry);
-	tga->cmap_entries = uint16_t_le2host(head->cmap_entries);
-	tga->cmap_bpp = head->cmap_bpp;
-	tga->cmap_data = tga->id_data + tga->id_length;
-	tga->cmap_length = ALIGN_UP(tga->cmap_entries * tga->cmap_bpp, 8) >> 3;
-
-	if (size < sizeof(tga_header_t) + tga->id_length +
-	    tga->cmap_length)
-		return false;
-
-	/* Image specification */
-	tga->startx = uint16_t_le2host(head->startx);
-	tga->starty = uint16_t_le2host(head->starty);
-	tga->width = uint16_t_le2host(head->width);
-	tga->height = uint16_t_le2host(head->height);
-	tga->img_bpp = head->img_bpp;
-	tga->img_alpha_bpp = head->img_descr & 0x0f;
-	tga->img_alpha_dir = (head->img_descr & 0xf0) >> 4;
-	tga->img_data = tga->cmap_data + tga->cmap_length;
-	tga->img_length = ALIGN_UP(tga->width * tga->height * tga->img_bpp, 8) >> 3;
-
-	if (size < sizeof(tga_header_t) + tga->id_length +
-	    tga->cmap_length + tga->img_length)
-		return false;
-
-	return true;
-}
-
-/** Decode Truevision TGA format
- *
- * Decode Truevision TGA format and create a surface
- * from it. The supported variants of TGA are currently
- * limited to uncompressed 24 bit true-color images without
- * alpha channel.
- *
- * @param[in] data  Memory representation of TGA.
- * @param[in] size  Size of the representation (in bytes).
- * @param[in] flags Surface creation flags.
- *
- * @return Newly allocated surface with the decoded content.
- * @return NULL on error or unsupported format.
- *
- */
-surface_t *decode_tga(void *data, size_t size, surface_flags_t flags)
-{
-	tga_t tga;
-	if (!decode_tga_header(data, size, &tga))
-		return NULL;
-
-	/*
-	 * Check for unsupported features.
-	 */
-
-	switch (tga.cmap_type) {
-	case CMAP_NOT_PRESENT:
-		break;
-	default:
-		/* Unsupported */
-		return NULL;
-	}
-
-	switch (tga.img_type) {
-	case IMG_BGRA:
-		if (tga.img_bpp != 24)
-			return NULL;
-		break;
-	case IMG_GRAY:
-		if (tga.img_bpp != 8)
-			return NULL;
-		break;
-	default:
-		/* Unsupported */
-		return NULL;
-	}
-
-	if (tga.img_alpha_bpp != 0)
-		return NULL;
-
-	sysarg_t twidth = tga.startx + tga.width;
-	sysarg_t theight = tga.starty + tga.height;
-
-	surface_t *surface = surface_create(twidth, theight, NULL, flags);
-	if (surface == NULL)
-		return NULL;
-
-	/*
-	 * TGA is encoded in a bottom-up manner, the true-color
-	 * variant is in BGR 8:8:8 encoding.
-	 */
-
-	switch (tga.img_type) {
-	case IMG_BGRA:
-		for (sysarg_t y = tga.starty; y < theight; y++) {
-			for (sysarg_t x = tga.startx; x < twidth; x++) {
-				size_t offset =
-				    ((y - tga.starty) * tga.width + (x - tga.startx)) * 3;
-
-				pixel_t pixel =
-				    bgr_888_2pixel(((uint8_t *) tga.img_data) + offset);
-				surface_put_pixel(surface, x, theight - y - 1, pixel);
-			}
-		}
-		break;
-	case IMG_GRAY:
-		for (sysarg_t y = tga.starty; y < theight; y++) {
-			for (sysarg_t x = tga.startx; x < twidth; x++) {
-				size_t offset =
-				    (y - tga.starty) * tga.width + (x - tga.startx);
-
-				pixel_t pixel =
-				    gray_8_2pixel(((uint8_t *) tga.img_data) + offset);
-				surface_put_pixel(surface, x, theight - y - 1, pixel);
-			}
-		}
-		break;
-	default:
-		break;
-	}
-
-	return surface;
-}
-
-/** Encode Truevision TGA format
- *
- * Encode Truevision TGA format into an array.
- *
- * @param[in]  surface Surface to be encoded into TGA.
- * @param[out] pdata   Pointer to the resulting array.
- * @param[out] psize   Pointer to the size of the resulting array.
- *
- * @return True on succesful encoding.
- * @return False on failure.
- *
- */
-bool encode_tga(surface_t *surface, void **pdata, size_t *psize)
-{
-	// TODO
-	return false;
-}
-
-/** @}
- */
Index: uspace/lib/draw/codec/tga.gz.c
===================================================================
--- uspace/lib/draw/codec/tga.gz.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <gzip.h>
-#include <stdlib.h>
-#include <draw/codec.h>
-
-/** Decode gzipped Truevision TGA format
- *
- * Decode gzipped Truevision TGA format and create a surface
- * from it. The supported variants of TGA are limited those
- * supported by decode_tga().
- *
- * @param[in] data  Memory representation of gzipped TGA.
- * @param[in] size  Size of the representation (in bytes).
- * @param[in] flags Surface creation flags.
- *
- * @return Newly allocated surface with the decoded content.
- * @return NULL on error or unsupported format.
- *
- */
-surface_t *decode_tga_gz(void *data, size_t size, surface_flags_t flags)
-{
-	void *data_expanded;
-	size_t size_expanded;
-
-	errno_t ret = gzip_expand(data, size, &data_expanded, &size_expanded);
-	if (ret != EOK)
-		return NULL;
-
-	surface_t *surface = decode_tga(data_expanded, size_expanded, flags);
-
-	free(data_expanded);
-	return surface;
-}
-
-/** Encode gzipped Truevision TGA format
- *
- * Encode gzipped Truevision TGA format into an array.
- *
- * @param[in]  surface Surface to be encoded into gzipped TGA.
- * @param[out] pdata   Pointer to the resulting array.
- * @param[out] psize   Pointer to the size of the resulting array.
- *
- * @return True on succesful encoding.
- * @return False on failure.
- *
- */
-bool encode_tga_gz(surface_t *surface, void **pdata, size_t *psize)
-{
-	// TODO
-	return false;
-}
-
-/** @}
- */
Index: uspace/lib/draw/codec/webp.c
===================================================================
--- uspace/lib/draw/codec/webp.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,264 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <stdlib.h>
-#include <byteorder.h>
-#include <align.h>
-#include <stdbool.h>
-#include <pixconv.h>
-#include <fourcc.h>
-#include <stdint.h>
-#include <abi/fourcc.h>
-#include <draw/codec.h>
-
-/** Check for input buffer overrun condition */
-#define CHECK_OVERRUN(state, retval) \
-	do { \
-		if ((state).overrun) \
-			return (retval); \
-	} while (false)
-
-#define SIGNATURE_WEBP_LOSSLESS  UINT8_C(0x2f)
-
-enum {
-	FOURCC_RIFF          = FOURCC('R', 'I', 'F', 'F'),
-	FOURCC_WEBP          = FOURCC('W', 'E', 'B', 'P'),
-	FOURCC_WEBP_LOSSLESS = FOURCC('V', 'P', '8', 'L')
-};
-
-typedef enum {
-	TRANSFORM_PREDICTOR      = 0,
-	TRANSFORM_COLOR          = 1,
-	TRANSFORM_SUBTRACT       = 2,
-	TRANSFORM_COLOR_INDEXING = 3
-} webp_transform_t;
-
-typedef struct {
-	fourcc_t fourcc;
-	uint32_t payload_size;
-} __attribute__((packed)) riff_header_t;
-
-typedef struct {
-	fourcc_t fourcc;
-	fourcc_t encoding;
-	uint32_t stream_size;
-	uint8_t signature;
-} __attribute__((packed)) webp_header_t;
-
-typedef struct {
-	uint32_t stream_size;
-	uint16_t width;
-	uint16_t height;
-	bool alpha_used;
-	uint8_t version;
-
-	uint8_t *src;     /**< Input buffer */
-	size_t srclen;    /**< Input buffer size */
-	size_t srccnt;    /**< Position in the input buffer */
-
-	uint32_t bitbuf;  /**< Bit buffer */
-	size_t bitlen;    /**< Number of bits in the bit buffer */
-
-	bool overrun;     /**< Overrun condition */
-} webp_t;
-
-/** Get bits from the bit buffer
- *
- * @param state WebP state.
- * @param cnt   Number of bits to return (at most 32).
- *
- * @return Returned bits.
- *
- */
-static inline uint32_t get_bits(webp_t *state, size_t cnt)
-{
-	/* Bit accumulator for at least 36 bits */
-	uint64_t val = state->bitbuf;
-
-	while (state->bitlen < cnt) {
-		if (state->srccnt == state->srclen) {
-			state->overrun = true;
-			return 0;
-		}
-
-		/* Load 8 more bits */
-		val |= ((uint64_t) state->src[state->srccnt]) << state->bitlen;
-		state->srccnt++;
-		state->bitlen += 8;
-	}
-
-	/* Update bits in the buffer */
-	state->bitbuf = (uint32_t) (val >> cnt);
-	state->bitlen -= cnt;
-
-	return ((uint32_t) (val & ((1 << cnt) - 1)));
-}
-
-/** Decode WebP header
- *
- * @param[in]  data Memory representation of WebP.
- * @param[in]  size Size of the representation (in bytes).
- * @param[out] webp Decoded WebP.
- *
- * @return True on succesful decoding.
- * @return False on failure.
- *
- */
-static bool decode_webp_header(void *data, size_t size, webp_t *webp)
-{
-	/* Headers sanity check */
-	if ((size < sizeof(riff_header_t)) ||
-	    (size - sizeof(riff_header_t) < sizeof(webp_header_t)))
-		return false;
-
-	riff_header_t *riff_header = (riff_header_t *) data;
-	if (riff_header->fourcc != FOURCC_RIFF)
-		return false;
-
-	/* Check payload size */
-	size_t payload_size = uint32_t_le2host(riff_header->payload_size);
-	if (payload_size + sizeof(riff_header_t) > size)
-		return false;
-
-	data += sizeof(riff_header_t);
-	webp_header_t *webp_header = (webp_header_t *) data;
-	if (webp_header->fourcc != FOURCC_WEBP)
-		return false;
-
-	/* Only lossless encoding supported so far */
-	if (webp_header->encoding != FOURCC_WEBP_LOSSLESS)
-		return false;
-
-	webp->stream_size = uint32_t_le2host(webp_header->stream_size);
-	if (webp->stream_size + sizeof(riff_header_t) +
-	    sizeof(webp_header_t) > size)
-		return false;
-
-	if (webp_header->signature != SIGNATURE_WEBP_LOSSLESS)
-		return false;
-
-	data += sizeof(webp_header_t);
-
-	/* Setup decoding state */
-	webp->src = (uint8_t *) data;
-	webp->srclen = webp->stream_size - 1;
-	webp->srccnt = 0;
-	webp->bitbuf = 0;
-	webp->bitlen = 0;
-	webp->overrun = false;
-
-	/* Decode the rest of the metadata */
-	webp->width = get_bits(webp, 14) + 1;
-	CHECK_OVERRUN(*webp, false);
-
-	webp->height = get_bits(webp, 14) + 1;
-	CHECK_OVERRUN(*webp, false);
-
-	webp->alpha_used = get_bits(webp, 1);
-	CHECK_OVERRUN(*webp, false);
-
-	webp->version = get_bits(webp, 3);
-	CHECK_OVERRUN(*webp, false);
-
-	if (webp->version != 0)
-		return false;
-
-	return true;
-}
-
-/** Decode WebP format
- *
- * Decode WebP format and create a surface from it. The supported
- * variants of WebP are currently limited to losslessly compressed
- * ARGB images.
- *
- * @param[in] data  Memory representation of WebP.
- * @param[in] size  Size of the representation (in bytes).
- * @param[in] flags Surface creation flags.
- *
- * @return Newly allocated surface with the decoded content.
- * @return NULL on error or unsupported format.
- *
- */
-surface_t *decode_webp(void *data, size_t size, surface_flags_t flags)
-{
-	webp_t webp;
-	if (!decode_webp_header(data, size, &webp))
-		return NULL;
-
-	bool transform_present = false;
-
-	do {
-		transform_present = get_bits(&webp, 1);
-		CHECK_OVERRUN(webp, NULL);
-
-		if (transform_present) {
-			webp_transform_t transform = get_bits(&webp, 2);
-			CHECK_OVERRUN(webp, NULL);
-
-			if (transform == TRANSFORM_PREDICTOR) {
-				// FIXME TODO
-			} else
-				return NULL;
-
-			// FIXME: decode other transforms
-		}
-	} while (transform_present);
-
-	// FIXME: decode image data
-
-	return NULL;
-}
-
-/** Encode WebP format
- *
- * Encode WebP format into an array.
- *
- * @param[in]  surface Surface to be encoded into WebP.
- * @param[out] pdata   Pointer to the resulting array.
- * @param[out] psize   Pointer to the size of the resulting array.
- *
- * @return True on succesful encoding.
- * @return False on failure.
- *
- */
-bool encode_webp(surface_t *surface, void **pdata, size_t *psize)
-{
-	// TODO
-	return false;
-}
-
-/** @}
- */
Index: uspace/lib/draw/cursor.c
===================================================================
--- uspace/lib/draw/cursor.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <stdlib.h>
-
-#include <draw/cursor.h>
-
-void cursor_init(cursor_t *cursor, cursor_decoder_type_t decoder, char *path)
-{
-	switch (decoder) {
-	case CURSOR_DECODER_EMBEDDED:
-		cursor->decoder = &cd_embedded;
-		break;
-	default:
-		cursor->decoder = NULL;
-		break;
-	}
-
-	if (cursor->decoder) {
-		cursor->decoder->init(path, &cursor->state_count, &cursor->decoder_data);
-
-		if (cursor->state_count > 0) {
-			cursor->states = (surface_t **) malloc(sizeof(surface_t *) * cursor->state_count);
-		} else {
-			cursor->states = NULL;
-		}
-
-		if (cursor->states) {
-			for (size_t i = 0; i < cursor->state_count; ++i) {
-				cursor->states[i] = cursor->decoder->render(i);
-			}
-		} else {
-			cursor->state_count = 0;
-		}
-	} else {
-		cursor->state_count = 0;
-		cursor->states = NULL;
-	}
-}
-
-void cursor_release(cursor_t *cursor)
-{
-	if (cursor->states) {
-		for (size_t i = 0; i < cursor->state_count; ++i) {
-			if (cursor->states[i]) {
-				surface_destroy(cursor->states[i]);
-			}
-		}
-		free(cursor->states);
-	}
-
-	if (cursor->decoder) {
-		cursor->decoder->release(cursor->decoder_data);
-	}
-}
-
-/** @}
- */
Index: uspace/lib/draw/cursor/embedded.c
===================================================================
--- uspace/lib/draw/cursor/embedded.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <assert.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <draw/gfx.h>
-#include <draw/cursor.h>
-#include <draw/surface.h>
-
-static void cde_init(char *path, uint8_t *state_count, void **data)
-{
-	assert(state_count);
-	assert(data);
-
-	(*state_count) = 1;
-	(*data) = NULL;
-}
-
-static surface_t *cde_render(uint8_t state)
-{
-	if (state != 0)
-		return NULL;
-
-	surface_t *surface = surface_create(CURSOR_WIDTH, CURSOR_HEIGHT, NULL, 0);
-	if (!surface)
-		return NULL;
-
-	for (unsigned int y = 0; y < CURSOR_HEIGHT; ++y) {
-		for (unsigned int x = 0; x < CURSOR_WIDTH; ++x) {
-			size_t offset = y * ((CURSOR_WIDTH - 1) / 8 + 1) + x / 8;
-			bool visible = cursor_mask[offset] & (1 << (x % 8));
-			pixel_t pixel = (cursor_texture[offset] & (1 << (x % 8))) ?
-			    PIXEL(255, 0, 0, 0) : PIXEL(255, 255, 255, 255);
-
-			if (visible)
-				surface_put_pixel(surface, x, y, pixel);
-		}
-	}
-
-	return surface;
-}
-
-static void cde_release(void *data)
-{
-	/* no-op */
-}
-
-cursor_decoder_t cd_embedded = {
-	.init = cde_init,
-	.render = cde_render,
-	.release = cde_release
-};
-
-/** @}
- */
Index: uspace/lib/draw/doc/doxygroups.h
===================================================================
--- uspace/lib/draw/doc/doxygroups.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup draw libdraw
- * @ingroup libs
- */
Index: uspace/lib/draw/drawctx.c
===================================================================
--- uspace/lib/draw/drawctx.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <assert.h>
-#include <adt/list.h>
-#include <stdlib.h>
-
-#include <draw/drawctx.h>
-
-void drawctx_init(drawctx_t *context, surface_t *surface)
-{
-	assert(surface);
-	list_initialize(&context->list);
-	context->surface = surface;
-	context->compose = compose_src;
-	context->mask = NULL;
-	context->source = NULL;
-	context->shall_clip = false;
-	context->clip_x = 0;
-	context->clip_y = 0;
-	surface_get_resolution(surface, &context->clip_width, &context->clip_height);
-}
-
-void drawctx_save(drawctx_t *context)
-{
-	drawctx_t *to_save = (drawctx_t *) malloc(sizeof(drawctx_t));
-	if (to_save) {
-		link_initialize(&to_save->link);
-		to_save->compose = context->compose;
-		to_save->mask = context->mask;
-		to_save->source = context->source;
-		to_save->shall_clip = context->shall_clip;
-		to_save->clip_x = context->clip_x;
-		to_save->clip_y = context->clip_y;
-		to_save->clip_width = context->clip_width;
-		to_save->clip_height = context->clip_height;
-		list_append(&to_save->link, &context->list);
-	}
-}
-
-void drawctx_restore(drawctx_t *context)
-{
-	drawctx_t *to_load = (drawctx_t *) list_last(&context->list);
-	if (to_load) {
-		list_remove(&to_load->link);
-		context->compose = to_load->compose;
-		context->mask = to_load->mask;
-		context->source = to_load->source;
-		context->shall_clip = to_load->shall_clip;
-		context->clip_x = to_load->clip_x;
-		context->clip_y = to_load->clip_y;
-		context->clip_width = to_load->clip_width;
-		context->clip_height = to_load->clip_height;
-		free(to_load);
-	}
-}
-
-void drawctx_set_compose(drawctx_t *context, compose_t compose)
-{
-	context->compose = compose;
-}
-
-void drawctx_set_clip(drawctx_t *context,
-    sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height)
-{
-	surface_get_resolution(context->surface,
-	    &context->clip_width, &context->clip_height);
-	context->shall_clip = (x > 0) || (y > 0) ||
-	    (width < context->clip_width) || (height < context->clip_height);
-
-	context->clip_x = x;
-	context->clip_y = y;
-	context->clip_width = width;
-	context->clip_height = height;
-}
-
-void drawctx_set_mask(drawctx_t *context, surface_t *mask)
-{
-	context->mask = mask;
-}
-
-void drawctx_set_source(drawctx_t *context, source_t *source)
-{
-	context->source = source;
-}
-
-void drawctx_set_font(drawctx_t *context, font_t *font)
-{
-	context->font = font;
-}
-
-void drawctx_transfer(drawctx_t *context,
-    sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height)
-{
-	if (!context->source) {
-		return;
-	}
-
-	bool transfer_fast = source_is_fast(context->source) &&
-	    (context->shall_clip == false) &&
-	    (context->mask == NULL) &&
-	    (context->compose == compose_src || context->compose == compose_over);
-
-	if (transfer_fast) {
-
-		for (sysarg_t _y = y; _y < y + height; ++_y) {
-			pixel_t *src = source_direct_access(context->source, x, _y);
-			pixel_t *dst = pixelmap_pixel_at(surface_pixmap_access(context->surface), x, _y);
-			if (src && dst) {
-				sysarg_t count = width;
-				while (count-- != 0) {
-					*dst++ = *src++;
-				}
-			}
-		}
-		surface_add_damaged_region(context->surface, x, y, width, height);
-
-	} else {
-
-		bool clipped = false;
-		bool masked = false;
-		for (sysarg_t _y = y; _y < y + height; ++_y) {
-			for (sysarg_t _x = x; _x < x + width; ++_x) {
-				if (context->shall_clip) {
-					clipped = _x < context->clip_x && _x >= context->clip_width &&
-					    _y < context->clip_y && _y >= context->clip_height;
-				}
-
-				if (context->mask) {
-					pixel_t p = surface_get_pixel(context->mask, _x, _y);
-					masked = p > 0 ? false : true;
-				}
-
-				if (!clipped && !masked) {
-					pixel_t p_src = source_determine_pixel(context->source, _x, _y);
-					pixel_t p_dst = surface_get_pixel(context->surface, _x, _y);
-					pixel_t p_res = context->compose(p_src, p_dst);
-					surface_put_pixel(context->surface, _x, _y, p_res);
-				}
-			}
-		}
-
-	}
-}
-
-void drawctx_stroke(drawctx_t *context, path_t *path)
-{
-	if (!context->source || !path) {
-		return;
-	}
-
-	/*
-	 * Note:
-	 * Antialiasing could be achieved by up-scaling path coordinates and
-	 * rendering into temporary higher-resolution surface. Then, the temporary
-	 * surface would be set as a source and its damaged region would be
-	 * transferred to the original surface.
-	 */
-
-	list_foreach(*((list_t *) path), link, path_step_t, step) {
-		switch (step->type) {
-		case PATH_STEP_MOVETO:
-			// TODO
-			break;
-		case PATH_STEP_LINETO:
-			// TODO
-			break;
-		default:
-			break;
-		}
-	}
-}
-
-void drawctx_fill(drawctx_t *context, path_t *path)
-{
-	if (!context->source || !path) {
-		return;
-	}
-
-	// TODO
-}
-
-void drawctx_print(drawctx_t *context, const char *text, sysarg_t x, sysarg_t y)
-{
-	if (context->font && context->source) {
-		font_draw_text(context->font, context, context->source, text, x, y);
-	}
-}
-
-/** @}
- */
Index: uspace/lib/draw/font.c
===================================================================
--- uspace/lib/draw/font.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,174 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * Copyright (c) 2014 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-
-#include <draw/font.h>
-#include <draw/drawctx.h>
-
-font_t *font_create(font_backend_t *backend, void *backend_data)
-{
-	font_t *font = malloc(sizeof(font_t));
-	if (font == NULL)
-		return NULL;
-
-	font->backend = backend;
-	font->backend_data = backend_data;
-
-	return font;
-}
-
-void font_release(font_t *font)
-{
-	font->backend->release(font->backend_data);
-}
-
-errno_t font_get_metrics(font_t *font, font_metrics_t *metrics)
-{
-	return font->backend->get_font_metrics(font->backend_data, metrics);
-}
-
-errno_t font_resolve_glyph(font_t *font, char32_t c, glyph_id_t *glyph_id)
-{
-	return font->backend->resolve_glyph(font->backend_data, c, glyph_id);
-}
-
-errno_t font_get_glyph_metrics(font_t *font, glyph_id_t glyph_id,
-    glyph_metrics_t *glyph_metrics)
-{
-	return font->backend->get_glyph_metrics(font->backend_data,
-	    glyph_id, glyph_metrics);
-}
-
-errno_t font_render_glyph(font_t *font, drawctx_t *context, source_t *source,
-    sysarg_t x, sysarg_t y, glyph_id_t glyph_id)
-{
-	return font->backend->render_glyph(font->backend_data, context, source,
-	    x, y, glyph_id);
-}
-
-/* TODO this is bad interface */
-errno_t font_get_box(font_t *font, char *text, sysarg_t *width, sysarg_t *height)
-{
-	font_metrics_t fm;
-	errno_t rc = font_get_metrics(font, &fm);
-	if (rc != EOK)
-		return rc;
-
-	native_t x = 0;
-
-	size_t off = 0;
-	while (true) {
-		char32_t c = str_decode(text, &off, STR_NO_LIMIT);
-		if (c == 0)
-			break;
-
-		glyph_id_t glyph_id;
-		rc = font_resolve_glyph(font, c, &glyph_id);
-		if (rc != EOK) {
-			errno_t rc2 = font_resolve_glyph(font, U_SPECIAL, &glyph_id);
-			if (rc2 != EOK) {
-				return rc;
-			}
-		}
-
-		glyph_metrics_t glyph_metrics;
-		rc = font_get_glyph_metrics(font, glyph_id, &glyph_metrics);
-		if (rc != EOK)
-			return rc;
-
-		x += glyph_metrics_get_advancement(&glyph_metrics);
-	}
-
-	*width = x;
-	*height = fm.ascender + fm.descender;
-	return EOK;
-}
-
-/* TODO this is bad interface */
-errno_t font_draw_text(font_t *font, drawctx_t *context, source_t *source,
-    const char *text, sysarg_t sx, sysarg_t sy)
-{
-	drawctx_save(context);
-	drawctx_set_compose(context, compose_over);
-
-	font_metrics_t fm;
-	errno_t rc = font_get_metrics(font, &fm);
-	if (rc != EOK)
-		return rc;
-
-	native_t baseline = sy + fm.ascender;
-	native_t x = sx;
-
-	size_t off = 0;
-	while (true) {
-		char32_t c = str_decode(text, &off, STR_NO_LIMIT);
-		if (c == 0)
-			break;
-
-		glyph_id_t glyph_id;
-		rc = font_resolve_glyph(font, c, &glyph_id);
-		if (rc != EOK) {
-			errno_t rc2 = font_resolve_glyph(font, U_SPECIAL, &glyph_id);
-			if (rc2 != EOK) {
-				return rc;
-			}
-		}
-
-		glyph_metrics_t glyph_metrics;
-		rc = font_get_glyph_metrics(font, glyph_id, &glyph_metrics);
-		if (rc != EOK)
-			return rc;
-
-		rc = font_render_glyph(font, context, source, x, baseline,
-		    glyph_id);
-		if (rc != EOK)
-			return rc;
-
-		x += glyph_metrics_get_advancement(&glyph_metrics);
-
-	}
-
-	drawctx_restore(context);
-	source_set_mask(source, NULL, false);
-
-	return EOK;
-}
-
-/** @}
- */
Index: uspace/lib/draw/font/bitmap_backend.c
===================================================================
--- uspace/lib/draw/font/bitmap_backend.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,280 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * Copyright (c) 2014 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include <draw/font.h>
-#include <draw/drawctx.h>
-
-typedef struct {
-	surface_t *surface;
-	glyph_metrics_t metrics;
-	bool metrics_loaded;
-} glyph_cache_item_t;
-
-typedef struct {
-	uint16_t points;
-	uint32_t glyph_count;
-	font_metrics_t font_metrics;
-	glyph_cache_item_t *glyph_cache;
-	bitmap_font_decoder_t *decoder;
-	void *decoder_data;
-	bool scale;
-	double scale_ratio;
-} bitmap_backend_data_t;
-
-static errno_t bb_get_font_metrics(void *backend_data, font_metrics_t *font_metrics)
-{
-	bitmap_backend_data_t *data = (bitmap_backend_data_t *) backend_data;
-
-	*font_metrics = data->font_metrics;
-
-	return EOK;
-}
-
-static errno_t bb_resolve_glyph(void *backend_data, char32_t c, glyph_id_t *glyph_id)
-{
-	bitmap_backend_data_t *data = (bitmap_backend_data_t *) backend_data;
-	return data->decoder->resolve_glyph(data->decoder_data, c, glyph_id);
-}
-
-static errno_t bb_get_glyph_metrics(void *backend_data, glyph_id_t glyph_id,
-    glyph_metrics_t *glyph_metrics)
-{
-	bitmap_backend_data_t *data = (bitmap_backend_data_t *) backend_data;
-
-	if (glyph_id >= data->glyph_count)
-		return ENOENT;
-
-	if (data->glyph_cache[glyph_id].metrics_loaded) {
-		*glyph_metrics = data->glyph_cache[glyph_id].metrics;
-		return EOK;
-	}
-
-	glyph_metrics_t gm;
-
-	errno_t rc = data->decoder->load_glyph_metrics(data->decoder_data, glyph_id,
-	    &gm);
-	if (rc != EOK)
-		return rc;
-
-	if (data->scale) {
-		gm.left_side_bearing = (metric_t)
-		    (data->scale_ratio * gm.left_side_bearing + 0.5);
-		gm.width = (metric_t)
-		    (data->scale_ratio * gm.width + 0.5);
-		gm.right_side_bearing = (metric_t)
-		    (data->scale_ratio * gm.right_side_bearing + 0.5);
-		gm.ascender = (metric_t)
-		    (data->scale_ratio * gm.ascender + 0.5);
-		gm.height = (metric_t)
-		    (data->scale_ratio * gm.height + 0.5);
-	}
-
-	data->glyph_cache[glyph_id].metrics = gm;
-	data->glyph_cache[glyph_id].metrics_loaded = true;
-	*glyph_metrics = gm;
-	return EOK;
-}
-
-static errno_t get_glyph_surface(bitmap_backend_data_t *data, glyph_id_t glyph_id,
-    surface_t **result)
-{
-	if (glyph_id >= data->glyph_count)
-		return ENOENT;
-
-	if (data->glyph_cache[glyph_id].surface != NULL) {
-		*result = data->glyph_cache[glyph_id].surface;
-		return EOK;
-	}
-
-	surface_t *raw_surface;
-	errno_t rc = data->decoder->load_glyph_surface(data->decoder_data, glyph_id,
-	    &raw_surface);
-	if (rc != EOK)
-		return rc;
-
-	sysarg_t w;
-	sysarg_t h;
-	surface_get_resolution(raw_surface, &w, &h);
-
-	if (!data->scale) {
-		*result = raw_surface;
-		return EOK;
-	}
-
-	source_t source;
-	source_init(&source);
-	source_set_texture(&source, raw_surface, PIXELMAP_EXTEND_TRANSPARENT_BLACK);
-
-	transform_t transform;
-	transform_identity(&transform);
-	transform_translate(&transform, 0.5, 0.5);
-	transform_scale(&transform, data->scale_ratio, data->scale_ratio);
-	source_set_transform(&source, transform);
-
-	surface_coord_t scaled_width = (data->scale_ratio * ((double) w) + 0.5);
-	surface_coord_t scaled_height = (data->scale_ratio * ((double) h) + 0.5);
-
-	surface_t *scaled_surface = surface_create(scaled_width, scaled_height,
-	    NULL, 0);
-	if (!scaled_surface) {
-		surface_destroy(raw_surface);
-		return ENOMEM;
-	}
-
-	drawctx_t context;
-	drawctx_init(&context, scaled_surface);
-	drawctx_set_source(&context, &source);
-	drawctx_transfer(&context, 0, 0, scaled_width, scaled_height);
-
-	surface_destroy(raw_surface);
-
-	data->glyph_cache[glyph_id].surface = scaled_surface;
-	*result = scaled_surface;
-	return EOK;
-}
-
-static errno_t bb_render_glyph(void *backend_data, drawctx_t *context,
-    source_t *source, sysarg_t ox, sysarg_t oy, glyph_id_t glyph_id)
-{
-	bitmap_backend_data_t *data = (bitmap_backend_data_t *) backend_data;
-
-	glyph_metrics_t glyph_metrics;
-	errno_t rc = bb_get_glyph_metrics(backend_data, glyph_id, &glyph_metrics);
-	if (rc != EOK)
-		return rc;
-
-	surface_t *glyph_surface;
-	rc = get_glyph_surface(data, glyph_id, &glyph_surface);
-	if (rc != EOK)
-		return rc;
-
-	native_t x = ox + glyph_metrics.left_side_bearing;
-	native_t y = oy - glyph_metrics.ascender;
-
-	transform_t transform;
-	transform_identity(&transform);
-	transform_translate(&transform, x, y);
-	source_set_transform(source, transform);
-	source_set_mask(source, glyph_surface, false);
-	drawctx_transfer(context, x, y, glyph_metrics.width,
-	    glyph_metrics.height);
-
-	return EOK;
-}
-
-static void bb_release(void *backend_data)
-{
-	bitmap_backend_data_t *data = (bitmap_backend_data_t *) backend_data;
-
-	for (size_t i = 0; i < data->glyph_count; ++i) {
-		if (data->glyph_cache[i].surface) {
-			surface_destroy(data->glyph_cache[i].surface);
-		}
-	}
-	free(data->glyph_cache);
-
-	data->decoder->release(data->decoder_data);
-	free(data);
-}
-
-font_backend_t bitmap_backend = {
-	.get_font_metrics = bb_get_font_metrics,
-	.resolve_glyph = bb_resolve_glyph,
-	.get_glyph_metrics = bb_get_glyph_metrics,
-	.render_glyph = bb_render_glyph,
-	.release = bb_release
-};
-
-errno_t bitmap_font_create(bitmap_font_decoder_t *decoder, void *decoder_data,
-    uint32_t glyph_count, font_metrics_t font_metrics, uint16_t points,
-    font_t **out_font)
-{
-	if (glyph_count == 0)
-		return EINVAL;
-
-	bitmap_backend_data_t *data = malloc(sizeof(bitmap_backend_data_t));
-	if (data == NULL)
-		return ENOMEM;
-
-	data->glyph_count = glyph_count;
-	data->points = points;
-	data->decoder = decoder;
-	data->decoder_data = decoder_data;
-	data->font_metrics = font_metrics;
-	metric_t line_height = (font_metrics.ascender + font_metrics.descender);
-	if (points == line_height) {
-		data->scale = false;
-		data->scale_ratio = 1.0;
-	} else {
-		data->scale = true;
-		data->scale_ratio = ((double) points) / ((double) line_height);
-		line_height = (data->scale_ratio * ((double) line_height));
-		data->font_metrics.ascender = (metric_t)
-		    (data->scale_ratio * data->font_metrics.ascender + 0.5);
-		data->font_metrics.descender =
-		    line_height - data->font_metrics.ascender;
-		data->font_metrics.leading = (metric_t)
-		    (data->scale_ratio * data->font_metrics.leading + 0.5);
-	}
-
-	data->glyph_cache = calloc(data->glyph_count,
-	    sizeof(glyph_cache_item_t));
-	if (data->glyph_cache == NULL) {
-		free(data);
-		return ENOMEM;
-	}
-
-	for (size_t i = 0; i < data->glyph_count; ++i) {
-		data->glyph_cache[i].surface = NULL;
-		data->glyph_cache[i].metrics_loaded = false;
-	}
-
-	font_t *font = font_create(&bitmap_backend, data);
-	if (font == NULL) {
-		free(data->glyph_cache);
-		free(data);
-		return ENOMEM;
-	}
-
-	*out_font = font;
-	return EOK;
-}
-
-/** @}
- */
Index: uspace/lib/draw/font/embedded.c
===================================================================
--- uspace/lib/draw/font/embedded.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * Copyright (c) 2014 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <stdint.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include <draw/gfx.h>
-#include <draw/font.h>
-#include <draw/drawctx.h>
-#include <fbfont/font-8x16.h>
-
-static errno_t fde_resolve_glyph(void *unused, const char32_t chr,
-    glyph_id_t *glyph_id)
-{
-	bool found = false;
-	uint16_t glyph = fb_font_glyph(chr, &found);
-	if (!found)
-		return ENOENT;
-
-	*glyph_id = glyph;
-	return EOK;
-}
-
-static errno_t fde_load_glyph_surface(void *unused, glyph_id_t glyph_id,
-    surface_t **out_surface)
-{
-	surface_t *surface = surface_create(FONT_WIDTH, FONT_SCANLINES, NULL, 0);
-	if (!surface)
-		return ENOMEM;
-
-	for (unsigned int y = 0; y < FONT_SCANLINES; ++y) {
-		for (unsigned int x = 0; x < FONT_WIDTH; ++x) {
-			pixel_t p = (fb_font[glyph_id][y] & (1 << (7 - x))) ?
-			    PIXEL(255, 0, 0, 0) : PIXEL(0, 0, 0, 0);
-			surface_put_pixel(surface, x, y, p);
-		}
-	}
-
-	*out_surface = surface;
-	return EOK;
-}
-
-static errno_t fde_load_glyph_metrics(void *unused, glyph_id_t glyph_id,
-    glyph_metrics_t *gm)
-{
-	/* This is simple monospaced font, so fill this data statically */
-	gm->left_side_bearing = 0;
-	gm->width = FONT_WIDTH;
-	gm->right_side_bearing = 0;
-	gm->ascender = FONT_ASCENDER;
-	gm->height = FONT_SCANLINES;
-
-	return EOK;
-}
-
-static void fde_release(void *data)
-{
-	/* no-op */
-}
-
-bitmap_font_decoder_t fd_embedded = {
-	.resolve_glyph = fde_resolve_glyph,
-	.load_glyph_surface = fde_load_glyph_surface,
-	.load_glyph_metrics = fde_load_glyph_metrics,
-	.release = fde_release
-};
-
-font_metrics_t font_metrics = {
-	.ascender = FONT_ASCENDER,
-	.descender = (FONT_SCANLINES - FONT_ASCENDER),
-	.leading = 0
-};
-
-errno_t embedded_font_create(font_t **font, uint16_t points)
-{
-	return bitmap_font_create(&fd_embedded, NULL, FONT_GLYPHS, font_metrics,
-	    points, font);
-}
-
-/** @}
- */
Index: uspace/lib/draw/font/pcf.c
===================================================================
--- uspace/lib/draw/font/pcf.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,618 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <stddef.h>
-#include <stdint.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <stdio.h>
-#include <align.h>
-#include <offset.h>
-#include <stdlib.h>
-#include <str.h>
-
-#include <draw/font.h>
-#include <draw/drawctx.h>
-
-#define PCF_TABLE_ACCELERATORS 0x02
-#define PCF_TABLE_METRICS      0x04
-#define PCF_TABLE_BITMAPS      0x08
-#define PCF_TABLE_INK_METRICS  0x10
-#define PCF_TABLE_ENCODINGS    0x20
-
-#define PCF_FORMAT_DEFAULT            0x00000000
-#define PCF_FORMAT_MASK               0xffffff00
-#define PCF_FORMAT_MSBYTE_FIRST       0x00000004
-#define PCF_FORMAT_MSBIT_FIRST        0x00000008
-#define PCF_FORMAT_COMPRESSED_METRICS 0x00000100
-
-typedef struct {
-	uint32_t type;
-	uint32_t format;
-	uint32_t size; /* in bytes */
-	uint32_t offset; /* in bytes from beginning of file */
-} __attribute__((__packed__)) pcf_toc_entry_t;
-
-typedef struct {
-	uint16_t min_byte2;
-	uint16_t max_byte2;
-	uint16_t min_byte1;
-	uint16_t max_byte1;
-	uint16_t default_char;
-} __attribute__((__packed__)) pcf_encoding_t;
-
-typedef struct {
-	uint8_t left_side_bearing;
-	uint8_t right_side_bearing;
-	uint8_t character_width;
-	uint8_t character_ascent;
-	uint8_t character_descent;
-} __attribute__((__packed__)) pcf_compressed_metrics_t;
-
-typedef struct {
-	int16_t left_side_bearing;
-	int16_t right_side_bearing;
-	int16_t character_width;
-	int16_t character_ascent;
-	int16_t character_descent;
-	uint16_t character_attributes;
-} __attribute__((__packed__)) pcf_default_metrics_t;
-
-typedef struct {
-	uint8_t unused_font_information[8];
-	int32_t font_ascent;
-	int32_t font_descent;
-} __attribute__((__packed__)) pcf_accelerators_t;
-
-typedef struct {
-	FILE *file;
-	uint32_t glyph_count;
-	pcf_toc_entry_t bitmap_table;
-	pcf_toc_entry_t metrics_table;
-	pcf_toc_entry_t encodings_table;
-	pcf_toc_entry_t accelerators_table;
-	pcf_encoding_t encoding;
-	font_metrics_t font_metrics;
-} pcf_data_t;
-
-static inline uint32_t uint32_t_pcf2host(uint32_t val, uint32_t format)
-{
-	if (format & PCF_FORMAT_MSBYTE_FIRST) {
-		return uint32_t_be2host(val);
-	} else {
-		return uint32_t_le2host(val);
-	}
-}
-
-static inline uint16_t uint16_t_pcf2host(uint16_t val, uint32_t format)
-{
-	if (format & PCF_FORMAT_MSBYTE_FIRST) {
-		return uint16_t_be2host(val);
-	} else {
-		return uint16_t_le2host(val);
-	}
-}
-
-static inline int16_t int16_t_pcf2host(int16_t val, uint32_t format)
-{
-	return (int16_t) uint16_t_pcf2host((uint16_t) val, format);
-}
-
-static inline int32_t int32_t_pcf2host(int32_t val, uint32_t format)
-{
-	return (int32_t) uint32_t_pcf2host((uint32_t) val, format);
-}
-
-static int16_t compressed2int(uint8_t compressed)
-{
-	int16_t ret = compressed;
-	ret -= 0x80;
-	return ret;
-}
-
-static errno_t pcf_resolve_glyph(void *opaque_data, const char32_t chr,
-    glyph_id_t *glyph_id)
-{
-	pcf_data_t *data = (pcf_data_t *) opaque_data;
-
-	/* TODO is this correct? */
-	uint8_t byte1 = (chr >> 8) & 0xff;
-	uint8_t byte2 = chr & 0xff;
-	pcf_encoding_t *e = &data->encoding;
-
-	aoff64_t entry_index =
-	    (byte1 - e->min_byte1) * (e->max_byte2 - e->min_byte2 + 1) +
-	    (byte2 - e->min_byte2);
-
-	aoff64_t entry_offset = data->encodings_table.offset +
-	    (sizeof(uint32_t) + 5 * sizeof(uint16_t)) +
-	    entry_index * sizeof(uint16_t);
-
-	int rc = fseek(data->file, entry_offset, SEEK_SET);
-	if (rc != 0)
-		return errno;
-
-	uint16_t glyph = 0;
-	size_t records_read = fread(&glyph, sizeof(uint16_t), 1, data->file);
-	if (records_read != 1)
-		return EINVAL;
-
-	glyph = uint16_t_pcf2host(glyph, data->encodings_table.format);
-
-	if (glyph == 0xffff)
-		return ENOENT;
-
-	*glyph_id = glyph;
-
-	return EOK;
-}
-
-static errno_t load_glyph_metrics(pcf_data_t *data, uint32_t glyph_id,
-    pcf_toc_entry_t *table, pcf_default_metrics_t *metrics)
-{
-	aoff64_t offset;
-	int rc;
-	size_t records_read;
-
-	if (table->format & PCF_FORMAT_COMPRESSED_METRICS) {
-		offset = table->offset + sizeof(uint32_t) + sizeof(uint16_t) +
-		    glyph_id * sizeof(pcf_compressed_metrics_t);
-
-		rc = fseek(data->file, offset, SEEK_SET);
-		if (rc != 0)
-			return errno;
-
-		pcf_compressed_metrics_t compressed_metrics;
-		records_read = fread(&compressed_metrics,
-		    sizeof(pcf_compressed_metrics_t), 1, data->file);
-		if (records_read != 1)
-			return EINVAL;
-
-		metrics->left_side_bearing =
-		    compressed2int(compressed_metrics.left_side_bearing);
-		metrics->right_side_bearing =
-		    compressed2int(compressed_metrics.right_side_bearing);
-		metrics->character_width =
-		    compressed2int(compressed_metrics.character_width);
-		metrics->character_ascent =
-		    compressed2int(compressed_metrics.character_ascent);
-		metrics->character_descent =
-		    compressed2int(compressed_metrics.character_descent);
-		metrics->character_attributes = 0;
-	} else {
-		offset = table->offset + 2 * sizeof(uint32_t) +
-		    glyph_id * sizeof(pcf_default_metrics_t);
-
-		rc = fseek(data->file, offset, SEEK_SET);
-		if (rc != 0)
-			return errno;
-
-		pcf_default_metrics_t uncompressed_metrics;
-		records_read = fread(&uncompressed_metrics,
-		    sizeof(pcf_default_metrics_t), 1, data->file);
-		if (records_read != 1)
-			return EINVAL;
-
-		metrics->left_side_bearing =
-		    int16_t_pcf2host(uncompressed_metrics.left_side_bearing,
-		    table->format);
-		metrics->right_side_bearing =
-		    int16_t_pcf2host(uncompressed_metrics.right_side_bearing,
-		    table->format);
-		metrics->character_width =
-		    int16_t_pcf2host(uncompressed_metrics.character_width,
-		    table->format);
-		metrics->character_ascent =
-		    int16_t_pcf2host(uncompressed_metrics.character_ascent,
-		    table->format);
-		metrics->character_descent =
-		    int16_t_pcf2host(uncompressed_metrics.character_descent,
-		    table->format);
-		metrics->character_attributes =
-		    uint16_t_pcf2host(uncompressed_metrics.character_attributes,
-		    table->format);
-	}
-
-	return EOK;
-}
-
-static errno_t pcf_load_glyph_surface(void *opaque_data, glyph_id_t glyph_id,
-    surface_t **out_surface)
-{
-	pcf_data_t *data = (pcf_data_t *) opaque_data;
-
-	pcf_default_metrics_t pcf_metrics;
-	memset(&pcf_metrics, 0, sizeof(pcf_default_metrics_t));
-	errno_t rc = load_glyph_metrics(data, glyph_id, &data->metrics_table,
-	    &pcf_metrics);
-	if (rc != EOK)
-		return rc;
-
-	aoff64_t offset = data->bitmap_table.offset + (2 * sizeof(uint32_t)) +
-	    (glyph_id * sizeof(uint32_t));
-
-	if (fseek(data->file, offset, SEEK_SET) < 0)
-		return errno;
-
-	uint32_t bitmap_offset = 0;
-	size_t records_read = fread(&bitmap_offset, sizeof(uint32_t), 1,
-	    data->file);
-	if (records_read != 1)
-		return EINVAL;
-	bitmap_offset = uint32_t_pcf2host(bitmap_offset,
-	    data->bitmap_table.format);
-
-	offset = data->bitmap_table.offset + (2 * sizeof(uint32_t)) +
-	    (data->glyph_count * sizeof(uint32_t)) + (4 * sizeof(uint32_t)) +
-	    bitmap_offset;
-
-	if (fseek(data->file, offset, SEEK_SET) < 0)
-		return errno;
-
-	surface_coord_t width = pcf_metrics.character_width;
-	surface_coord_t height = pcf_metrics.character_ascent +
-	    pcf_metrics.character_descent;
-	size_t row_padding_bytes = (1 << (data->bitmap_table.format & 3));
-	size_t word_size_bytes = (1 << ((data->bitmap_table.format >> 4) & 3));
-	size_t row_bytes = ALIGN_UP(ALIGN_UP(width, 8) / 8, row_padding_bytes);
-	size_t bitmap_bytes = height * row_bytes;
-
-	uint8_t *bitmap = malloc(bitmap_bytes);
-	if (bitmap == NULL)
-		return ENOMEM;
-
-	records_read = fread(bitmap, sizeof(uint8_t), bitmap_bytes,
-	    data->file);
-
-	surface_t *surface = surface_create(width, height, NULL, 0);
-	if (!surface) {
-		free(bitmap);
-		return ENOMEM;
-	}
-
-	for (unsigned int y = 0; y < height; ++y) {
-		size_t row_offset = row_bytes * y;
-		for (unsigned int x = 0; x < width; ++x) {
-			size_t word_index = x / (word_size_bytes * 8);
-			size_t column_offset1 = word_index * word_size_bytes;
-			size_t byte_index_within_word =
-			    (x % (word_size_bytes * 8)) / 8;
-			size_t column_offset2;
-			if (data->bitmap_table.format & PCF_FORMAT_MSBYTE_FIRST) {
-				column_offset2 = (word_size_bytes - 1) - byte_index_within_word;
-			} else {
-				column_offset2 = byte_index_within_word;
-			}
-			uint8_t b = bitmap[row_offset + column_offset1 + column_offset2];
-			bool set;
-			if (data->bitmap_table.format & PCF_FORMAT_MSBIT_FIRST) {
-				set = (b >> (7 - (x % 8))) & 1;
-			} else {
-				set = (b >> (x % 8)) & 1;
-			}
-			pixel_t p = set ? PIXEL(255, 0, 0, 0) : PIXEL(0, 0, 0, 0);
-			surface_put_pixel(surface, x, y, p);
-		}
-	}
-
-	*out_surface = surface;
-	free(bitmap);
-	return EOK;
-}
-
-static errno_t pcf_load_glyph_metrics(void *opaque_data, glyph_id_t glyph_id,
-    glyph_metrics_t *gm)
-{
-	pcf_data_t *data = (pcf_data_t *) opaque_data;
-
-	pcf_default_metrics_t pcf_metrics;
-	memset(&pcf_metrics, 0, sizeof(pcf_default_metrics_t));
-	errno_t rc = load_glyph_metrics(data, glyph_id, &data->metrics_table,
-	    &pcf_metrics);
-	if (rc != EOK)
-		return rc;
-
-	gm->left_side_bearing = pcf_metrics.left_side_bearing;
-	gm->width = pcf_metrics.character_width;
-	gm->right_side_bearing = pcf_metrics.right_side_bearing -
-	    pcf_metrics.character_width;
-	gm->height = pcf_metrics.character_descent +
-	    pcf_metrics.character_ascent;
-	gm->ascender = pcf_metrics.character_ascent;
-
-	return EOK;
-}
-
-static void pcf_release(void *opaque_data)
-{
-	pcf_data_t *data = (pcf_data_t *) opaque_data;
-
-	fclose(data->file);
-	free(data);
-}
-
-bitmap_font_decoder_t fd_pcf = {
-	.resolve_glyph = pcf_resolve_glyph,
-	.load_glyph_surface = pcf_load_glyph_surface,
-	.load_glyph_metrics = pcf_load_glyph_metrics,
-	.release = pcf_release
-};
-
-static errno_t pcf_read_toc(pcf_data_t *data)
-{
-	int rc = fseek(data->file, 0, SEEK_END);
-	if (rc != 0)
-		return errno;
-
-	aoff64_t file_size = ftell(data->file);
-
-	rc = fseek(data->file, 0, SEEK_SET);
-	if (rc != 0)
-		return errno;
-
-	char header[4];
-	size_t records_read = fread(header, sizeof(char), 4, data->file);
-	if (records_read != 4)
-		return EINVAL;
-
-	if (header[0] != 1 || header[1] != 'f' || header[2] != 'c' ||
-	    header[3] != 'p')
-		return EINVAL;
-
-	uint32_t table_count;
-	records_read = fread(&table_count, sizeof(uint32_t), 1,
-	    data->file);
-	if (records_read != 1)
-		return EINVAL;
-
-	table_count = uint32_t_le2host(table_count);
-
-	bool found_bitmap_table = false;
-	bool found_metrics_table = false;
-	bool found_encodings_table = false;
-	bool found_accelerators_table = false;
-
-	for (uint32_t index = 0; index < table_count; index++) {
-		pcf_toc_entry_t toc_entry;
-		records_read = fread(&toc_entry, sizeof(pcf_toc_entry_t), 1,
-		    data->file);
-		toc_entry.type = uint32_t_le2host(toc_entry.type);
-		toc_entry.format = uint32_t_le2host(toc_entry.format);
-		toc_entry.size = uint32_t_le2host(toc_entry.size);
-		toc_entry.offset = uint32_t_le2host(toc_entry.offset);
-
-		if (toc_entry.offset >= file_size)
-			continue;
-
-		aoff64_t end = ((aoff64_t) toc_entry.offset) + ((aoff64_t) toc_entry.size);
-		if (end > file_size)
-			continue;
-
-		if (toc_entry.type == PCF_TABLE_BITMAPS) {
-			if (found_bitmap_table)
-				return EINVAL;
-			found_bitmap_table = true;
-			data->bitmap_table = toc_entry;
-		} else if (toc_entry.type == PCF_TABLE_METRICS) {
-			if (found_metrics_table)
-				return EINVAL;
-			found_metrics_table = true;
-			data->metrics_table = toc_entry;
-		} else if (toc_entry.type == PCF_TABLE_ENCODINGS) {
-			if (found_encodings_table)
-				return EINVAL;
-			found_encodings_table = true;
-			data->encodings_table = toc_entry;
-		} else if (toc_entry.type == PCF_TABLE_ACCELERATORS) {
-			if (found_accelerators_table)
-				return EINVAL;
-			found_accelerators_table = true;
-			data->accelerators_table = toc_entry;
-		}
-	}
-
-	if (!found_bitmap_table || !found_metrics_table ||
-	    !found_encodings_table || !found_accelerators_table)
-		return EINVAL;
-
-	return EOK;
-}
-
-static errno_t pcf_seek_table_header(pcf_data_t *data, pcf_toc_entry_t *table)
-{
-	uint32_t format;
-	int rc = fseek(data->file, table->offset, SEEK_SET);
-	if (rc != 0)
-		return errno;
-
-	size_t records_read = fread(&format, sizeof(uint32_t), 1, data->file);
-	if (records_read != 1)
-		return EINVAL;
-
-	format = uint32_t_le2host(format);
-	if (format != table->format)
-		return EINVAL;
-
-	return EOK;
-}
-
-static errno_t pcf_read_bitmap_table_header(pcf_data_t *data)
-{
-	errno_t rc = pcf_seek_table_header(data, &data->bitmap_table);
-	if (rc != EOK)
-		return rc;
-
-	if ((data->bitmap_table.format & PCF_FORMAT_MASK) != PCF_FORMAT_DEFAULT)
-		return EINVAL;
-
-	uint32_t glyph_count = 0;
-	size_t records_read = fread(&glyph_count, sizeof(uint32_t), 1,
-	    data->file);
-	if (records_read != 1)
-		return EINVAL;
-	glyph_count =  uint32_t_pcf2host(glyph_count, data->bitmap_table.format);
-
-	data->glyph_count = glyph_count;
-	return EOK;
-}
-
-static errno_t pcf_read_metrics_table_header(pcf_data_t *data)
-{
-	errno_t rc = pcf_seek_table_header(data, &data->metrics_table);
-	if (rc != EOK)
-		return rc;
-
-	size_t records_read;
-	uint32_t metrics_count;
-	if (data->metrics_table.format & PCF_FORMAT_COMPRESSED_METRICS) {
-		uint16_t metrics_count_16;
-		records_read = fread(&metrics_count_16, sizeof(uint16_t), 1,
-		    data->file);
-		if (records_read != 1)
-			return EINVAL;
-		metrics_count_16 = uint16_t_pcf2host(metrics_count_16,
-		    data->metrics_table.format);
-		metrics_count = metrics_count_16;
-	} else {
-		records_read = fread(&metrics_count, sizeof(uint32_t), 1,
-		    data->file);
-		if (records_read != 1)
-			return EINVAL;
-		metrics_count = uint32_t_pcf2host(metrics_count,
-		    data->metrics_table.format);
-	}
-
-	if (metrics_count != data->glyph_count)
-		return EINVAL;
-
-	return EOK;
-}
-
-static errno_t pcf_read_encodings_table_header(pcf_data_t *data)
-{
-	errno_t rc = pcf_seek_table_header(data, &data->encodings_table);
-	if (rc != EOK)
-		return rc;
-
-	pcf_encoding_t encoding;
-	size_t records_read = fread(&encoding, sizeof(pcf_encoding_t), 1,
-	    data->file);
-	if (records_read != 1)
-		return EINVAL;
-
-	encoding.min_byte1 = uint16_t_pcf2host(encoding.min_byte1,
-	    data->encodings_table.format);
-	encoding.max_byte1 = uint16_t_pcf2host(encoding.max_byte1,
-	    data->encodings_table.format);
-	encoding.min_byte2 = uint16_t_pcf2host(encoding.min_byte2,
-	    data->encodings_table.format);
-	encoding.max_byte2 = uint16_t_pcf2host(encoding.max_byte2,
-	    data->encodings_table.format);
-	encoding.default_char = uint16_t_pcf2host(encoding.default_char,
-	    data->encodings_table.format);
-
-	data->encoding = encoding;
-	return EOK;
-}
-
-static errno_t pcf_read_accelerators_table(pcf_data_t *data)
-{
-	errno_t rc = pcf_seek_table_header(data, &data->accelerators_table);
-	if (rc != EOK)
-		return rc;
-
-	pcf_accelerators_t accelerators;
-	size_t records_read = fread(&accelerators, sizeof(pcf_accelerators_t),
-	    1, data->file);
-	if (records_read != 1)
-		return EINVAL;
-
-	data->font_metrics.ascender = int32_t_pcf2host(accelerators.font_ascent,
-	    data->accelerators_table.format);
-	data->font_metrics.descender = int32_t_pcf2host(accelerators.font_descent,
-	    data->accelerators_table.format);
-	data->font_metrics.leading = 0;
-
-	return EOK;
-}
-
-errno_t pcf_font_create(font_t **font, char *filename, uint16_t points)
-{
-	errno_t rc;
-	pcf_data_t *data = malloc(sizeof(pcf_data_t));
-	if (data == NULL)
-		return ENOMEM;
-
-	data->file = fopen(filename, "rb");
-	if (data->file == NULL)
-		goto read_error;
-
-	rc = pcf_read_toc(data);
-	if (rc != EOK)
-		goto error;
-
-	rc = pcf_read_bitmap_table_header(data);
-	if (rc != EOK)
-		goto error;
-
-	rc = pcf_read_metrics_table_header(data);
-	if (rc != EOK)
-		goto error;
-
-	rc = pcf_read_encodings_table_header(data);
-	if (rc != EOK)
-		goto error;
-
-	rc = pcf_read_accelerators_table(data);
-	if (rc != EOK)
-		goto error;
-
-	rc = bitmap_font_create(&fd_pcf, data, data->glyph_count,
-	    data->font_metrics, points, font);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-read_error:
-	rc = EINVAL;
-error:
-	if (data->file)
-		fclose(data->file);
-	free(data);
-	return rc;
-}
-
-/** @}
- */
Index: uspace/lib/draw/gfx/cursor-11x18.c
===================================================================
--- uspace/lib/draw/gfx/cursor-11x18.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2008 Martin Decky
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/** @file
- */
-
-#include <draw/gfx.h>
-
-uint8_t cursor_texture[] = {
-	0x01, 0x00, 0x03, 0x00, 0x05, 0x00, 0x09, 0x00, 0x11, 0x00, 0x21, 0x00,
-	0x41, 0x00, 0x81, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x04, 0x01, 0x03,
-	0x81, 0x00, 0x89, 0x00, 0x15, 0x01, 0x23, 0x01, 0x21, 0x01, 0xc0, 0x00
-};
-
-uint8_t cursor_mask[] = {
-	0x01, 0x00, 0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00,
-	0x7f, 0x00, 0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x07, 0xff, 0x03,
-	0xff, 0x00, 0xff, 0x00, 0xf7, 0x01, 0xe3, 0x01, 0xe1, 0x01, 0xc0, 0x00
-};
-
-/** @}
- */
Index: uspace/lib/draw/include/draw/codec.h
===================================================================
--- uspace/lib/draw/include/draw/codec.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DRAW_CODEC_H_
-#define DRAW_CODEC_H_
-
-#include <stddef.h>
-#include "surface.h"
-
-extern surface_t *decode_tga_gz(void *, size_t, surface_flags_t);
-extern bool encode_tga_gz(surface_t *, void **, size_t *);
-extern surface_t *decode_tga(void *, size_t, surface_flags_t);
-extern bool encode_tga(surface_t *, void **, size_t *);
-extern surface_t *decode_webp(void *, size_t, surface_flags_t);
-extern bool encode_webp(surface_t *, void **, size_t *);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/draw/include/draw/cursor.h
===================================================================
--- uspace/lib/draw/include/draw/cursor.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DRAW_CURSOR_H_
-#define DRAW_CURSOR_H_
-
-#include <stdint.h>
-
-#include "surface.h"
-
-typedef enum {
-	CURSOR_DECODER_EMBEDDED
-} cursor_decoder_type_t;
-
-typedef struct {
-	void (*init)(char *, uint8_t *, void **);
-	surface_t *(*render)(uint8_t);
-	void (*release)(void *);
-} cursor_decoder_t;
-
-typedef struct cursor {
-	uint8_t state_count;
-	surface_t **states;
-	cursor_decoder_t *decoder;
-	void *decoder_data;
-} cursor_t;
-
-extern cursor_decoder_t cd_embedded;
-
-extern void cursor_init(cursor_t *, cursor_decoder_type_t, char *);
-extern void cursor_release(cursor_t *);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/draw/include/draw/drawctx.h
===================================================================
--- uspace/lib/draw/include/draw/drawctx.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DRAW_DRAWCTX_H_
-#define DRAW_DRAWCTX_H_
-
-#include <stdbool.h>
-
-#include <compose.h>
-
-#include "surface.h"
-#include "source.h"
-#include "path.h"
-#include "font.h"
-
-struct drawctx {
-	link_t link;
-	list_t list;
-
-	surface_t *surface;
-	compose_t compose;
-	surface_t *mask;
-	source_t *source;
-	font_t *font;
-
-	bool shall_clip;
-	sysarg_t clip_x;
-	sysarg_t clip_y;
-	sysarg_t clip_width;
-	sysarg_t clip_height;
-};
-
-extern void drawctx_init(drawctx_t *, surface_t *);
-
-extern void drawctx_save(drawctx_t *);
-extern void drawctx_restore(drawctx_t *);
-
-extern void drawctx_set_compose(drawctx_t *, compose_t);
-extern void drawctx_set_clip(drawctx_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
-extern void drawctx_set_mask(drawctx_t *, surface_t *);
-extern void drawctx_set_source(drawctx_t *, source_t *);
-extern void drawctx_set_font(drawctx_t *, font_t *);
-
-extern void drawctx_transfer(drawctx_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
-extern void drawctx_stroke(drawctx_t *, path_t *);
-extern void drawctx_fill(drawctx_t *, path_t *);
-extern void drawctx_print(drawctx_t *, const char *, sysarg_t, sysarg_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/draw/include/draw/font.h
===================================================================
--- uspace/lib/draw/include/draw/font.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * Copyright (c) 2014 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DRAW_FONT_H_
-#define DRAW_FONT_H_
-
-#include <stdint.h>
-
-#include "font.h"
-#include "surface.h"
-#include "source.h"
-
-struct drawctx;
-typedef struct drawctx drawctx_t;
-
-typedef int metric_t;
-
-typedef struct {
-	/* Horizontal distance between origin and left side of the glyph */
-	metric_t left_side_bearing;
-
-	/* Width of the actual glyph drawn */
-	metric_t width;
-
-	/*
-	 * Horizontal distance between right side of the glyph and origin
-	 * of the next glyph
-	 */
-	metric_t right_side_bearing;
-
-	/*
-	 * Vertical distance between baseline and top of the glyph
-	 * (positive to top)
-	 */
-	metric_t ascender;
-
-	/* Height of the actual glyph drawn */
-	metric_t height;
-} glyph_metrics_t;
-
-static inline metric_t glyph_metrics_get_descender(glyph_metrics_t *gm)
-{
-	return gm->height - gm->ascender;
-}
-
-static inline metric_t glyph_metrics_get_advancement(glyph_metrics_t *gm)
-{
-	return gm->left_side_bearing + gm->width + gm->right_side_bearing;
-}
-
-typedef struct {
-	/* Distance between top of the line and baseline */
-	metric_t ascender;
-
-	/* Distance between baseline and bottom of the line */
-	metric_t descender;
-
-	/* Distance between bottom of the line and top of the next line */
-	metric_t leading;
-} font_metrics_t;
-
-typedef uint32_t glyph_id_t;
-
-typedef struct {
-	errno_t (*get_font_metrics)(void *, font_metrics_t *);
-	errno_t (*resolve_glyph)(void *, char32_t, glyph_id_t *);
-	errno_t (*get_glyph_metrics)(void *, glyph_id_t, glyph_metrics_t *);
-	errno_t (*render_glyph)(void *, drawctx_t *, source_t *, sysarg_t,
-	    sysarg_t, glyph_id_t);
-	void (*release)(void *);
-} font_backend_t;
-
-typedef struct {
-	font_backend_t *backend;
-	void *backend_data;
-} font_t;
-
-typedef struct {
-	errno_t (*resolve_glyph)(void *, const char32_t, glyph_id_t *);
-	errno_t (*load_glyph_surface)(void *, glyph_id_t, surface_t **);
-	errno_t (*load_glyph_metrics)(void *, glyph_id_t, glyph_metrics_t *);
-	void (*release)(void *);
-} bitmap_font_decoder_t;
-
-extern font_t *font_create(font_backend_t *, void *);
-extern errno_t font_get_metrics(font_t *, font_metrics_t *);
-extern errno_t font_resolve_glyph(font_t *, char32_t, glyph_id_t *);
-extern errno_t font_get_glyph_metrics(font_t *, glyph_id_t, glyph_metrics_t *);
-extern errno_t font_render_glyph(font_t *, drawctx_t *, source_t *,
-    sysarg_t, sysarg_t, glyph_id_t);
-extern void font_release(font_t *);
-
-extern errno_t font_get_box(font_t *, char *, sysarg_t *, sysarg_t *);
-extern errno_t font_draw_text(font_t *, drawctx_t *, source_t *, const char *,
-    sysarg_t, sysarg_t);
-
-extern errno_t bitmap_font_create(bitmap_font_decoder_t *, void *, uint32_t,
-    font_metrics_t, uint16_t, font_t **);
-extern errno_t embedded_font_create(font_t **, uint16_t points);
-extern errno_t pcf_font_create(font_t **, char *path, uint16_t points);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/draw/include/draw/gfx.h
===================================================================
--- uspace/lib/draw/include/draw/gfx.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2008 Martin Decky
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/** @file
- */
-
-#ifndef GFX_H_
-#define GFX_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <uchar.h>
-
-#define CURSOR_WIDTH   11
-#define CURSOR_HEIGHT  18
-
-#define FONT_GLYPHS     2899
-#define FONT_WIDTH      8
-#define FONT_SCANLINES  16
-#define FONT_ASCENDER   12
-
-extern uint8_t cursor_texture[];
-extern uint8_t cursor_mask[];
-
-#endif
-
-/** @}
- */
Index: uspace/lib/draw/include/draw/path.h
===================================================================
--- uspace/lib/draw/include/draw/path.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DRAW_PATH_H_
-#define DRAW_PATH_H_
-
-#include <adt/list.h>
-
-typedef enum {
-	PATH_STEP_MOVETO,
-	PATH_STEP_LINETO
-} path_step_type_t;
-
-typedef struct {
-	link_t link;
-	path_step_type_t type;
-	double to_x;
-	double to_y;
-} path_step_t;
-
-struct path;
-typedef struct path path_t;
-
-extern void path_init(path_t *);
-extern void path_clear(path_t *);
-
-extern void path_get_cursor(path_t *, double *, double *);
-
-extern void path_move_to(path_t *, double, double);
-extern void path_line_to(path_t *, double, double);
-
-extern void path_rectangle(path_t *, double, double, double, double);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/draw/include/draw/source.h
===================================================================
--- uspace/lib/draw/include/draw/source.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DRAW_SOURCE_H_
-#define DRAW_SOURCE_H_
-
-#include <stdbool.h>
-
-#include <transform.h>
-#include <filter.h>
-#include <io/pixelmap.h>
-
-#include "surface.h"
-
-typedef struct source {
-	transform_t transform;
-	filter_t filter;
-
-	pixel_t color;
-	surface_t *texture;
-	pixelmap_extend_t texture_extend;
-
-	pixel_t alpha;
-	surface_t *mask;
-	pixelmap_extend_t mask_extend;
-} source_t;
-
-extern void source_init(source_t *);
-
-extern void source_set_transform(source_t *, transform_t);
-extern void source_reset_transform(source_t *);
-
-extern void source_set_filter(source_t *, filter_t);
-
-extern void source_set_color(source_t *, pixel_t);
-extern void source_set_texture(source_t *, surface_t *, pixelmap_extend_t);
-
-extern void source_set_alpha(source_t *, pixel_t);
-extern void source_set_mask(source_t *, surface_t *, pixelmap_extend_t);
-
-extern bool source_is_fast(source_t *);
-extern pixel_t *source_direct_access(source_t *, double, double);
-extern pixel_t source_determine_pixel(source_t *, double, double);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/draw/include/draw/surface.h
===================================================================
--- uspace/lib/draw/include/draw/surface.h	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DRAW_SURFACE_H_
-#define DRAW_SURFACE_H_
-
-#include <stdbool.h>
-#include <io/pixelmap.h>
-
-struct surface;
-typedef struct surface surface_t;
-
-typedef sysarg_t surface_coord_t;
-
-typedef enum {
-	SURFACE_FLAG_NONE = 0,
-	SURFACE_FLAG_SHARED = 1
-} surface_flags_t;
-
-extern surface_t *surface_create(surface_coord_t, surface_coord_t, pixel_t *, surface_flags_t);
-extern void surface_destroy(surface_t *);
-
-extern bool surface_is_shared(surface_t *);
-extern pixel_t *surface_direct_access(surface_t *);
-extern pixelmap_t *surface_pixmap_access(surface_t *);
-extern void surface_get_resolution(surface_t *, surface_coord_t *, surface_coord_t *);
-extern void surface_get_damaged_region(surface_t *, surface_coord_t *, surface_coord_t *,
-    surface_coord_t *, surface_coord_t *);
-extern void surface_add_damaged_region(surface_t *, surface_coord_t, surface_coord_t,
-    surface_coord_t, surface_coord_t);
-extern void surface_reset_damaged_region(surface_t *);
-
-extern void surface_put_pixel(surface_t *, surface_coord_t, surface_coord_t, pixel_t);
-extern pixel_t surface_get_pixel(surface_t *, surface_coord_t, surface_coord_t);
-
-#endif
-
-/** @}
- */
Index: uspace/lib/draw/meson.build
===================================================================
--- uspace/lib/draw/meson.build	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2011 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'softrend' , 'compress', 'fbfont' ]
-src = files(
-	'codec/tga.c',
-	'codec/tga.gz.c',
-	'codec/webp.c',
-	'cursor/embedded.c',
-	'font/embedded.c',
-	'font/bitmap_backend.c',
-	'font/pcf.c',
-	'gfx/cursor-11x18.c',
-	'drawctx.c',
-	'cursor.c',
-	'font.c',
-	'path.c',
-	'source.c',
-	'surface.c',
-)
Index: uspace/lib/draw/path.c
===================================================================
--- uspace/lib/draw/path.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <draw/path.h>
-
-struct path {
-	list_t list;
-	double cur_x;
-	double cur_y;
-};
-
-void path_init(path_t *path)
-{
-	list_initialize(&path->list);
-	path->cur_x = 0;
-	path->cur_y = 0;
-}
-
-void path_clear(path_t *path)
-{
-	while (!list_empty(&path->list)) {
-		path_step_t *step = (path_step_t *) list_last(&path->list);
-		list_remove(&step->link);
-		free(step);
-	}
-	path->cur_x = 0;
-	path->cur_y = 0;
-}
-
-void path_get_cursor(path_t *path, double *x, double *y)
-{
-	assert(x);
-	assert(y);
-
-	*x = path->cur_x;
-	*y = path->cur_y;
-}
-
-void path_move_to(path_t *path, double dx, double dy)
-{
-	path_step_t *step = (path_step_t *) malloc(sizeof(path_step_t));
-	if (step) {
-		path->cur_x += dx;
-		path->cur_y += dy;
-		link_initialize(&step->link);
-		step->type = PATH_STEP_MOVETO;
-		step->to_x = path->cur_x;
-		step->to_y = path->cur_y;
-		list_append(&step->link, &path->list);
-
-	}
-}
-
-void path_line_to(path_t *path, double dx, double dy)
-{
-	path_step_t *step = (path_step_t *) malloc(sizeof(path_step_t));
-	if (step) {
-		path->cur_x += dx;
-		path->cur_y += dy;
-		link_initialize(&step->link);
-		step->type = PATH_STEP_LINETO;
-		step->to_x = path->cur_x;
-		step->to_y = path->cur_y;
-		list_append(&step->link, &path->list);
-	}
-}
-
-void path_rectangle(path_t *path, double x, double y, double width, double height)
-{
-	path_move_to(path, x, y);
-	path_line_to(path, width, 0);
-	path_line_to(path, 0, height);
-	path_line_to(path, -width, 0);
-	path_line_to(path, 0, -height);
-}
-
-/** @}
- */
Index: uspace/lib/draw/source.c
===================================================================
--- uspace/lib/draw/source.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <assert.h>
-
-#include <draw/source.h>
-
-void source_init(source_t *source)
-{
-	transform_identity(&source->transform);
-	source->filter = filter_nearest;
-
-	source->color = PIXEL(0, 0, 0, 0);
-	source->texture = NULL;
-	source->texture_extend = PIXELMAP_EXTEND_TRANSPARENT_BLACK;
-
-	source->alpha = PIXEL(255, 0, 0, 0);
-	source->mask = NULL;
-	source->mask_extend = PIXELMAP_EXTEND_TRANSPARENT_BLACK;
-}
-
-void source_set_transform(source_t *source, transform_t transform)
-{
-	source->transform = transform;
-	transform_invert(&source->transform);
-}
-
-void source_reset_transform(source_t *source)
-{
-	transform_identity(&source->transform);
-}
-
-void source_set_filter(source_t *source, filter_t filter)
-{
-	source->filter = filter;
-}
-
-void source_set_color(source_t *source, pixel_t color)
-{
-	source->color = color;
-}
-
-void source_set_texture(source_t *source, surface_t *texture,
-    pixelmap_extend_t extend)
-{
-	source->texture = texture;
-	source->texture_extend = extend;
-}
-
-void source_set_alpha(source_t *source, pixel_t alpha)
-{
-	source->alpha = alpha;
-}
-
-void source_set_mask(source_t *source, surface_t *mask,
-    pixelmap_extend_t extend)
-{
-	source->mask = mask;
-	source->mask_extend = extend;
-}
-
-bool source_is_fast(source_t *source)
-{
-	return ((source->mask == NULL) &&
-	    (source->alpha == (pixel_t) PIXEL(255, 0, 0, 0)) &&
-	    (source->texture != NULL) &&
-	    (transform_is_fast(&source->transform)));
-}
-
-pixel_t *source_direct_access(source_t *source, double x, double y)
-{
-	assert(source_is_fast(source));
-
-	long _x = (long) (x + source->transform.matrix[0][2]);
-	long _y = (long) (y + source->transform.matrix[1][2]);
-
-	return pixelmap_pixel_at(
-	    surface_pixmap_access(source->texture), (sysarg_t) _x, (sysarg_t) _y);
-}
-
-pixel_t source_determine_pixel(source_t *source, double x, double y)
-{
-	if (source->mask || source->texture) {
-		transform_apply_affine(&source->transform, &x, &y);
-	}
-
-	pixel_t mask_pix;
-	if (source->mask) {
-		mask_pix = source->filter(
-		    surface_pixmap_access(source->mask),
-		    x, y, source->mask_extend);
-	} else {
-		mask_pix = source->alpha;
-	}
-
-	if (!ALPHA(mask_pix)) {
-		return 0;
-	}
-
-	pixel_t texture_pix;
-	if (source->texture) {
-		texture_pix = source->filter(
-		    surface_pixmap_access(source->texture),
-		    x, y, source->texture_extend);
-	} else {
-		texture_pix = source->color;
-	}
-
-	if (ALPHA(mask_pix) < 255) {
-		double ratio = ((double) ALPHA(mask_pix)) / 255.0;
-		double res_a = ratio * ((double) ALPHA(texture_pix));
-		return PIXEL((unsigned) res_a,
-		    RED(texture_pix), GREEN(texture_pix), BLUE(texture_pix));
-	} else {
-		return texture_pix;
-	}
-}
-
-/** @}
- */
Index: uspace/lib/draw/surface.c
===================================================================
--- uspace/lib/draw/surface.c	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup draw
- * @{
- */
-/**
- * @file
- */
-
-#include <mem.h>
-#include <as.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <draw/surface.h>
-
-struct surface {
-	surface_flags_t flags;
-
-	surface_coord_t dirty_x_lo;
-	surface_coord_t dirty_x_hi;
-	surface_coord_t dirty_y_lo;
-	surface_coord_t dirty_y_hi;
-
-	pixelmap_t pixmap;
-};
-
-surface_t *surface_create(surface_coord_t width, surface_coord_t height,
-    pixel_t *pixbuf, surface_flags_t flags)
-{
-	surface_t *surface = (surface_t *) malloc(sizeof(surface_t));
-	if (!surface) {
-		return NULL;
-	}
-
-	size_t pixbuf_size = width * height * sizeof(pixel_t);
-
-	if (!pixbuf) {
-		if ((flags & SURFACE_FLAG_SHARED) == SURFACE_FLAG_SHARED) {
-			pixbuf = (pixel_t *) as_area_create(AS_AREA_ANY,
-			    pixbuf_size,
-			    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
-			    AS_AREA_UNPAGED);
-			if (pixbuf == AS_MAP_FAILED) {
-				free(surface);
-				return NULL;
-			}
-		} else {
-			pixbuf = (pixel_t *) malloc(pixbuf_size);
-			if (pixbuf == NULL) {
-				free(surface);
-				return NULL;
-			}
-		}
-
-		memset(pixbuf, 0, pixbuf_size);
-	}
-
-	surface->flags = flags;
-	surface->pixmap.width = width;
-	surface->pixmap.height = height;
-	surface->pixmap.data = pixbuf;
-
-	surface_reset_damaged_region(surface);
-
-	return surface;
-}
-
-void surface_destroy(surface_t *surface)
-{
-	pixel_t *pixbuf = surface->pixmap.data;
-
-	if ((surface->flags & SURFACE_FLAG_SHARED) == SURFACE_FLAG_SHARED)
-		as_area_destroy((void *) pixbuf);
-	else
-		free(pixbuf);
-
-	free(surface);
-}
-
-bool surface_is_shared(surface_t *surface)
-{
-	return ((surface->flags & SURFACE_FLAG_SHARED) == SURFACE_FLAG_SHARED);
-}
-
-pixel_t *surface_direct_access(surface_t *surface)
-{
-	return surface->pixmap.data;
-}
-
-pixelmap_t *surface_pixmap_access(surface_t *surface)
-{
-	return &surface->pixmap;
-}
-
-void surface_get_resolution(surface_t *surface, surface_coord_t *width, surface_coord_t *height)
-{
-	assert(width);
-	assert(height);
-
-	*width = surface->pixmap.width;
-	*height = surface->pixmap.height;
-}
-
-void surface_get_damaged_region(surface_t *surface, surface_coord_t *x, surface_coord_t *y,
-    surface_coord_t *width, surface_coord_t *height)
-{
-	assert(x);
-	assert(y);
-	assert(width);
-	assert(height);
-
-	*x = surface->dirty_x_lo;
-	*y = surface->dirty_y_lo;
-	*width = surface->dirty_x_lo <= surface->dirty_x_hi ?
-	    (surface->dirty_x_hi - surface->dirty_x_lo) + 1 : 0;
-	*height = surface->dirty_y_lo <= surface->dirty_y_hi ?
-	    (surface->dirty_y_hi - surface->dirty_y_lo) + 1 : 0;
-}
-
-void surface_add_damaged_region(surface_t *surface, surface_coord_t x, surface_coord_t y,
-    surface_coord_t width, surface_coord_t height)
-{
-	surface->dirty_x_lo = surface->dirty_x_lo > x ? x : surface->dirty_x_lo;
-	surface->dirty_y_lo = surface->dirty_y_lo > y ? y : surface->dirty_y_lo;
-
-	surface_coord_t x_hi = x + width - 1;
-	surface_coord_t y_hi = y + height - 1;
-
-	surface->dirty_x_hi = surface->dirty_x_hi < x_hi ? x_hi : surface->dirty_x_hi;
-	surface->dirty_y_hi = surface->dirty_y_hi < y_hi ? y_hi : surface->dirty_y_hi;
-}
-
-void surface_reset_damaged_region(surface_t *surface)
-{
-	surface->dirty_x_lo = surface->pixmap.width - 1;
-	surface->dirty_x_hi = 0;
-	surface->dirty_y_lo = surface->pixmap.height - 1;
-	surface->dirty_y_hi = 0;
-}
-
-void surface_put_pixel(surface_t *surface, surface_coord_t x, surface_coord_t y, pixel_t pixel)
-{
-	surface->dirty_x_lo = surface->dirty_x_lo > x ? x : surface->dirty_x_lo;
-	surface->dirty_x_hi = surface->dirty_x_hi < x ? x : surface->dirty_x_hi;
-	surface->dirty_y_lo = surface->dirty_y_lo > y ? y : surface->dirty_y_lo;
-	surface->dirty_y_hi = surface->dirty_y_hi < y ? y : surface->dirty_y_hi;
-
-	pixelmap_put_pixel(&surface->pixmap, x, y, pixel);
-}
-
-pixel_t surface_get_pixel(surface_t *surface, surface_coord_t x, surface_coord_t y)
-{
-	return pixelmap_get_pixel(&surface->pixmap, x, y);
-}
-
-/** @}
- */
Index: uspace/lib/meson.build
===================================================================
--- uspace/lib/meson.build	(revision 0576df9c3cf6dea4ee0796c50c76680c8fafcad7)
+++ uspace/lib/meson.build	(revision 63b35c78ce6d4e8e89c73f64421c78ce3a17eaf9)
@@ -34,5 +34,4 @@
 	'math',
 	'display',
-	'draw',
 	'softrend',
 	'posix',
@@ -41,4 +40,5 @@
 	'hound',
 	'gfx',
+	'gfximage',
 	'ipcgfx',
 	'display',
@@ -79,5 +79,4 @@
 	'bithenge',
 	'congfx',
-	'draw',
 	'drv',
 	'ext4',
