uterm: video: replace bpp with format id

Instead of using bpp as parameter for buffers we now use format
identifiers so we can add different formats with the same bpp. Please note
that currently only xrgb32 is supported.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann committed 2012-07-22 16:16:51 +02:00
1 parent a4ab9158f1
commit c170a43624
4 files changed
+16 -10

No files matched your search

+2 -2
View File
@@ -771,11 +771,11 @@ int font_screen_draw_perform(struct font_screen *screen, float *m)
static const float ver[] = { -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1 };
static const float tex[] = { 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1 };
const struct uterm_video_buffer buf = {
.data = (void*)screen->buf->data,
.width = screen->buf->width,
.height = screen->buf->height,
.stride = screen->buf->stride,
.bpp = 4,
.format = UTERM_FORMAT_XRGB32,
.data = (void*)screen->buf->data,
};
if (!screen)
+8 -2
View File
@@ -158,12 +158,18 @@ struct uterm_video_hotplug {
int action;
};
enum uterm_video_format {
UTERM_FORMAT_MONO,
UTERM_FORMAT_GREY,
UTERM_FORMAT_XRGB32,
};
struct uterm_video_buffer {
uint8_t *data;
unsigned int width;
unsigned int height;
unsigned int stride;
unsigned int bpp;
unsigned int format;
uint8_t *data;
};
typedef void (*uterm_video_cb) (struct uterm_video *video,
+3 -3
View File
@@ -376,7 +376,7 @@ static int display_blit(struct uterm_display *disp,
return -EINVAL;
if (!buf || !video_is_awake(disp->video))
return -EINVAL;
if (buf->bpp != 4)
if (buf->format != UTERM_FORMAT_XRGB32)
return -EINVAL;
tmp = x + width;
@@ -394,10 +394,10 @@ static int display_blit(struct uterm_display *disp,
dst = rb->map;
dst = &dst[y * rb->stride + x * 4];
src = &buf->data[y * buf->stride + x * buf->bpp];
src = &buf->data[y * buf->stride + x * 4];
while (--height) {
memcpy(dst, src, buf->bpp * width);
memcpy(dst, src, 4 * width);
dst += rb->stride;
src += buf->stride;
}
+3 -3
View File
@@ -359,7 +359,7 @@ static int display_blit(struct uterm_display *disp,
return -EINVAL;
if (!buf || !video_is_awake(disp->video))
return -EINVAL;
if (buf->bpp != disp->fbdev.bpp)
if (buf->format != UTERM_FORMAT_XRGB32)
return -EINVAL;
tmp = x + width;
@@ -378,10 +378,10 @@ static int display_blit(struct uterm_display *disp,
else
dst = &disp->fbdev.map[disp->fbdev.yres * disp->fbdev.stride];
dst = &dst[y * disp->fbdev.stride + x * disp->fbdev.bpp];
src = &buf->data[y * buf->stride + x * buf->bpp];
src = &buf->data[y * buf->stride + x * 4];
while (--height) {
memcpy(dst, src, buf->bpp * width);
memcpy(dst, src, 4 * width);
dst += disp->fbdev.stride;
src += buf->stride;
}