author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年01月04日 11:47:11 +0100 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年01月04日 11:47:11 +0100 |
commit | 046c56f449db15b9c9aa113cb03adf695dd7b9b6 (patch) | |
tree | 0ae7650dcac74233784f50608b15fb54f2f52d0c /agg-plot | |
parent | 3c1ad26e933233f6a7031b0b56c5b19ffb5ebf96 (diff) | |
download | gsl-shell-046c56f449db15b9c9aa113cb03adf695dd7b9b6.tar.gz |
diff --git a/agg-plot/agg_platform_support_win32.cpp b/agg-plot/agg_platform_support_win32.cpp index 112e5435..def8d3c3 100644 --- a/agg-plot/agg_platform_support_win32.cpp +++ b/agg-plot/agg_platform_support_win32.cpp @@ -5,20 +5,20 @@ // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://antigrain.com -// +// // AGG is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // AGG is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with AGG; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, // MA 02110-1301, USA. //---------------------------------------------------------------------------- @@ -43,7 +43,7 @@ namespace agg int stride = pm.stride(); rbuf->attach(pm.buf(), pm.width(), pm.height(), flip_y ? stride : -stride); } - + //------------------------------------------------------------------------ HINSTANCE g_windows_instance = 0; int g_windows_cmd_show = 0; @@ -56,13 +56,13 @@ namespace agg platform_specific(pix_format_e format, bool flip_y); ~platform_specific(); - void create_pmap(unsigned width, unsigned height, + void create_pmap(unsigned width, unsigned height, rendering_buffer* wnd); void display_pmap(HDC dc, const rendering_buffer* src, const agg::rect_base<int> *rect = 0); - bool save_pmap(const char* fn, unsigned idx, + bool save_pmap(const char* fn, unsigned idx, const rendering_buffer* src); void close(); @@ -132,7 +132,7 @@ namespace agg //------------------------------------------------------------------------ - void platform_specific::create_pmap(unsigned width, + void platform_specific::create_pmap(unsigned width, unsigned height, rendering_buffer* wnd) { @@ -194,7 +194,7 @@ namespace agg //------------------------------------------------------------------------ - bool platform_specific::save_pmap(const char* fn, unsigned idx, + bool platform_specific::save_pmap(const char* fn, unsigned idx, const rendering_buffer* src) { pixel_map& img = m_pmap_img[idx]; @@ -259,8 +259,8 @@ namespace agg { LARGE_INTEGER stop; ::QueryPerformanceCounter(&stop); - return double(stop.QuadPart - - m_specific->m_sw_start.QuadPart) * 1000.0 / + return double(stop.QuadPart - + m_specific->m_sw_start.QuadPart) * 1000.0 / double(m_specific->m_sw_freq.QuadPart); } @@ -298,12 +298,12 @@ namespace agg app->m_specific->m_current_dc = dc; LRESULT ret = 0; - switch(msg) + switch(msg) { //-------------------------------------------------------------------- case WM_CREATE: break; - + //-------------------------------------------------------------------- case WM_SIZE: app->m_specific->create_pmap(LOWORD(lParam), HIWORD(lParam), @@ -315,11 +315,11 @@ namespace agg app->m_specific->m_is_ready = false; break; - + //-------------------------------------------------------------------- case WM_ERASEBKGND: break; - + //-------------------------------------------------------------------- case WM_PAINT: paintDC = ::BeginPaint(hWnd, &ps); @@ -337,16 +337,16 @@ namespace agg app->m_specific->m_is_mapped = true; app->m_specific->m_is_ready = true; break; - + //-------------------------------------------------------------------- case WM_COMMAND: break; - + //-------------------------------------------------------------------- case WM_DESTROY: ::PostQuitMessage(0); break; - + //-------------------------------------------------------------------- default: ret = ::DefWindowProc(hWnd, msg, wParam, lParam); @@ -424,7 +424,7 @@ namespace agg width + (width - (rct.right - rct.left)), height + (height - (rct.bottom - rct.top)), FALSE); - + ::SetWindowLong(m_specific->m_hwnd, GWL_USERDATA, (LONG)this); m_specific->create_pmap(width, height, &m_rbuf_window); m_initial_width = width; @@ -607,21 +607,21 @@ platform_support_ext::prepare() } } -void +void platform_support_ext::lock() -{ - pthread_mutex_lock (m_specific->m_mutex); +{ + pthread_mutex_lock (m_specific->m_mutex); } void platform_support_ext::unlock() -{ - pthread_mutex_unlock (m_specific->m_mutex); +{ + pthread_mutex_unlock (m_specific->m_mutex); } bool platform_support_ext::is_mapped() -{ +{ return m_specific->m_is_mapped; } diff --git a/agg-plot/agg_platform_support_x11.cpp b/agg-plot/agg_platform_support_x11.cpp index 65a7c601..a2c6b4e9 100644 --- a/agg-plot/agg_platform_support_x11.cpp +++ b/agg-plot/agg_platform_support_x11.cpp @@ -5,20 +5,20 @@ // Contact: mcseem@antigrain.com // mcseemagg@yahoo.com // http://antigrain.com -// +// // AGG is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // AGG is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with AGG; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, // MA 02110-1301, USA. //---------------------------------------------------------------------------- @@ -48,7 +48,7 @@ struct x_connection { x_connection() : display(0), m_busy(false) {}; ~x_connection() { this->close(); }; - + bool init(); void close(); @@ -66,7 +66,7 @@ bool x_connection::init() fprintf(stderr, "Unable to open DISPLAY!\n"); return false; } - + screen = XDefaultScreen(display); depth = XDefaultDepth (display, screen); visual = XDefaultVisual(display, screen); @@ -94,7 +94,7 @@ class buffer_image { XImage * m_img; public: - buffer_image(unsigned bpp, unsigned byte_order, + buffer_image(unsigned bpp, unsigned byte_order, unsigned width, unsigned height, x_connection *xc = 0); ~buffer_image() @@ -133,7 +133,7 @@ buffer_image::buffer_image(unsigned bpp, unsigned byte_order, if (xc) { - m_img = XCreateImage(xc->display, xc->visual, xc->depth, + m_img = XCreateImage(xc->display, xc->visual, xc->depth, ZPixmap, 0, (char*) m_buffer, m_width, m_height, m_bpp, row_size); m_img->byte_order = byte_order; @@ -170,7 +170,7 @@ namespace agg ~platform_specific(); void free_x_resources(); - + void caption(const char* capt); void put_image(const rendering_buffer* src, const rect *r = 0); @@ -195,7 +195,7 @@ namespace agg buffer_image * m_draw_img; unsigned char* m_buf_img[platform_support::max_images]; - + bool m_update_flag; bool m_resize_flag; bool m_initialized; @@ -223,7 +223,7 @@ namespace agg m_wm_protocols_atom(0), m_main_img(0), m_draw_img(0), - m_update_flag(true), + m_update_flag(true), m_resize_flag(true), m_initialized(false), m_is_mapped(false) @@ -289,7 +289,7 @@ namespace agg ev.xclient.window = m_window; ev.xclient.message_type = m_wm_protocols_atom; ev.xclient.format = 32; - ev.xclient.data.l[0] = m_close_atom; + ev.xclient.data.l[0] = m_close_atom; ev.xclient.data.l[1] = CurrentTime; ev.xclient.data.l[2] = 0l; ev.xclient.data.l[3] = 0l; @@ -307,7 +307,7 @@ namespace agg XSetIconName(d, m_window, capt); } - + //------------------------------------------------------------------------ void platform_specific::put_image(const rendering_buffer* src, const rect *ri) { @@ -331,7 +331,7 @@ namespace agg } else { - switch(m_sys_format) + switch(m_sys_format) { default: break; case pix_format_rgb555: @@ -348,7 +348,7 @@ namespace agg case pix_format_abgr32: my_color_conv(&rbuf_draw, &src_view, color_conv_abgr32_to_rgb555()); break; } break; - + case pix_format_rgb565: switch(m_format) { @@ -363,7 +363,7 @@ namespace agg case pix_format_abgr32: my_color_conv(&rbuf_draw, &src_view, color_conv_abgr32_to_rgb565()); break; } break; - + case pix_format_rgba32: switch(m_format) { @@ -378,7 +378,7 @@ namespace agg case pix_format_abgr32: my_color_conv(&rbuf_draw, &src_view, color_conv_abgr32_to_rgba32()); break; } break; - + case pix_format_abgr32: switch(m_format) { @@ -393,7 +393,7 @@ namespace agg case pix_format_bgra32: my_color_conv(&rbuf_draw, &src_view, color_conv_bgra32_to_abgr32()); break; } break; - + case pix_format_argb32: switch(m_format) { @@ -408,7 +408,7 @@ namespace agg case pix_format_bgra32: my_color_conv(&rbuf_draw, &src_view, color_conv_bgra32_to_argb32()); break; } break; - + case pix_format_bgra32: switch(m_format) { @@ -429,7 +429,7 @@ namespace agg Display *dsp = m_draw_conn.display; int x_dst = r.x1, y_dst = (m_flip_y ? src->height() - (r.y1 + h) : r.y1); - XPutImage(dsp, m_window, m_gc, m_draw_img->ximage(), + XPutImage(dsp, m_window, m_gc, m_draw_img->ximage(), 0, 0, x_dst, y_dst, w, h); } @@ -467,10 +467,10 @@ namespace agg } } - + //------------------------------------------------------------------------ enum xevent_mask_e - { + { xevent_mask = ExposureMask| StructureNotifyMask @@ -490,7 +490,7 @@ namespace agg m_specific->close_connections(); return false; } - + x_connection *xc = &m_specific->m_main_conn; x_connection *dc = &m_specific->m_draw_conn; @@ -506,11 +506,11 @@ namespace agg m_specific->close_connections(); return false; } - + int t = 1; int hw_byte_order = LSBFirst; if(*(char*)&t == 0) hw_byte_order = MSBFirst; - + // Perceive SYS-format by mask switch(xc->depth) { @@ -522,7 +522,7 @@ namespace agg m_specific->m_byte_order = hw_byte_order; } break; - + case 16: m_specific->m_sys_bpp = 16; if(r_mask == 0xF800 && g_mask == 0x7E0 && b_mask == 0x1F) @@ -531,7 +531,7 @@ namespace agg m_specific->m_byte_order = hw_byte_order; } break; - + case 24: case 32: m_specific->m_sys_bpp = 32; @@ -545,22 +545,22 @@ namespace agg m_specific->m_sys_format = pix_format_rgba32; m_specific->m_byte_order = LSBFirst; break; - + case pix_format_abgr32: m_specific->m_sys_format = pix_format_abgr32; m_specific->m_byte_order = MSBFirst; break; - default: + default: m_specific->m_byte_order = hw_byte_order; - m_specific->m_sys_format = + m_specific->m_sys_format = (hw_byte_order == LSBFirst) ? pix_format_rgba32 : pix_format_abgr32; break; } } - + if(r_mask == 0xFF0000 && b_mask == 0xFF) { switch(m_specific->m_format) @@ -569,15 +569,15 @@ namespace agg m_specific->m_sys_format = pix_format_argb32; m_specific->m_byte_order = MSBFirst; break; - + case pix_format_bgra32: m_specific->m_sys_format = pix_format_bgra32; m_specific->m_byte_order = LSBFirst; break; - default: + default: m_specific->m_byte_order = hw_byte_order; - m_specific->m_sys_format = + m_specific->m_sys_format = (hw_byte_order == MSBFirst) ? pix_format_argb32 : pix_format_bgra32; @@ -587,12 +587,12 @@ namespace agg } break; } - + if(m_specific->m_sys_format == pix_format_undefined) { fprintf(stderr, "RGB masks are not compatible with AGG pixel formats:\n" - "R=%08x, R=%08x, B=%08x\n", + "R=%08x, R=%08x, B=%08x\n", (unsigned)r_mask, (unsigned)g_mask, (unsigned)b_mask); m_specific->close_connections(); @@ -603,24 +603,24 @@ namespace agg gslshell::sys_bpp = m_specific->m_sys_bpp; XSetWindowAttributes *win_attr = &m_specific->m_window_attributes; - + memset(win_attr, 0, sizeof(XSetWindowAttributes)); - + win_attr->override_redirect = 0; unsigned long window_mask = 0; - m_specific->m_window = - XCreateWindow(xc->display, XDefaultRootWindow(xc->display), + m_specific->m_window = + XCreateWindow(xc->display, XDefaultRootWindow(xc->display), 0, 0, width, height, 0, xc->depth, InputOutput, CopyFromParent, window_mask, win_attr); m_specific->m_gc = XCreateGC(xc->display, m_specific->m_window, 0, 0); - m_specific->m_main_img = + m_specific->m_main_img = new(std::nothrow) buffer_image(m_specific->m_bpp, m_specific->m_byte_order, width, height); - m_specific->m_draw_img = + m_specific->m_draw_img = new(std::nothrow) buffer_image(m_specific->m_sys_bpp, m_specific->m_byte_order, width, height, dc); if (m_specific->m_main_img == 0 || m_specific->m_draw_img == 0) @@ -630,13 +630,13 @@ namespace agg m_specific->close_connections(); return false; } - + m_specific->m_main_img->attach(m_rbuf_window, m_flip_y); - - m_specific->caption(m_caption); + + m_specific->caption(m_caption); m_initial_width = width; m_initial_height = height; - + if(!m_specific->m_initialized) { on_init(); @@ -648,7 +648,7 @@ namespace agg m_specific->m_update_flag = true; XSizeHints *hints = XAllocSizeHints(); - if(hints) + if(hints) { if(flags & window_resize) { @@ -675,7 +675,7 @@ namespace agg XMapWindow(xc->display, m_specific->m_window); XSelectInput(xc->display, m_specific->m_window, xevent_mask); - + m_specific->m_close_atom = XInternAtom(xc->display, "WM_DELETE_WINDOW", false); m_specific->m_wm_protocols_atom = XInternAtom(xc->display, "WM_PROTOCOLS", true); @@ -694,9 +694,9 @@ namespace agg x_connection *xc = &m_specific->m_draw_conn; m_specific->put_image(&m_rbuf_window); - - // When m_wait_mode is true we can discard all the events - // came while the image is being drawn. In this case + + // When m_wait_mode is true we can discard all the events + // came while the image is being drawn. In this case // the X server does not accumulate mouse motion events. // When m_wait_mode is false, i.e. we have some idle drawing // we cannot afford to miss any events @@ -711,7 +711,7 @@ namespace agg x_connection *dc = &m_specific->m_draw_conn; XFlush(xc->display); - + bool quit = false; int ret = 0; @@ -742,9 +742,9 @@ namespace agg xc->busy(false); - switch(x_event.type) + switch(x_event.type) { - case MapNotify: + case MapNotify: { on_draw(); update_window(); @@ -753,7 +753,7 @@ namespace agg } break; - case ConfigureNotify: + case ConfigureNotify: { if(x_event.xconfigure.width != int(m_rbuf_window.width()) || x_event.xconfigure.height != int(m_rbuf_window.height())) @@ -775,7 +775,7 @@ namespace agg ret = 1; break; } - + ps->m_main_img->attach(m_rbuf_window, m_flip_y); trans_affine_resizing(width, height); @@ -800,13 +800,13 @@ namespace agg quit = true; } break; - } + } } unsigned i = platform_support::max_images; while(i--) { - if(ps->m_buf_img[i]) + if(ps->m_buf_img[i]) { delete [] ps->m_buf_img[i]; } @@ -841,7 +841,7 @@ namespace agg { strcat(buf, ".ppm"); } - + FILE* fd = fopen(buf, "rb"); if(fd == 0) return false; @@ -851,22 +851,22 @@ namespace agg return false; } buf[len] = 0; - + if(buf[0] != 'P' && buf[1] != '6') { fclose(fd); return false; } - + char* ptr = buf + 2; - + while(*ptr && !isdigit(*ptr)) ptr++; if(*ptr == 0) { fclose(fd); return false; } - + unsigned width = atoi(ptr); if(width == 0 || width > 4096) { @@ -901,10 +901,10 @@ namespace agg } ptr++; fseek(fd, long(ptr - buf), SEEK_SET); - + create_img(idx, width, height); bool ret = true; - + if(m_format == pix_format_rgb24) { fread(m_specific->m_buf_img[idx], 1, width * height * 3, fd); @@ -919,45 +919,45 @@ namespace agg m_flip_y ? -width * 3 : width * 3); - + fread(buf_img, 1, width * height * 3, fd); - + switch(m_format) { case pix_format_rgb555: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_rgb555()); break; - + case pix_format_rgb565: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_rgb565()); break; - + case pix_format_bgr24: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_bgr24()); break; - + case pix_format_rgba32: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_rgba32()); break; - + case pix_format_argb32: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_argb32()); break; - + case pix_format_bgra32: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_bgra32()); break; - + case pix_format_abgr32: color_conv(m_rbuf_img+idx, &rbuf_img, color_conv_rgb24_to_abgr32()); break; - + default: ret = false; } delete [] buf_img; } - + fclose(fd); return ret; } @@ -980,14 +980,14 @@ namespace agg if(width == 0) width = rbuf_window().width(); if(height == 0) height = rbuf_window().height(); delete [] m_specific->m_buf_img[idx]; - m_specific->m_buf_img[idx] = + m_specific->m_buf_img[idx] = new unsigned char[width * height * (m_bpp / 8)]; m_rbuf_img[idx].attach(m_specific->m_buf_img[idx], width, height, - m_flip_y ? - -width * (m_bpp / 8) : + m_flip_y ? + -width * (m_bpp / 8) : width * (m_bpp / 8)); return true; } @@ -1061,7 +1061,7 @@ platform_support_ext::prepare() { if (! agg::platform_specific::initialized) { - XInitThreads(); + XInitThreads(); #if defined(GSL_SHELL_DEBUG) XSetErrorHandler(my_x_error_handler); #endif @@ -1069,21 +1069,21 @@ platform_support_ext::prepare() } } -void +void platform_support_ext::lock() -{ - pthread_mutex_lock (m_specific->m_mutex); +{ + pthread_mutex_lock (m_specific->m_mutex); } void platform_support_ext::unlock() -{ - pthread_mutex_unlock (m_specific->m_mutex); +{ + pthread_mutex_unlock (m_specific->m_mutex); } bool platform_support_ext::is_mapped() -{ +{ return m_specific->m_is_mapped; } @@ -1102,9 +1102,9 @@ platform_support_ext::update_region (const agg::rect_base<int>& r) x_connection *xd = &m_specific->m_draw_conn; m_specific->put_image(&rbuf_window(), &r); - - // When m_wait_mode is true we can discard all the events - // came while the image is being drawn. In this case + + // When m_wait_mode is true we can discard all the events + // came while the image is being drawn. In this case // the X server does not accumulate mouse motion events. // When m_wait_mode is false, i.e. we have some idle drawing // we cannot afford to miss any events @@ -1127,13 +1127,13 @@ platform_support_ext::save_image_file (agg::rendering_buffer& rbuf, const char * FILE* fd = fopen(fnext.data(), "wb"); if(fd == 0) return false; - + unsigned w = rbuf.width(); unsigned h = rbuf.height(); - + fprintf(fd, "P6\n%d %d\n255\n", w, h); - - unsigned y; + + unsigned y; agg::pod_array<unsigned char> row_buf(w * 3); unsigned char *tmp_buf = row_buf.data(); @@ -1146,31 +1146,31 @@ platform_support_ext::save_image_file (agg::rendering_buffer& rbuf, const char * case agg::pix_format_rgb555: agg::color_conv_row(tmp_buf, src, w, agg::color_conv_rgb555_to_rgb24()); break; - + case agg::pix_format_rgb565: agg::color_conv_row(tmp_buf, src, w, agg::color_conv_rgb565_to_rgb24()); break; - + case agg::pix_format_bgr24: agg::color_conv_row(tmp_buf, src, w, agg::color_conv_bgr24_to_rgb24()); break; - + case agg::pix_format_rgb24: agg::color_conv_row(tmp_buf, src, w, agg::color_conv_rgb24_to_rgb24()); break; - + case agg::pix_format_rgba32: agg::color_conv_row(tmp_buf, src, w, agg::color_conv_rgba32_to_rgb24()); break; - + case agg::pix_format_argb32: agg::color_conv_row(tmp_buf, src, w, agg::color_conv_argb32_to_rgb24()); break; - + case agg::pix_format_bgra32: agg::color_conv_row(tmp_buf, src, w, agg::color_conv_bgra32_to_rgb24()); break; - + case agg::pix_format_abgr32: agg::color_conv_row(tmp_buf, src, w, agg::color_conv_abgr32_to_rgb24()); break; diff --git a/agg-plot/agg_win32_bmp.cpp b/agg-plot/agg_win32_bmp.cpp index 9a03d43c..f3e5f953 100644 --- a/agg-plot/agg_win32_bmp.cpp +++ b/agg-plot/agg_win32_bmp.cpp @@ -45,8 +45,8 @@ namespace agg //------------------------------------------------------------------------ - void pixel_map::create(unsigned width, - unsigned height, + void pixel_map::create(unsigned width, + unsigned height, org_e org, unsigned clear_val) { @@ -66,8 +66,8 @@ namespace agg //------------------------------------------------------------------------ HBITMAP pixel_map::create_dib_section(HDC h_dc, - unsigned width, - unsigned height, + unsigned width, + unsigned height, org_e org, unsigned clear_val) { @@ -163,8 +163,8 @@ namespace agg //static //------------------------------------------------------------------------ - BITMAPINFO* pixel_map::create_bitmap_info(unsigned width, - unsigned height, + BITMAPINFO* pixel_map::create_bitmap_info(unsigned width, + unsigned height, unsigned bits_per_pixel) { unsigned line_len = calc_row_len(width, bits_per_pixel); @@ -205,8 +205,8 @@ namespace agg { brightness = (255 * i) / (rgb_size - 1); rgb->rgbBlue = - rgb->rgbGreen = - rgb->rgbRed = (unsigned char)brightness; + rgb->rgbGreen = + rgb->rgbRed = (unsigned char)brightness; rgb->rgbReserved = 0; rgb++; } @@ -225,12 +225,12 @@ namespace agg { case 1: k = n; n = n >> 3; - if(k & 7) n++; + if(k & 7) n++; break; case 4: k = n; n = n >> 1; - if(k & 3) n++; + if(k & 3) n++; break; case 8: @@ -239,16 +239,16 @@ namespace agg case 16: n *= 2; break; - case 24: n *= 3; + case 24: n *= 3; break; case 32: n *= 4; break; - case 48: n *= 6; + case 48: n *= 6; break; - case 64: n *= 8; + case 64: n *= 8; break; default: n = 0; @@ -271,24 +271,24 @@ namespace agg unsigned bmp_width = m_bmp->bmiHeader.biWidth; unsigned bmp_height = m_bmp->bmiHeader.biHeight; unsigned dvc_x = 0; - unsigned dvc_y = 0; + unsigned dvc_y = 0; unsigned dvc_width = m_bmp->bmiHeader.biWidth; unsigned dvc_height = m_bmp->bmiHeader.biHeight; - - if(bmp_rect) + + if(bmp_rect) { bmp_x = bmp_rect->left; bmp_y = bmp_rect->top; bmp_width = bmp_rect->right - bmp_rect->left; bmp_height = bmp_rect->bottom - bmp_rect->top; - } + } dvc_x = bmp_x; dvc_y = bmp_y; dvc_width = bmp_width; dvc_height = bmp_height; - if(device_rect) + if(device_rect) { dvc_x = device_rect->left; dvc_y = device_rect->top; @@ -300,31 +300,31 @@ namespace agg { ::SetStretchBltMode(h_dc, COLORONCOLOR); ::StretchDIBits( - h_dc, // handle of device context - dvc_x, // x-coordinate of upper-left corner of source rect. - dvc_y, // y-coordinate of upper-left corner of source rect. - dvc_width, // width of source rectangle - dvc_height, // height of source rectangle + h_dc, // handle of device context + dvc_x, // x-coordinate of upper-left corner of source rect. + dvc_y, // y-coordinate of upper-left corner of source rect. + dvc_width, // width of source rectangle + dvc_height, // height of source rectangle bmp_x, - bmp_y, // x, y -coordinates of upper-left corner of dest. rect. - bmp_width, // width of destination rectangle - bmp_height, // height of destination rectangle - m_buf, // address of bitmap bits - m_bmp, // address of bitmap data - DIB_RGB_COLORS, // usage - SRCCOPY // raster operation code + bmp_y, // x, y -coordinates of upper-left corner of dest. rect. + bmp_width, // width of destination rectangle + bmp_height, // height of destination rectangle + m_buf, // address of bitmap bits + m_bmp, // address of bitmap data + DIB_RGB_COLORS, // usage + SRCCOPY // raster operation code ); } else { ::SetDIBitsToDevice( h_dc, // handle to device context - dvc_x, // x-coordinate of upper-left corner of - dvc_y, // y-coordinate of upper-left corner of + dvc_x, // x-coordinate of upper-left corner of + dvc_y, // y-coordinate of upper-left corner of dvc_width, // source rectangle width dvc_height, // source rectangle height - bmp_x, // x-coordinate of lower-left corner of - bmp_y, // y-coordinate of lower-left corner of + bmp_x, // x-coordinate of lower-left corner of + bmp_y, // y-coordinate of lower-left corner of 0, // first scan line in array bmp_height, // number of scan lines m_buf, // address of array with DIB bits @@ -373,24 +373,24 @@ namespace agg unsigned bmp_width = m_bmp->bmiHeader.biWidth; unsigned bmp_height = m_bmp->bmiHeader.biHeight; unsigned dvc_x = 0; - unsigned dvc_y = 0; + unsigned dvc_y = 0; unsigned dvc_width = m_bmp->bmiHeader.biWidth; unsigned dvc_height = m_bmp->bmiHeader.biHeight; - - if(bmp_rect) + + if(bmp_rect) { bmp_x = bmp_rect->left; bmp_y = bmp_rect->top; bmp_width = bmp_rect->right - bmp_rect->left; bmp_height = bmp_rect->bottom - bmp_rect->top; - } + } dvc_x = bmp_x; dvc_y = bmp_y; dvc_width = bmp_width; dvc_height = bmp_height; - if(device_rect) + if(device_rect) { dvc_x = device_rect->left; dvc_y = device_rect->top; @@ -401,8 +401,8 @@ namespace agg HDC mem_dc = ::CreateCompatibleDC(h_dc); void* buf = 0; HBITMAP bmp = ::CreateDIBSection( - mem_dc, - m_bmp, + mem_dc, + m_bmp, DIB_RGB_COLORS, &buf, 0, @@ -420,21 +420,21 @@ namespace agg blend.AlphaFormat = AC_SRC_ALPHA; //#elif defined(AC_SRC_NO_PREMULT_ALPHA) // blend.AlphaFormat = AC_SRC_NO_PREMULT_ALPHA; -#else +#else #error "No appropriate constant for alpha format. Check version of wingdi.h, There must be AC_SRC_ALPHA or AC_SRC_NO_PREMULT_ALPHA" #endif blend.SourceConstantAlpha = 255; ::AlphaBlend( - h_dc, - dvc_x, - dvc_y, - dvc_width, - dvc_height, + h_dc, + dvc_x, + dvc_y, + dvc_width, + dvc_height, mem_dc, bmp_x, - bmp_y, - bmp_width, + bmp_y, + bmp_width, bmp_height, blend ); @@ -558,7 +558,7 @@ namespace agg //------------------------------------------------------------------------ int pixel_map::stride() const { - return calc_row_len(m_bmp->bmiHeader.biWidth, + return calc_row_len(m_bmp->bmiHeader.biWidth, m_bmp->bmiHeader.biBitCount); } @@ -569,8 +569,8 @@ namespace agg { if(bmp) { - m_img_size = calc_row_len(bmp->bmiHeader.biWidth, - bmp->bmiHeader.biBitCount) * + m_img_size = calc_row_len(bmp->bmiHeader.biWidth, + bmp->bmiHeader.biBitCount) * bmp->bmiHeader.biHeight; m_full_size = calc_full_size(bmp); @@ -583,17 +583,17 @@ namespace agg //private //------------------------------------------------------------------------ HBITMAP pixel_map::create_dib_section_from_args(HDC h_dc, - unsigned width, - unsigned height, + unsigned width, + unsigned height, unsigned bits_per_pixel) { unsigned line_len = calc_row_len(width, bits_per_pixel); unsigned img_size = line_len * height; unsigned rgb_size = calc_palette_size(0, bits_per_pixel) * sizeof(RGBQUAD); unsigned full_size = sizeof(BITMAPINFOHEADER) + rgb_size; - + BITMAPINFO *bmp = (BITMAPINFO *) new unsigned char[full_size]; - + bmp->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp->bmiHeader.biWidth = width; bmp->bmiHeader.biHeight = height; @@ -605,10 +605,10 @@ namespace agg bmp->bmiHeader.biYPelsPerMeter = 0; bmp->bmiHeader.biClrUsed = 0; bmp->bmiHeader.biClrImportant = 0; - + void* img_ptr = 0; HBITMAP h_bitmap = ::CreateDIBSection(h_dc, bmp, DIB_RGB_COLORS, &img_ptr, NULL, 0); - + if(img_ptr) { m_img_size = calc_row_len(width, bits_per_pixel) * height; @@ -616,7 +616,7 @@ namespace agg m_bmp = bmp; m_buf = (unsigned char *) img_ptr; } - + return h_bitmap; } } diff --git a/agg-plot/bitmap-plot.cpp b/agg-plot/bitmap-plot.cpp index 5807c74e..2d9d16e4 100644 --- a/agg-plot/bitmap-plot.cpp +++ b/agg-plot/bitmap-plot.cpp @@ -37,7 +37,7 @@ bitmap_save_image_cpp (sg_plot *p, const char *fn, unsigned w, unsigned h, can.clear_box(r); p->draw(can, mtx); - + bool success = platform_support_ext::save_image_file (rbuf_tmp, fn); if (! success) diff --git a/agg-plot/canvas-window-cpp.h b/agg-plot/canvas-window-cpp.h index 62baeb45..36696c2e 100644 --- a/agg-plot/canvas-window-cpp.h +++ b/agg-plot/canvas-window-cpp.h @@ -41,11 +41,11 @@ public: enum win_status_e status; canvas_window(agg::rgba& bgcol) : - platform_support_ext(agg::pix_format_bgr24, true), + platform_support_ext(agg::pix_format_bgr24, true), m_canvas(NULL), m_bgcolor(bgcol), m_matrix(), status(not_ready) { }; - virtual ~canvas_window() + virtual ~canvas_window() { if (m_canvas) delete m_canvas; diff --git a/agg-plot/canvas-window.cpp b/agg-plot/canvas-window.cpp index 60598484..11270616 100644 --- a/agg-plot/canvas-window.cpp +++ b/agg-plot/canvas-window.cpp @@ -1,18 +1,18 @@ /* canvas-window.cpp - * + * * Copyright (C) 2009, 2010 Francesco Abbate - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -45,7 +45,7 @@ canvas_window::on_resize(int sx, int sy) delete m_canvas; m_canvas = new(std::nothrow) canvas(rbuf_window(), sx, sy, m_bgcolor); - + m_matrix.sx = sx; m_matrix.sy = sy; } @@ -69,7 +69,7 @@ bool canvas_window::start_new_thread (std::auto_ptr<canvas_window::thread_info>& void *user_data = (void *) inf.get(); if (pthread_create(&m_thread, attr, canvas_thread_function, user_data)) { - this->status = canvas_window::error; + this->status = canvas_window::error; pthread_attr_destroy (attr); return false; } diff --git a/agg-plot/canvas.h b/agg-plot/canvas.h index f375ea4c..796e0554 100644 --- a/agg-plot/canvas.h +++ b/agg-plot/canvas.h @@ -26,8 +26,8 @@ public: pixel_fmt pixfmt; - pixel_gamma_corr(agg::rendering_buffer& ren_buf): - m_gamma(2.2), pixfmt(ren_buf, m_gamma) + pixel_gamma_corr(agg::rendering_buffer& ren_buf): + m_gamma(2.2), pixfmt(ren_buf, m_gamma) { }; enum { line_width = 150 }; @@ -60,8 +60,8 @@ class canvas_gen : private pixel { double m_height; public: - canvas_gen(agg::rendering_buffer& ren_buf, double width, double height, - agg::rgba bgcol): + canvas_gen(agg::rendering_buffer& ren_buf, double width, double height, + agg::rgba bgcol): pixel(ren_buf), rb(pixel::pixfmt), rs(rb), ras(), sl(), bg_color(bgcol), m_width(width), m_height(height) diff --git a/agg-plot/colors.cpp b/agg-plot/colors.cpp index f6b414a1..adef7ea9 100644 --- a/agg-plot/colors.cpp +++ b/agg-plot/colors.cpp @@ -12,7 +12,7 @@ rgba8_lookup (lua_State *L, const char *color_str) if (strcmp (p, "white") == 0) return agg::rgba8(255, 255, 255, a); - + int val = 180; int r = 0, g = 0, b = 0; @@ -50,7 +50,7 @@ color_arg_lookup (lua_State *L, int index) { if (lua_isnoneornil (L, index)) return colors::cdefault; - + if (lua_isnumber(L, index)) { unsigned int col = (unsigned int) lua_tointeger (L, index); diff --git a/agg-plot/draw_svg.cpp b/agg-plot/draw_svg.cpp index bc61e876..57123e53 100644 --- a/agg-plot/draw_svg.cpp +++ b/agg-plot/draw_svg.cpp @@ -44,7 +44,7 @@ str svg_stroke_path(str& path_coords, double width, int id, agg::rgba8 c, str s = str::print("fill:none;stroke:%s;" "stroke-width:%g;stroke-linecap:butt;" - "stroke-linejoin:miter", + "stroke-linejoin:miter", rgbstr, width); property_append_alpha(s, "stroke-opacity", c); diff --git a/agg-plot/lua-cpp-utils.h b/agg-plot/lua-cpp-utils.h index 7111aa5f..5b7f754f 100644 --- a/agg-plot/lua-cpp-utils.h +++ b/agg-plot/lua-cpp-utils.h @@ -12,7 +12,7 @@ __END_DECLS #include "gs-types.h" namespace gslshell { - + class ret_status { bool m_success; const char *m_error_msg; @@ -22,9 +22,9 @@ namespace gslshell { ret_status() : m_success(true) {}; void success() { m_success = true; } - void error(const char *msg, const char *ctx) - { - m_success = false; + void error(const char *msg, const char *ctx) + { + m_success = false; m_error_msg = msg; m_context = ctx; }; diff --git a/agg-plot/lua-draw.cpp b/agg-plot/lua-draw.cpp index ea1e8f61..932d9c26 100644 --- a/agg-plot/lua-draw.cpp +++ b/agg-plot/lua-draw.cpp @@ -1,18 +1,18 @@ /* lua-draw.cpp - * + * * Copyright (C) 2009, 2010 Francesco Abbate - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -103,7 +103,7 @@ agg_path_new (lua_State *L) double x = gs_check_number (L, 1, FP_CHECK_NORMAL); double y = gs_check_number (L, 2, FP_CHECK_NORMAL); struct cmd_call_stack s[1]; - + s->f[0] = x; s->f[1] = y; diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp index d041b888..3deeddbd 100644 --- a/agg-plot/lua-plot.cpp +++ b/agg-plot/lua-plot.cpp @@ -1,18 +1,18 @@ /* lua-plot.cpp - * + * * Copyright (C) 2009, 2010 Francesco Abbate - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -172,7 +172,7 @@ plot_free (lua_State *L) } void -plot_add_gener_cpp (lua_State *L, sg_plot *p, bool as_line, +plot_add_gener_cpp (lua_State *L, sg_plot *p, bool as_line, gslshell::ret_status& st) { agg::rgba8 color; @@ -229,13 +229,13 @@ plot_add_gener (lua_State *L, bool as_line) return 0; } - + int plot_add (lua_State *L) { return plot_add_gener (L, false); } - + int plot_add_line (lua_State *L) { @@ -260,7 +260,7 @@ static void plot_string_property_set (lua_State* L, void (sg_plot::*setter)(cons if (s == NULL) gs_type_error (L, 2, "string"); - + AGG_LOCK(); (p->*setter)(s); AGG_UNLOCK(); diff --git a/agg-plot/my_conv_simple_marker.h b/agg-plot/my_conv_simple_marker.h index d27372f9..fc155d3d 100644 --- a/agg-plot/my_conv_simple_marker.h +++ b/agg-plot/my_conv_simple_marker.h @@ -19,10 +19,10 @@ namespace my { private: conv_simple_marker(const conv_simple_marker<MarkerLocator, MarkerShapes>&); - const conv_simple_marker<MarkerLocator, MarkerShapes>& + const conv_simple_marker<MarkerLocator, MarkerShapes>& operator = (const conv_simple_marker<MarkerLocator, MarkerShapes>&); - enum status_e + enum status_e { initial, markers, @@ -38,7 +38,7 @@ namespace my { //------------------------------------------------------------------------ - template<class MarkerLocator, class MarkerShapes> + template<class MarkerLocator, class MarkerShapes> conv_simple_marker<MarkerLocator, MarkerShapes>::conv_simple_marker(MarkerLocator& ml, MarkerShapes& ms) : m_marker_locator(&ml), m_marker_shapes(&ms), @@ -48,7 +48,7 @@ namespace my { //------------------------------------------------------------------------ - template<class MarkerLocator, class MarkerShapes> + template<class MarkerLocator, class MarkerShapes> void conv_simple_marker<MarkerLocator, MarkerShapes>::rewind(unsigned) { m_status = initial; @@ -56,7 +56,7 @@ namespace my { //------------------------------------------------------------------------ - template<class MarkerLocator, class MarkerShapes> + template<class MarkerLocator, class MarkerShapes> unsigned conv_simple_marker<MarkerLocator, MarkerShapes>::vertex(double* x, double* y) { unsigned cmd = path_cmd_move_to; diff --git a/agg-plot/my_list.h b/agg-plot/my_list.h index 12880d69..34e7cf0d 100644 --- a/agg-plot/my_list.h +++ b/agg-plot/my_list.h @@ -18,7 +18,7 @@ public: if (! k) return n; - + while (k->m_next) k = k->m_next; k->m_next = n; diff --git a/agg-plot/my_tree.h b/agg-plot/my_tree.h index 5202af52..de238cbb 100644 --- a/agg-plot/my_tree.h +++ b/agg-plot/my_tree.h @@ -37,14 +37,14 @@ namespace tree { node_list *m_head; tree_data_type m_data; - + public: tree_node() : m_head(0), m_data() {}; template <class init_type> tree_node(const init_type& init_val) : m_head(0), m_data(init_val) {}; - - ~tree_node() + + ~tree_node() { node_list *n; for (node_list *p = m_head; p; p = n) @@ -56,17 +56,17 @@ namespace tree { }; virtual node_list* tree() { return m_head; }; - virtual node_list* tree(tree_data_type& data) - { + virtual node_list* tree(tree_data_type& data) + { data = m_data; - return m_head; + return m_head; }; virtual base_type* content() { return 0; }; virtual void content(const base_type& src) { }; - void add(node_type* child) - { + void add(node_type* child) + { node_list *t = new node_list(child); m_head = node_list::push_back(m_head, t); } diff --git a/agg-plot/platform_support_ext.h b/agg-plot/platform_support_ext.h index 21b32e11..e50bb327 100644 --- a/agg-plot/platform_support_ext.h +++ b/agg-plot/platform_support_ext.h @@ -7,7 +7,7 @@ class platform_support_ext : public agg::platform_support { public: platform_support_ext (agg::pix_format_e format, bool flip_y) - : agg::platform_support(format, flip_y) + : agg::platform_support(format, flip_y) { }; void lock(); @@ -23,7 +23,7 @@ public: static bool save_image_file (agg::rendering_buffer& src, const char *fn); }; -template<class RenBufDst, class RenBufSrc, class CopyRow> +template<class RenBufDst, class RenBufSrc, class CopyRow> void my_color_conv(RenBufDst* dst, const RenBufSrc* src, CopyRow copy_row_functor) { unsigned int width = src->width(); @@ -35,7 +35,7 @@ void my_color_conv(RenBufDst* dst, const RenBufSrc* src, CopyRow copy_row_functo } } -template<class RenBufDst, class RenBufSrc> +template<class RenBufDst, class RenBufSrc> void rendering_buffer_get_region (RenBufDst& dst, RenBufSrc& src, agg::rect_base<int>& r, unsigned pixel_width) { @@ -49,8 +49,8 @@ void rendering_buffer_get_region (RenBufDst& dst, RenBufSrc& src, agg::rect_base } } -template<class RenBufDst, class RenBufSrc> -void rendering_buffer_get_const_view (RenBufDst& view, const RenBufSrc& src, +template<class RenBufDst, class RenBufSrc> +void rendering_buffer_get_const_view (RenBufDst& view, const RenBufSrc& src, const agg::rect_base<int>& r, unsigned pixel_width, bool flip_y) { @@ -61,8 +61,8 @@ void rendering_buffer_get_const_view (RenBufDst& view, const RenBufSrc& src, view.attach(buf_start + pixel_width * x, w, h, src.stride()); } -template<class RenBufDst, class RenBufSrc> -void rendering_buffer_get_view (RenBufDst& view, RenBufSrc& src, +template<class RenBufDst, class RenBufSrc> +void rendering_buffer_get_view (RenBufDst& view, RenBufSrc& src, const agg::rect_base<int>& r, unsigned pixel_width, bool flip_y) { @@ -73,7 +73,7 @@ void rendering_buffer_get_view (RenBufDst& view, RenBufSrc& src, view.attach(buf_start + pixel_width * x, w, h, src.stride()); } -template<class RenBufDst, class RenBufSrc> +template<class RenBufDst, class RenBufSrc> void rendering_buffer_put_region (RenBufDst& dst, RenBufSrc& src, agg::rect_base<int>& r, unsigned pixel_width) { @@ -96,7 +96,7 @@ public: row_accessor_ro(const T* buf, unsigned width, unsigned height, int stride) : m_buf(buf), m_width(width), m_height(height), m_stride(stride) { - if(stride < 0) + if(stride < 0) m_start = m_buf - int(height - 1) * stride; else m_start = m_buf; @@ -108,8 +108,8 @@ public: m_width = width; m_height = height; m_stride = stride; - if(stride < 0) - { + if(stride < 0) + { m_start = m_buf - int(height - 1) * stride; } }; @@ -119,9 +119,9 @@ public: unsigned width() const { return m_width; } unsigned height() const { return m_height; } int stride() const { return m_stride; } - unsigned stride_abs() const + unsigned stride_abs() const { - return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride); + return (m_stride < 0) ? unsigned(-m_stride) : unsigned(m_stride); } //-------------------------------------------------------------------- @@ -134,7 +134,7 @@ private: unsigned m_width; // Width in pixels unsigned m_height; // Height in pixels int m_stride; // Number of bytes per row. Can be < 0 - const T* m_start; // Pointer to first pixel depending on stride + const T* m_start; // Pointer to first pixel depending on stride }; typedef row_accessor_ro<unsigned char> rendering_buffer_ro; diff --git a/agg-plot/plot-auto.h b/agg-plot/plot-auto.h index 7f136dae..027c0975 100644 --- a/agg-plot/plot-auto.h +++ b/agg-plot/plot-auto.h @@ -1,18 +1,18 @@ /* plot-auto.h - * + * * Copyright (C) 2009, 2010 Francesco Abbate - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -33,7 +33,7 @@ class plot_auto : public plot<VertexSource, resource_manager> { typedef agg::pod_bvector<item> item_list; public: - plot_auto() : + plot_auto() : plot<VertexSource, resource_manager>(true), m_bbox_updated(true) { }; @@ -57,8 +57,8 @@ private: }; template <class VS, class RM> -void plot_auto<VS,RM>::add(VS* vs, agg::rgba8& color, bool outline) -{ +void plot_auto<VS,RM>::add(VS* vs, agg::rgba8& color, bool outline) +{ item d(vs, color, outline); if (!this->fit_inside(vs)) @@ -93,7 +93,7 @@ void plot_auto<VS,RM>::check_bounding_box() } template<class VS, class RM> -void plot_auto<VS,RM>::calc_layer_bounding_box(plot_auto<VS,RM>::item_list& layer, +void plot_auto<VS,RM>::calc_layer_bounding_box(plot_auto<VS,RM>::item_list& layer, opt_rect<double>& rect) { for (unsigned j = 0; j < layer.size(); j++) diff --git a/agg-plot/plot.h b/agg-plot/plot.h index fe30ce9e..171aabad 100644 --- a/agg-plot/plot.h +++ b/agg-plot/plot.h @@ -1,18 +1,18 @@ /* plot.h - * + * * Copyright (C) 2009-2011 Francesco Abbate - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -80,7 +80,7 @@ struct plot_item { plot_item() : vs(0) {}; - plot_item(VertexSource* vs, agg::rgba8& c, bool as_outline): + plot_item(VertexSource* vs, agg::rgba8& c, bool as_outline): vs(vs), color(c), outline(as_outline) {}; @@ -98,7 +98,7 @@ public: typedef pod_list<item> iterator; typedef virtual_canvas<VertexSource> canvas_type; - plot(bool use_units = true) : + plot(bool use_units = true) : m_root_layer(), m_layers(), m_current_layer(&m_root_layer), m_drawing_queue(0), m_clip_flag(true), m_need_redraw(true), m_rect(), @@ -108,7 +108,7 @@ public: compute_user_trans(); }; - virtual ~plot() + virtual ~plot() { layer_dispose_elements(m_root_layer); for (unsigned k = 0; k < m_layers.size(); k++) @@ -135,7 +135,7 @@ public: virtual void add(VertexSource* vs, agg::rgba8& color, bool outline); virtual void before_draw() { }; - + template <class Canvas> void draw(Canvas& canvas, agg::trans_affine& m); @@ -160,11 +160,11 @@ public: void sync_mode(bool req_mode) { m_sync_mode = req_mode; }; bool sync_mode() const { return m_sync_mode; }; - void pad_mode(bool req) - { + void pad_mode(bool req) + { if (req != m_pad_units) { - m_pad_units = req; + m_pad_units = req; m_need_redraw = true; compute_user_trans(); } @@ -217,7 +217,7 @@ private: }; static double compute_scale(agg::trans_affine& m) -{ +{ return m.scale() / 480.0; } @@ -241,8 +241,8 @@ void plot<VS,RM>::commit_pending_draw() } template <class VS, class RM> -void plot<VS,RM>::add(VS* vs, agg::rgba8& color, bool outline) -{ +void plot<VS,RM>::add(VS* vs, agg::rgba8& color, bool outline) +{ item d(vs, color, outline); pod_list<item> *new_node = new pod_list<item>(d); m_drawing_queue = pod_list<item>::push_back(m_drawing_queue, new_node); @@ -250,19 +250,19 @@ void plot<VS,RM>::add(VS* vs, agg::rgba8& color, bool outline) } template <class VS, class RM> -void plot<VS,RM>::set_title(const char *text) +void plot<VS,RM>::set_title(const char *text) { str_copy_c(&m_title, text); } template <class VS, class RM> -void plot<VS,RM>::push_drawing_queue() +void plot<VS,RM>::push_drawing_queue() { for (pod_list<item> *c = m_drawing_queue; c != 0; c = c->next()) { m_current_layer->add(c->content()); } - + while (m_drawing_queue) m_drawing_queue = list::pop(m_drawing_queue); } @@ -633,7 +633,7 @@ agg::trans_affine plot<VS,RM>::viewport_scale(agg::trans_affine& canvas_mtx) template<class VS, class RM> void plot<VS,RM>::set_units(bool use_units) -{ +{ if (m_use_units != use_units) { m_use_units = use_units; @@ -702,7 +702,7 @@ bool plot<VS,RM>::pop_layer() } template <class VS, class RM> -void plot<VS,RM>::clear_current_layer() +void plot<VS,RM>::clear_current_layer() { clear_drawing_queue(); layer_dispose_elements (current_layer()); diff --git a/agg-plot/rect.h b/agg-plot/rect.h index 899bb697..4a5592ba 100644 --- a/agg-plot/rect.h +++ b/agg-plot/rect.h @@ -21,10 +21,10 @@ public: void set(const rect_type& r) { m_defined = true; m_rect = r; }; bool is_defined() const { return m_defined; }; - const rect_type& rect() const + const rect_type& rect() const { assert (m_defined); - return m_rect; + return m_rect; } void operator = (const opt_rect& src) @@ -35,8 +35,8 @@ public: } template <set_oper_e op> - void add(const rect_type& r) - { + void add(const rect_type& r) + { if (op == rect_union) m_rect = (m_defined ? agg::unite_rectangles(m_rect, r) : r); else @@ -46,8 +46,8 @@ public: } template <set_oper_e op> - void add(const opt_rect& optr) - { + void add(const opt_rect& optr) + { if (optr.m_defined) this->add<op>(optr.m_rect); } diff --git a/agg-plot/sg_object.h b/agg-plot/sg_object.h index 8d5041f4..f1d5ec7b 100644 --- a/agg-plot/sg_object.h +++ b/agg-plot/sg_object.h @@ -1,18 +1,18 @@ /* sg_object.h - * + * * Copyright (C) 2009, 2010 Francesco Abbate - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/agg-plot/split-parser.h b/agg-plot/split-parser.h index 7c13988b..dcf7dc20 100644 --- a/agg-plot/split-parser.h +++ b/agg-plot/split-parser.h @@ -20,21 +20,21 @@ public: lexer(const char *str) : m_content(str), m_ptr(m_content) {}; char next() - { + { char c = *m_ptr; if (c != '0円') m_ptr++; return c; }; - void push() - { - if (m_ptr > m_content) - m_ptr--; + void push() + { + if (m_ptr > m_content) + m_ptr--; }; - bool checknext(char reqchar) - { + bool checknext(char reqchar) + { char c = *m_ptr; if (c == reqchar) { @@ -49,7 +49,7 @@ public: static node_type* exprlist (lexer& lex, direction_e dir) { typedef tree::tree_node<base_type, direction_e> tree_type; - + tree_type *t = new tree_type(dir); for (int c = 0; ; c++) @@ -89,7 +89,7 @@ public: default: return 0; } - + return 0; } }; diff --git a/agg-plot/text.cpp b/agg-plot/text.cpp index ac935732..09a1fb0b 100644 --- a/agg-plot/text.cpp +++ b/agg-plot/text.cpp @@ -45,7 +45,7 @@ namespace draw { } str - text::write_svg(int id, agg::rgba8 c) + text::write_svg(int id, agg::rgba8 c) { const agg::trans_affine& m = m_user_matrix; const double eps = 1.0e-6; diff --git a/agg-plot/text.h b/agg-plot/text.h index 4f930bd7..da78c1cc 100644 --- a/agg-plot/text.h +++ b/agg-plot/text.h @@ -52,7 +52,7 @@ namespace draw { void angle(double th) { double c = cos(th), s = sin(th); - + m_angle = th; m_user_matrix.sx = c; diff --git a/agg-plot/trans.h b/agg-plot/trans.h index fa5ac1e3..6786d9d3 100644 --- a/agg-plot/trans.h +++ b/agg-plot/trans.h @@ -112,9 +112,9 @@ struct trans { typedef sg_adapter<trans_type, no_approx_scale> base_type; public: - affine_a(sg_object *src, const agg::trans_affine& mtx) : + affine_a(sg_object *src, const agg::trans_affine& mtx) : base_type(src, m_matrix), m_matrix(mtx) - { + { m_norm = m_matrix.scale(); } @@ -123,10 +123,10 @@ struct trans { this->m_source->apply_transform(m, as * m_norm); }; - virtual bool affine_compose(agg::trans_affine& m) - { + virtual bool affine_compose(agg::trans_affine& m) + { trans_affine_compose (m_matrix, m); - return true; + return true; } }; @@ -138,7 +138,7 @@ struct trans { //------------------------------------------------ extend transform struct extend : sg_adapter<agg::conv_contour<sg_object>, approx_scale> { extend(sg_object* src): - sg_adapter<agg::conv_contour<sg_object>, approx_scale>(src) + sg_adapter<agg::conv_contour<sg_object>, approx_scale>(src) { } virtual ~extend() { delete m_source; } @@ -147,7 +147,7 @@ struct trans { //------------------------------------------------ marker transform typedef my::conv_simple_marker<sg_object, sg_object> marker_type; - class marker_a : + class marker_a : public sg_adapter<marker_type, no_approx_scale> { typedef sg_adapter<marker_type, no_approx_scale> base_type; diff --git a/agg-plot/units.cpp b/agg-plot/units.cpp index 99506c3f..d1a9cbd6 100644 --- a/agg-plot/units.cpp +++ b/agg-plot/units.cpp @@ -1,18 +1,18 @@ /* units.cpp - * + * * Copyright (C) 2009, 2010 Francesco Abbate - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/agg-plot/units.h b/agg-plot/units.h index 47c07a51..cc52d484 100644 --- a/agg-plot/units.h +++ b/agg-plot/units.h @@ -1,18 +1,18 @@ /* units.h - * + * * Copyright (C) 2009, 2010 Francesco Abbate - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. - * + * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -32,18 +32,18 @@ private: void init(double min, double max, double spacefact); public: - units(): m_major(1), order(0), dmajor(1), m_inf(0), m_sup(1), nb_decimals(0) {}; + units(): m_major(1), order(0), dmajor(1), m_inf(0), m_sup(1), nb_decimals(0) {}; units (double min, double max, double spacefact = 4.0) { init(min, max, spacefact); }; int begin() const { return m_inf; }; int end() const { return m_sup; }; - void limits(int &start, int &fin, double &step) - { - start = m_inf; - fin = m_sup; - step = dmajor; + void limits(int &start, int &fin, double &step) + { + start = m_inf; + fin = m_sup; + step = dmajor; }; void mark_label (char *label, unsigned size, int mark) const; diff --git a/agg-plot/utils.h b/agg-plot/utils.h index b68d3bed..311ca5c0 100644 --- a/agg-plot/utils.h +++ b/agg-plot/utils.h @@ -24,7 +24,7 @@ T max(T a, T b) return (a > b) ? a : b; }; -extern void trans_affine_compose (agg::trans_affine& a, +extern void trans_affine_compose (agg::trans_affine& a, const agg::trans_affine& b); extern agg::trans_affine identity_matrix; diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp index d27b85e7..6880c79a 100644 --- a/agg-plot/window.cpp +++ b/agg-plot/window.cpp @@ -94,7 +94,7 @@ int window::ref::calculate(window::ref::node* t, const bmatrix& m, int id) } void -window::ref::save_image (agg::rendering_buffer& win_buf, +window::ref::save_image (agg::rendering_buffer& win_buf, agg::rect_base<int>& r, int img_bpp, bool flip_y) { @@ -377,7 +377,7 @@ int window_generic_oper (lua_State *L, window_slot_method_type method) } template <class param_type> -int window_generic_oper_ext (lua_State *L, +int window_generic_oper_ext (lua_State *L, void (window::*method)(int, param_type), param_type param) { @@ -543,7 +543,7 @@ window_update (lua_State *L) { window *win = object_check<window>(L, 1, GS_WINDOW); - win->lock(); + win->lock(); if (win->status == canvas_window::running) { win->on_draw(); diff --git a/agg-plot/window_registry.cpp b/agg-plot/window_registry.cpp index 4c59e8f7..0ebfa499 100644 --- a/agg-plot/window_registry.cpp +++ b/agg-plot/window_registry.cpp @@ -70,7 +70,7 @@ window_index_apply_all (lua_State *L, lua_CFunction f) lua_getfield (L, LUA_REGISTRYINDEX, registry_tname); lua_pushnil (L); /* first key */ - while (lua_next(L, -2) != 0) + while (lua_next(L, -2) != 0) { lua_pushcfunction (L, f); lua_insert (L, -2); @@ -88,7 +88,7 @@ window_index_count (lua_State *L) lua_getfield (L, LUA_REGISTRYINDEX, registry_tname); lua_pushnil (L); /* first key */ - while (lua_next(L, -2) != 0) + while (lua_next(L, -2) != 0) { lua_pop (L, 1); count ++; diff --git a/agg-plot/window_registry.h b/agg-plot/window_registry.h index 1711ea8b..af7306e5 100644 --- a/agg-plot/window_registry.h +++ b/agg-plot/window_registry.h @@ -19,7 +19,7 @@ extern int window_index_count (lua_State *L); extern void window_refs_add (lua_State *L, int index, int key_index, int value_index); extern void window_refs_remove (lua_State *L, int index, int key_index); -extern void window_refs_lookup_apply (lua_State *L, int value_index, +extern void window_refs_lookup_apply (lua_State *L, int value_index, lua_CFunction func); __END_DECLS |