delete some un-used files master
authoryu.dongliang <18588496441@163.com>
Sun, 3 May 2026 09:27:05 +0000 (17:27 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 3 May 2026 09:27:05 +0000 (17:27 +0800)
html/abc_html_util.c [deleted file]
ui/abc_render_bg_color.c [deleted file]
ui/abc_render_bg_image.c [deleted file]
ui/abc_render_meta.c [deleted file]
ui/abc_render_tr.c [deleted file]

diff --git a/html/abc_html_util.c b/html/abc_html_util.c
deleted file mode 100644 (file)
index 011c377..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#include"abc_html.h"
-
-abc_char_t* __html_pop_char(abc_html_t* html)
-{
-       assert(html);
-
-       abc_char_t* c;
-
-       if (html->tmp_list) {
-               c              = html->tmp_list;
-               html->tmp_list = c->next;
-               return c;
-       }
-
-       c = malloc(sizeof(abc_char_t));
-       if (!c)
-               return NULL;
-
-       int ret = html->io.popc(html);
-       if (EOF == ret) {
-               c->c = ret;
-               return c;
-       }
-
-       if (ret < 0x80) {
-               c->c   = ret;
-               c->len = 1;
-               c->utf8[0] = ret;
-               return c;
-       }
-
-       if (0x6 == (ret >> 5)) {
-               c->c   = ret & 0x1f;
-               c->len = 2;
-
-       } else if (0xe == (ret >> 4)) {
-               c->c   = ret & 0xf;
-               c->len = 3;
-
-       } else if (0x1e == (ret >> 3)) {
-               c->c   = ret & 0x7;
-               c->len = 4;
-
-       } else if (0x3e == (ret >> 2)) {
-               c->c   = ret & 0x3;
-               c->len = 5;
-
-       } else if (0x7e == (ret >> 1)) {
-               c->c   = ret & 0x1;
-               c->len = 6;
-       } else {
-               scf_loge("utf8 first byte wrong %#x, file: %s, line: %d\n", ret, html->file->data, html->n_lines);
-               free(c);
-               return NULL;
-       }
-
-       c->utf8[0] = ret;
-
-       int i;
-       for (i = 1; i < c->len; i++) {
-
-               ret = html->io.popc(html);
-
-               if (0x2  == (ret >> 6)) {
-                       c->c <<= 6;
-                       c->c  |= ret & 0x3f;
-
-                       c->utf8[i] = ret;
-               } else {
-                       scf_loge("utf8 byte[%d] wrong %#x, file: %s, line: %d\n", i + 1, ret, html->file->data, html->n_lines);
-                       free(c);
-                       return NULL;
-               }
-       }
-
-       return c;
-}
-
-void __html_push_char(abc_html_t* html, abc_char_t* c)
-{
-       assert(html);
-       assert(c);
-
-       c->next        = html->tmp_list;
-       html->tmp_list = c;
-}
diff --git a/ui/abc_render_bg_color.c b/ui/abc_render_bg_color.c
deleted file mode 100644 (file)
index e7ae029..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#include"abc.h"
-
-static const char* vert_shader =
-       "#version 330 core\n"
-       "layout(location = 0) in vec4 position; \n"
-       "layout(location = 1) in vec2 a_texCoord; \n"
-       "out vec2 v_texCoord; \n"
-       "uniform mat4 mvp; \n"
-       "void main() { \n"
-               "gl_Position = mvp * position; \n"
-               "v_texCoord  = a_texCoord; \n"
-       "} \n";
-
-static const char* frag_shader =
-       "#version 330 core\n"
-       "in  vec2 v_texCoord; \n"
-       "out vec4 outputColor; \n"
-       "uniform vec4 bgColor; \n"
-       "void main() { \n"
-       "    vec2 xy = v_texCoord; \n"
-       "    outputColor = bgColor; \n"
-       "} \n";
-
-
-static GLuint program = 0;
-
-static GLuint vao = 0;
-static GLuint buffers[2] = {0};
-
-static GLuint uniform_mvp;
-static GLuint uniform_bgColor;
-
-
-static int _render_fini_bg_color(abc_render_t* render)
-{
-       return 0;
-}
-
-static int _render_draw_bg_color(abc_render_t* render, abc_obj_t* obj, int width, int height)
-{
-       if (0 == program)
-               __init_program(&program, vert_shader, frag_shader);
-
-       if (0 == vao)
-               __init_buffers(&vao, buffers);
-
-       double r = 0.0;
-       double g = 0.0;
-       double b = 0.0;
-
-       abc_obj_t* attr = abc_obj_find_attr(obj, ABC_HTML_ATTR_BG_COLOR);
-       if (attr)
-               abc_css_color(&r, &g, &b, attr->value->data);
-
-       float mvp[16];
-       __compute_mvp(mvp, 0, 0, 0);
-
-       scf_logd("%s, x: %d, y: %d, w: %d, h: %d\n", obj->text->data, obj->x, obj->y, obj->w, obj->h);
-
-       GLfloat vert_update[] =
-       {
-                2.0 *  obj->x           / (float)width  - 1.0,
-               -2.0 * (obj->y + obj->h) / (float)height + 1.0,
-
-                2.0 * (obj->x + obj->w) / (float)width  - 1.0,
-               -2.0 * (obj->y + obj->h) / (float)height + 1.0,
-
-                2.0 *  obj->x           / (float)width  - 1.0,
-               -2.0 *  obj->y           / (float)height + 1.0,
-
-                2.0 * (obj->x + obj->w) / (float)width  - 1.0,
-               -2.0 *  obj->y           / (float)height + 1.0,
-       };
-
-       glUseProgram(program);
-       uniform_bgColor = glGetUniformLocation(program, "bgColor");
-       uniform_mvp     = glGetUniformLocation(program, "mvp");
-
-       glUniformMatrix4fv(uniform_mvp,     1, GL_FALSE, mvp);
-       glUniform4f       (uniform_bgColor, r, g, b, 1.0);
-
-       // draw
-       glBindBuffer   (GL_ARRAY_BUFFER, buffers[0]);
-       glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vert_update), vert_update);
-
-       glBindVertexArray(vao);
-
-       glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
-       glBindVertexArray(0);
-       glUseProgram(0);
-       return 0;
-}
-
-abc_render_t  abc_render_bg_color =
-{
-       .type = ABC_HTML_ATTR_BG_COLOR,
-
-       .draw = _render_draw_bg_color,
-       .fini = _render_fini_bg_color,
-};
diff --git a/ui/abc_render_bg_image.c b/ui/abc_render_bg_image.c
deleted file mode 100644 (file)
index 935319c..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-#include"abc.h"
-
-static const char* vert_shader =
-       "#version 330 core\n"
-       "layout(location = 0) in vec4 position; \n"
-       "layout(location = 1) in vec2 a_texCoord; \n"
-       "out vec2 v_texCoord; \n"
-       "uniform mat4 mvp; \n"
-       "void main() { \n"
-               "gl_Position = mvp * position; \n"
-               "v_texCoord  = a_texCoord; \n"
-       "} \n";
-
-static const char* frag_shader =
-       "#version 330 core\n"
-       "in  vec2 v_texCoord; \n"
-       "out vec4 outputColor; \n"
-       "uniform vec4 bgColor; \n"
-       "uniform vec4 rect; \n"
-       "uniform int repeat_x; \n"
-       "uniform int repeat_y; \n"
-       "uniform int index_x; \n"
-       "uniform int index_y; \n"
-       "uniform sampler2D tex_rgba; \n"
-       "void main() { \n"
-       "    vec2 xy = v_texCoord; \n"
-       "    float i = floor((xy.x - rect.x) / rect.z); \n"
-       "    float j = floor((xy.y - rect.y) / rect.w); \n"
-       "    if ((repeat_x > 0 || int(round(i)) == index_x) && (repeat_y > 0 || int(round(j)) == index_y)) { \n"
-       "        float x = rect.x + i * rect.z; \n"
-       "        float y = rect.y + j * rect.w; \n"
-       "        xy.x = (xy.x - x) / rect.z; \n"
-       "        xy.y = (xy.y - y) / rect.w; \n"
-       "        vec4 v = texture2D(tex_rgba, xy).rgba; \n"
-       "        outputColor = vec4(v.b, v.g, v.r, 1.0); \n"
-       "    } else { \n"
-       "        outputColor = bgColor; \n"
-       "    } \n"
-       "} \n";
-
-
-static GLuint program = 0;
-
-static GLuint vao = 0;
-static GLuint buffers[2]   = {0};
-static GLuint texture_rgba = 0;
-
-static GLuint uniform_mvp;
-static GLuint uniform_rgba;
-static GLuint uniform_rect;
-static GLuint uniform_color;
-static GLuint uniform_repeat_x;
-static GLuint uniform_repeat_y;
-static GLuint uniform_index_x;
-static GLuint uniform_index_y;
-
-static int _render_fini_bg_image(abc_render_t* render)
-{
-       return 0;
-}
-
-static int _render_draw_bg_image(abc_render_t* render, abc_obj_t* obj, int width, int height)
-{
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_IMAGE);
-       if (!attr)
-               return 0;
-       if (!attr->value || attr->value->len <= 0)
-               return 0;
-
-       scf_string_t* spath = NULL;
-       abc_io_t*     io    = NULL;
-       abc_img_t*    img   = NULL;
-
-       int ret = __io_url_css(&io, &spath, obj->file->data, attr->value->data);
-       if (ret < 0)
-               return ret;
-
-       scf_logd("background-image: %s\n", spath->data);
-
-       ret = abc_img_open(&img, spath->data);
-
-       scf_string_free(spath);
-       spath = NULL;
-       if (ret < 0)
-               return ret;
-
-       uint8_t* bgra = calloc(1, img->width * img->height * 4);
-       if (!bgra) {
-               abc_img_close(img);
-               return -ENOMEM;
-       }
-
-       ret = abc_img_read(img, bgra, img->width * img->height * 4);
-       if (ret < 0) {
-               abc_img_close(img);
-               free(bgra);
-               return ret;
-       }
-
-       double r = 0.0;
-       double g = 0.0;
-       double b = 0.0;
-       attr = abc_obj_find_attr(obj, ABC_HTML_ATTR_BG_COLOR);
-       if (attr)
-               abc_css_color(&r, &g, &b, attr->value->data);
-
-       if (0 == program)
-               __init_program(&program, vert_shader, frag_shader);
-
-       if (0 == vao)
-               __init_buffers(&vao, buffers);
-
-       if (0 == texture_rgba)
-               __init_texture(&texture_rgba, GL_RGBA, img->width, img->height, NULL);
-
-       float mvp[16];
-       __compute_mvp(mvp, 0, 0, 0);
-
-       scf_logd("%s, x: %d, y: %d, w: %d, h: %d\n", obj->text->data, obj->x, obj->y, obj->w, obj->h);
-
-       GLfloat vert_update[] =
-       {
-                2.0 *  obj->x           / (float)width  - 1.0,
-               -2.0 * (obj->y + obj->h) / (float)height + 1.0,
-
-                2.0 * (obj->x + obj->w) / (float)width  - 1.0,
-               -2.0 * (obj->y + obj->h) / (float)height + 1.0,
-
-                2.0 *  obj->x           / (float)width  - 1.0,
-               -2.0 *  obj->y           / (float)height + 1.0,
-
-                2.0 * (obj->x + obj->w) / (float)width  - 1.0,
-               -2.0 *  obj->y           / (float)height + 1.0,
-       };
-
-       GLfloat x = 0.0;
-       GLfloat y = 0.0;
-       GLfloat w = img->width  / (float)obj->w;
-       GLfloat h = img->height / (float)obj->h;
-
-       if (w > 1.0 || h > 1.0)
-       {
-               GLfloat max = w > h ? w : h;
-
-               w /= max;
-               h /= max;
-       }
-
-       GLint repeat_x = 1;
-       GLint repeat_y = 1;
-       GLint index_x  = 0;
-       GLint index_y  = 0;
-
-       attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_POSITION);
-       if (attr) {
-               abc_css_position(&x, &y, w, h, obj, attr->value->data);
-
-               scf_logd("background-position: %s, x: %f, y: %f, w: %f, h: %f\n", attr->value->data, x, y, w, h);
-
-               if (x + w > 1.0)
-                       index_x = -1;
-
-               if (y + h > 1.0)
-                       index_y = -1;
-       }
-
-       attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_REPEAT);
-       if (attr) {
-               if (!__html_strcmp(attr->value->data, "repeat-x"))
-                       repeat_y = 0;
-
-               else if (!__html_strcmp(attr->value->data, "repeat-y"))
-                       repeat_x = 0;
-
-               else if (!__html_strcmp(attr->value->data, "no-repeat")) {
-                       repeat_x = 0;
-                       repeat_y = 0;
-               }
-       }
-
-       scf_logd("repeat_x: %d, repeat_y: %d, index_x: %d, index_y: %d\n", repeat_x, repeat_y, index_x, index_y);
-
-       glUseProgram(program);
-
-       uniform_mvp      = glGetUniformLocation(program, "mvp");
-       uniform_rgba     = glGetUniformLocation(program, "tex_rgba");
-       uniform_rect     = glGetUniformLocation(program, "rect");
-       uniform_color    = glGetUniformLocation(program, "bgColor");
-       uniform_repeat_x = glGetUniformLocation(program, "repeat_x");
-       uniform_repeat_y = glGetUniformLocation(program, "repeat_y");
-       uniform_index_x  = glGetUniformLocation(program, "index_x");
-       uniform_index_y  = glGetUniformLocation(program, "index_y");
-
-       glUniformMatrix4fv(uniform_mvp, 1, GL_FALSE, mvp);
-
-       glActiveTexture(GL_TEXTURE0);
-       glBindTexture  (GL_TEXTURE_2D, texture_rgba);
-       glTexImage2D   (GL_TEXTURE_2D, 0, GL_RGBA, img->width, img->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bgra);
-       glUniform1i(uniform_rgba,  0);
-
-       glUniform4f(uniform_rect,  x, y, w, h);
-       glUniform4f(uniform_color, r, g, b, 1.0);
-
-       glUniform1i(uniform_repeat_x, repeat_x);
-       glUniform1i(uniform_repeat_y, repeat_y);
-       glUniform1i(uniform_index_x,  index_x);
-       glUniform1i(uniform_index_y,  index_y);
-
-       // draw
-       glBindBuffer   (GL_ARRAY_BUFFER, buffers[0]);
-       glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vert_update), vert_update);
-
-       glBindVertexArray(vao);
-
-       glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
-       glBindVertexArray(0);
-       glUseProgram(0);
-
-       abc_img_close(img);
-       free(bgra);
-       return 0;
-}
-
-abc_render_t  abc_render_bg_image =
-{
-       .type = ABC_HTML_ATTR_BG_IMAGE,
-
-       .draw = _render_draw_bg_image,
-       .fini = _render_fini_bg_image,
-};
diff --git a/ui/abc_render_meta.c b/ui/abc_render_meta.c
deleted file mode 100644 (file)
index d6b22cf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include"abc.h"
-
-static int _render_fini_meta(abc_render_t* render)
-{
-       return 0;
-}
-
-static int _render_draw_meta(abc_render_t* render, abc_obj_t* obj, int width, int height)
-{
-       return 0;
-}
-
-abc_render_t  abc_render_meta =
-{
-       .type = ABC_HTML_META,
-
-       .draw = _render_draw_meta,
-       .fini = _render_fini_meta,
-};
diff --git a/ui/abc_render_tr.c b/ui/abc_render_tr.c
deleted file mode 100644 (file)
index 9428ccc..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include"abc.h"
-
-static int _render_fini_tr(abc_render_t* render)
-{
-       return 0;
-}
-
-static int _render_draw_tr(abc_render_t* render, abc_obj_t* obj, int width, int height)
-{
-       return 0;
-}
-
-abc_render_t  abc_render_tr =
-{
-       .type = ABC_HTML_TR,
-
-       .draw = _render_draw_tr,
-       .fini = _render_fini_tr,
-};