X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Ftext_bbulk.c;h=3f238c1f695735476e2482b4599b089cfd73fd8f;hb=0249b2cb0b0da272a78b4967b9c9f6f02d73cad5;hp=dc1c4b6b20e3b0fb68039b930384f77f04871e9e;hpb=3ff09922185f612ba388dfd512a42f855c7e38b5;p=platform%2Fupstream%2Fkmscon.git diff --git a/src/text_bbulk.c b/src/text_bbulk.c index dc1c4b6..3f238c1 100644 --- a/src/text_bbulk.c +++ b/src/text_bbulk.c @@ -1,7 +1,7 @@ /* * kmscon - Bit-Blitting Bulk Text Renderer Backend * - * Copyright (c) 2012 David Herrmann + * Copyright (c) 2012-2013 David Herrmann * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files @@ -36,9 +36,9 @@ #include #include #include -#include "log.h" +#include "shl_log.h" #include "text.h" -#include "uterm.h" +#include "uterm_video.h" #define LOG_SUBSYSTEM "text_bbulk" @@ -49,9 +49,6 @@ struct bbulk { #define FONT_WIDTH(txt) ((txt)->font->attr.width) #define FONT_HEIGHT(txt) ((txt)->font->attr.height) -#define SCREEN_WIDTH(txt) uterm_screen_width((txt)->screen) -#define SCREEN_HEIGHT(txt) uterm_screen_height((txt)->screen) - static int bbulk_init(struct kmscon_text *txt) { struct bbulk *bb; @@ -76,11 +73,15 @@ static int bbulk_set(struct kmscon_text *txt) struct bbulk *bb = txt->data; unsigned int sw, sh, i, j; struct uterm_video_blend_req *req; + struct uterm_mode *mode; memset(bb, 0, sizeof(*bb)); - sw = SCREEN_WIDTH(txt); - sh = SCREEN_HEIGHT(txt); + mode = uterm_display_get_current(txt->disp); + if (!mode) + return -EINVAL; + sw = uterm_mode_get_width(mode); + sh = uterm_mode_get_height(mode); txt->cols = sw / FONT_WIDTH(txt); txt->rows = sh / FONT_HEIGHT(txt); @@ -111,6 +112,7 @@ static void bbulk_unset(struct kmscon_text *txt) static int bbulk_draw(struct kmscon_text *txt, uint32_t id, const uint32_t *ch, size_t len, + unsigned int width, unsigned int posx, unsigned int posy, const struct tsm_screen_attr *attr) { @@ -120,6 +122,11 @@ static int bbulk_draw(struct kmscon_text *txt, struct uterm_video_blend_req *req; struct kmscon_font *font; + if (!width) { + bb->reqs[posy * txt->cols + posx].buf = NULL; + return 0; + } + if (attr->bold) font = txt->bold_font; else @@ -162,12 +169,13 @@ static int bbulk_render(struct kmscon_text *txt) { struct bbulk *bb = txt->data; - return uterm_screen_blendv(txt->screen, bb->reqs, - txt->cols * txt->rows); + return uterm_display_fake_blendv(txt->disp, bb->reqs, + txt->cols * txt->rows); } -static const struct kmscon_text_ops kmscon_text_bbulk_ops = { +struct kmscon_text_ops kmscon_text_bbulk_ops = { .name = "bbulk", + .owner = NULL, .init = bbulk_init, .destroy = bbulk_destroy, .set = bbulk_set, @@ -177,21 +185,3 @@ static const struct kmscon_text_ops kmscon_text_bbulk_ops = { .render = bbulk_render, .abort = NULL, }; - -int kmscon_text_bbulk_load(void) -{ - int ret; - - ret = kmscon_text_register(&kmscon_text_bbulk_ops); - if (ret) { - log_error("cannot register bbulk renderer"); - return ret; - } - - return 0; -} - -void kmscon_text_bbulk_unload(void) -{ - kmscon_text_unregister(kmscon_text_bbulk_ops.name); -}