From: KarthikRIyer <Kar...@ya...> - 2019-06-12 19:43:20
|
Hi, I want to initialize the buffer that I want to use inside a constructor. But doing that is giving me a segmentation fault as follows when run using gdb: Program received signal SIGSEGV, Segmentation fault. 0x0000555555588680 in agg::blender_rgb<agg::rgba8, agg::order_rgb>::blend_pix (p=0x264d4b42129b <error: Cannot access memory at address 0x264d4b42129b>, cr=0, cg=0, cb=0, alpha=34, cover=34) at /home/karthik/swiftplot/framework/AGG/include/agg_pixfmt_rgb.h:91 91 p[Order::R] += (value_type)(((cr - p[Order::R]) * alpha) >> base_shift); But everything works fine when I initialize it in the class directly. Here's the initializing part of the code: class Plot{ public: agg::rasterizer_scanline_aa<> m_ras; agg::scanline_p8 m_sl_p8; agg::line_cap_e roundCap = agg::round_cap; renderer_aa ren_aa; int pngBufferSize = 0; unsigned char* buffer; agg::int8u* m_pattern; agg::rendering_buffer m_pattern_rbuf; renderer_base_pre rb_pre; Plot(float width, float height, float subW, float subH){ frame_width = width; frame_height = height; sub_width = subW; sub_height = subH; buffer = new unsigned char[frame_width*frame_height*3]; agg::rendering_buffer rbuf = agg::rendering_buffer(buffer, frame_width, frame_height, -frame_width*3); pixfmt pixf = pixfmt(rbuf); renderer_base rb = renderer_base(pixf); ren_aa = renderer_aa(rb); pixfmt_pre pixf_pre(rbuf); rb_pre = renderer_base_pre(pixf_pre); } How can I solve this? I need to set the buffer size in the constructor so that the end user can choose he size of the image he/she wants. Thanks, Karthik -- Sent from: http://anti-grain-geometry.1086185.n5.nabble.com/ |