Mercurial > MadButterfly
changeset 409:1e9b615a47e8
merge
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 07 Jul 2009 22:54:21 +0800 |
parents | 7f7855df2af0 (diff) 903283e72c5d (current diff) |
children | 1a923ea699c1 |
files | |
diffstat | 6 files changed, 46 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Wed Jun 17 13:23:21 2009 +0800 +++ b/configure.ac Tue Jul 07 22:54:21 2009 +0800 @@ -14,7 +14,7 @@ # Checks for libraries. PKG_CHECK_MODULES([cairo], [cairo >= 1.6], , AC_MSG_ERROR([cairo >= 1.6 not found])) -PKG_CHECK_MODULES([pangocairo], [pangocairo >= 1.22], , AC_MSG_ERROR([pangocairo >= 1.22 not found])) +PKG_CHECK_MODULES([pangocairo], [pangocairo >= 1.0], , AC_MSG_ERROR([pangocairo >= 1.0 not found])) # Checks for header files. AC_PATH_X @@ -35,6 +35,10 @@ AC_FUNC_SELECT_ARGTYPES AC_CHECK_FUNCS([gettimeofday memset select sqrt strdup]) +AC_ARG_ENABLE([testcase],[enable testcase for unittest], + [AC_SUBST([TESTCASE],[testcase])], + [AC_SUBST([TESTCASE],)]) + AC_CONFIG_FILES([Makefile libmbfly.pc libmbfly-uninstalled.pc
--- a/include/mb_paint.h Wed Jun 17 13:23:21 2009 +0800 +++ b/include/mb_paint.h Tue Jul 07 22:54:21 2009 +0800 @@ -4,6 +4,7 @@ #include <cairo.h> #include "mb_types.h" #include "mb_redraw_man.h" +#include "mb_img_ldr.h" #include "mb_tools.h" typedef float co_comp_t;
--- a/src/Makefile.am Wed Jun 17 13:23:21 2009 +0800 +++ b/src/Makefile.am Tue Jul 07 22:54:21 2009 +0800 @@ -2,7 +2,8 @@ lib_LTLIBRARIES = libmbfly.la -noinst_PROGRAMS = X_main +noinst_PROGRAMS = X_main $(TESTCASE) + MBAF_SOURCES=mbaf/mbapp.c mbaf/mbbutton.c mbaf/mbobject.c mbaf/animated_menu.c libmbfly_la_SOURCES = animate.c chgcolor.c coord.c event.c geo.c \ observer.c paint.c redraw_man.c rotate.c shape_path.c \ @@ -15,5 +16,13 @@ X_main_SOURCES = X_main.c X_main_LDADD = $(top_builddir)/src/libmbfly.la -X_main_CPPFLAGS = @pangocairo_CFLAGS@ -I$(top_builddir)/src +X_main_CPPFLAGS = @pangocairo_CFLAGS@ -I$(top_builddir)/include X_main_LDFLAGS = @pangocairo_LIBS@ + +testcase_SOURCES = testcase.c $(libmbfly_la_SOURCES) +testcase_CFLAGS = -I$(top_builddir)/include \ + -DUNITTEST -g @cairo_CFLAGS@ \ + @pangocairo_CFLAGS@ +testcase_LDFLAGS = -lcunit -L/usr/local/lib/ @pangocairo_LIBS@ + +EXTRA_PROGRAMS = testcase
--- a/src/event.c Wed Jun 17 13:23:21 2009 +0800 +++ b/src/event.c Tue Jul 07 22:54:21 2009 +0800 @@ -116,7 +116,7 @@ (w) += (s) - (a); \ (s) = (a); \ } else { \ - (w) = MAX(w, (a) - (s) + 1); \ + (w) = MB_MAX(w, (a) - (s) + 1); \ } \ } while(0) @@ -155,7 +155,8 @@ MBO_SHAPES=0x1000, MBO_PATH, MBO_TEXT, - MBO_RECT + MBO_RECT, + MBO_IMAGE }; #define MBO_TYPE(x) (((mb_obj_t *)(x))->obj_type) #define IS_MBO_SHAPES(x) (((mb_obj_t *)(x))->obj_type & MBO_SHAPES)
--- a/src/redraw_man.c Wed Jun 17 13:23:21 2009 +0800 +++ b/src/redraw_man.c Tue Jul 07 22:54:21 2009 +0800 @@ -10,6 +10,9 @@ #include "mb_observer.h" #include "mb_prop.h" +/* required by rdman_img_ldr_load_paint() */ +#include "mb_paint.h" + /*! \page dirty Dirty geo, coord, and area. * * \section dirty_of_ego Dirty of geo @@ -1885,6 +1888,10 @@ cairo_set_operator(rdman->backend, saved_op); } #else /* UNITTEST */ +static void make_clip(cairo_t *cr, int n_dirty_areas, + area_t **dirty_areas) { +} + static void clear_canvas(canvas_t *canvas) { } @@ -2293,7 +2300,6 @@ /* Test cases */ #include <CUnit/Basic.h> -#include "mb_paint.h" struct _sh_dummy { shape_t shape; @@ -2376,7 +2382,7 @@ if(paint == NULL) return NULL; - paint_init(paint, dummy_paint_prepare, dummy_paint_free); + paint_init(paint, MBP_DUMMY, dummy_paint_prepare, dummy_paint_free); return paint; }
--- a/src/shape_stext.c Wed Jun 17 13:23:21 2009 +0800 +++ b/src/shape_stext.c Tue Jul 07 22:54:21 2009 +0800 @@ -12,6 +12,14 @@ #define OK 0 #define ERR -1 +/*! \page stext Simple Text + * + * A sh_stext_t is broken into fragments. Each fragment comprises the text + * and the styles applied on the fragement. The styles determines font face + * used to show the text. The fragment of text with styles is called + * styled block. + */ + /*! \defgroup fontconfig_freetype Fontconfig and FreeType Layer. * * This layer implements a font provider to reset of the system. @@ -31,6 +39,15 @@ * * Although, mb_text_extents_t is defined as a cairo_scaled_font_t, but * programmers should assume it is opague. + * + * An extents is the span of showing a fragement of text on the output device. + * It includes x and y advance of cursor after showinng the text. + * The cursor maybe not really existed. But, the advance is computed as + * the cursor existed. It also includes width and height of the text. + * The bearing of a styled block is the left-top corner of the bounding box. + * The bounding box of a styled block is the minimal rectangle, on the + * output device, that can contain the text. The bearing is related to + * the base line for an extents. */ typedef cairo_text_extents_t mb_text_extents_t; @@ -314,7 +331,7 @@ */ static void extent_extents(mb_text_extents_t *full, mb_text_extents_t *sub) { - co_aix f_rbx, f_rby; + co_aix f_rbx, f_rby; /* rb stands for right button */ co_aix s_rbx, s_rby; f_rbx = MBE_GET_X_BEARING(full) + MBE_GET_WIDTH(full);