source: gaycko/trunk/src/render/renderer.c @ 4755

Last change on this file since 4755 was 4755, checked in by Jean-Yves Lamoureux, 10 years ago
  • Display rendering in caca window
File size: 1.1 KB
Line 
1/*
2 *  Gaycko        Text mode web browser
3 *  Copyright (c) 2011 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  This library is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12#include "renderer.h"
13
14void gaycko_render(gWindow *window) {
15        window->dom->root->properties->width = window->width;
16    gaycko_get_position(window->dom->root, NULL);
17    gaycko_print_dom(window);
18}
19
20
21void gaycko_print_dom(gWindow *window) {
22        gaycko_print_node(window->dom->root, window);
23}
24
25void gaycko_print_node(gNode *node, gWindow *window) {
26        int c = 0;
27   
28    if(node->type == ELEM_TEXT) {
29        caca_set_color_argb(window->cv, 0, 0xFFFF);
30        caca_printf(window->cv, node->properties->x, node->properties->y, node->text);
31    }
32       
33    for(c = 0; c < node->children_count; c++) {
34        gaycko_print_node(node->children[c], window);
35    }
36}
Note: See TracBrowser for help on using the repository browser.