From c5cda046a3d03dac394734473dfad114be35c502 Mon Sep 17 00:00:00 2001 From: Kacper Kasper Date: Thu, 24 Apr 2014 20:00:29 +0000 Subject: Haiku support diff --git a/configure.in b/configure.in index fceca82..d06dc7f 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_ISC_POSIX -AM_C_PROTOTYPES + if test "x$U" != "x"; then AC_MSG_ERROR(Compiler not ANSI compliant) fi @@ -58,9 +58,18 @@ dnl #### Check if we are compiling for win32 ##### AC_SUBST(WINDOWS_LIBS) PREFERED_PLATFORM=win32 ;; + *haiku*) + haiku_host=yes + HAIKU_LIBS="-lbe -ltranslation" + HAIKU_CFLAGS= + AC_SUBST(HAIKU_CFLAGS) + AC_SUBST(HAIKU_LIBS) + PREFERED_PLATFORM=Haiku + ;; esac AM_CONDITIONAL(ENABLE_WIN32,[test x$win32_host = xyes -a x$enable_platform != xno ]) AM_CONDITIONAL(ENABLE_OSX,[test x$osx_host = xyes -a x$enable_platform != xno ]) +AM_CONDITIONAL(ENABLE_HAIKU,[test x$haiku_host = xyes -a x$enable_platform != xno ]) dnl then enable font_win32tt AC_ARG_ENABLE(win32tt, AC_HELP_STRING([--enable-win32tt],[Win32 TrueType font support library]), @@ -154,7 +163,7 @@ AC_OUTPUT( src/platform/sdl/Makefile src/platform/mac/Makefile src/platform/win32/Makefile - src/platform/BeOS/Makefile + src/platform/Haiku/Makefile src/platform/AmigaOS/Makefile include/Makefile include/ctrl/Makefile diff --git a/src/platform/BeOS/Makefile.am b/src/platform/BeOS/Makefile.am index 474153c..2095717 100644 --- a/src/platform/BeOS/Makefile.am +++ b/src/platform/BeOS/Makefile.am @@ -1 +1,10 @@ -EXTRA_DIST=agg_platform_support.cpp +if ENABLE_HAIKU + +lib_LTLIBRARIES = libaggplatformHaiku.la + +libaggplatformHaiku_la_LDFLAGS = -version-info @AGG_LIB_VERSION@ +libaggplatformHaiku_la_SOURCES = agg_platform_support.cpp +libaggplatformHaiku_la_CXXFLAGS = -I$(top_srcdir)/include @HAIKU_CFLAGS@ +libaggplatformHaiku_la_LIBADD = @HAIKU_LIBS@ +endif + diff --git a/src/platform/Makefile.am b/src/platform/Makefile.am index ebe5e7e..c6622bc 100644 --- a/src/platform/Makefile.am +++ b/src/platform/Makefile.am @@ -1 +1 @@ -SUBDIRS = X11 sdl win32 AmigaOS BeOS mac +SUBDIRS = X11 sdl win32 AmigaOS Haiku mac -- 2.21.0 From 8c170e5f049f679281f2bffbe9641ce3589cfaf0 Mon Sep 17 00:00:00 2001 From: Kacper Kasper Date: Fri, 25 Apr 2014 12:52:34 +0000 Subject: fix unsigned integer overflows diff --git a/include/agg_array.h b/include/agg_array.h index 5c6d390..c25947a 100644 --- a/include/agg_array.h +++ b/include/agg_array.h @@ -366,9 +366,10 @@ namespace agg void add_array(const T* ptr, unsigned num_elem) { - while(num_elem--) + while(num_elem > 0) { add(*ptr++); + --num_elem; } } @@ -526,10 +527,11 @@ namespace agg if(m_num_blocks) { T** blk = m_blocks + m_num_blocks - 1; - while(m_num_blocks--) + while(m_num_blocks > 0) { pod_allocator::deallocate(*blk, block_size); --blk; + --m_num_blocks; } } pod_allocator::deallocate(m_blocks, m_max_blocks); @@ -802,10 +804,11 @@ namespace agg if(m_num_blocks) { block_type* blk = m_blocks + m_num_blocks - 1; - while(m_num_blocks--) + while(m_num_blocks > 0) { pod_allocator::deallocate(blk->data, blk->size); --blk; + --m_num_blocks; } pod_allocator::deallocate(m_blocks, m_max_blocks); } diff --git a/include/agg_pixfmt_rgba.h b/include/agg_pixfmt_rgba.h index 79d10dc..73937d0 100644 --- a/include/agg_pixfmt_rgba.h +++ b/include/agg_pixfmt_rgba.h @@ -703,9 +703,9 @@ namespace agg } if(sa) { - calc_type dr = p[Order::R] - sr; - calc_type dg = p[Order::G] - sg; - calc_type db = p[Order::B] - sb; + calc_type dr = (sr > p[Order::R]) ? 0 : p[Order::R] - sr; + calc_type dg = (sg > p[Order::G]) ? 0 : p[Order::G] - sg; + calc_type db = (sb > p[Order::B]) ? 0 : p[Order::B] - sb; p[Order::R] = (dr > base_mask) ? 0 : dr; p[Order::G] = (dg > base_mask) ? 0 : dg; p[Order::B] = (db > base_mask) ? 0 : db; diff --git a/include/agg_rasterizer_cells_aa.h b/include/agg_rasterizer_cells_aa.h index d3bb138..6aa3852 100644 --- a/include/agg_rasterizer_cells_aa.h +++ b/include/agg_rasterizer_cells_aa.h @@ -140,10 +140,11 @@ namespace agg if(m_num_blocks) { cell_type** ptr = m_cells + m_num_blocks - 1; - while(m_num_blocks--) + while(m_num_blocks > 0) { pod_allocator::deallocate(*ptr, cell_block_size); ptr--; + --m_num_blocks; } pod_allocator::deallocate(m_cells, m_max_blocks); } @@ -666,23 +667,26 @@ namespace agg cell_type* cell_ptr; unsigned nb = m_num_cells >> cell_block_shift; unsigned i; - while(nb--) + while(nb > 0) { cell_ptr = *block_ptr++; i = cell_block_size; - while(i--) + while(i > 0) { m_sorted_y[cell_ptr->y - m_min_y].start++; ++cell_ptr; + --i; } + --nb; } cell_ptr = *block_ptr++; i = m_num_cells & cell_block_mask; - while(i--) + while(i > 0) { m_sorted_y[cell_ptr->y - m_min_y].start++; ++cell_ptr; + --i; } // Convert the Y-histogram into the array of starting indexes @@ -697,27 +701,30 @@ namespace agg // Fill the cell pointer array sorted by Y block_ptr = m_cells; nb = m_num_cells >> cell_block_shift; - while(nb--) + while(nb > 0) { cell_ptr = *block_ptr++; i = cell_block_size; - while(i--) + while(i > 0) { sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y]; m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr; ++curr_y.num; ++cell_ptr; + --i; } + --nb; } cell_ptr = *block_ptr++; i = m_num_cells & cell_block_mask; - while(i--) + while(i > 0) { sorted_y& curr_y = m_sorted_y[cell_ptr->y - m_min_y]; m_sorted_cells[curr_y.start + curr_y.num] = cell_ptr; ++curr_y.num; ++cell_ptr; + --i; } // Finally arrange the X-arrays diff --git a/include/agg_rendering_buffer.h b/include/agg_rendering_buffer.h index 3a39caa..1fddb4e 100644 --- a/include/agg_rendering_buffer.h +++ b/include/agg_rendering_buffer.h @@ -191,10 +191,11 @@ namespace agg T** rows = &m_rows[0]; - while(height--) + while(height > 0) { *rows++ = row_ptr; row_ptr += stride; + --height; } } -- 2.21.0 From 89c616262f6791889bfbe721da3a4218a25affd2 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Thu, 19 Dec 2013 01:45:04 +0100 Subject: Fix the agg headers to be proper C++. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Axel Dörfler diff --git a/include/agg_renderer_outline_aa.h b/include/agg_renderer_outline_aa.h index ce25a2e..fa3f747 100644 --- a/include/agg_renderer_outline_aa.h +++ b/include/agg_renderer_outline_aa.h @@ -1375,7 +1375,7 @@ namespace agg //--------------------------------------------------------------------- void profile(const line_profile_aa& prof) { m_profile = &prof; } const line_profile_aa& profile() const { return *m_profile; } - line_profile_aa& profile() { return *m_profile; } + line_profile_aa& profile() { return *(line_profile_aa*)m_profile; } //--------------------------------------------------------------------- int subpixel_width() const { return m_profile->subpixel_width(); } -- 2.21.0