From: Hugo E. <hu...@sh...> - 2023-07-04 22:40:26
|
I have just started trying to use AGG on a microcontroller with 264kB memory. My image buffer is 240x240x3 = 172kB, and if I allow for memory for other stuff, I reckon there's about 50kB of memory free for AGG to use. However, when I try to run the simple star example, which draws a 5-pointed star, I get an out-of-memory error. Adding some print statements to the pod_allocator, I can see that a surprisingly large amount of memory is being allocated for this simple task: pod_allocator 512 bytes pod_allocator 1536 bytes pod_allocator 512 bytes pod_allocator 1024 bytes pod_allocator 2048 bytes pod_allocator 65536 bytes pod_allocator 3384 bytes pod_allocator 944 bytes pod_allocator 1664 bytes pod_allocator 104 bytes pod_allocator 512 bytes pod_allocator 1536 bytes pod_allocator 512 bytes pod_allocator 1024 bytes pod_allocator 9904 bytes At one point it allocates 64kB! Just to draw a 5-pointed star. Is this to be expected, or am I doing something wrong? Is there some way to make it use less memory? double star[] = {50, 3, 20, 101, 95, 35, 5, 39, 80, 92, 50, 3}; SimplePath path(star, sizeof(star) / sizeof(double)); agg::conv_stroke<SimplePath> strokePath(path); double strokeWidth = 2.0; strokePath.width(strokeWidth); strokePath.line_cap(agg::square_cap); strokePath.line_join(agg::miter_join); strokePath.miter_limit(strokeWidth); ras.reset(); ras.add_path(strokePath); agg::render_scanlines_aa_solid(ras, scanline, rBase, redColor); Many thanks Hugo -- |