-rw-r--r-- | agg-plot/agg_platform_support_win32.cpp | 67 | ||||
-rw-r--r-- | agg-plot/window.cpp | 26 |
diff --git a/agg-plot/agg_platform_support_win32.cpp b/agg-plot/agg_platform_support_win32.cpp index 430ee2bc..88d01d68 100644 --- a/agg-plot/agg_platform_support_win32.cpp +++ b/agg-plot/agg_platform_support_win32.cpp @@ -361,37 +361,42 @@ namespace agg h = m_pmap_window.height(); } - pixel_map pmap_tmp; - pmap_tmp.create(w, h, org_e(m_sys_bpp)); - - rendering_buffer rbuf_tmp; - rbuf_tmp.attach(pmap_tmp.buf(), - pmap_tmp.width(), - pmap_tmp.height(), - m_flip_y ? - pmap_tmp.stride() : - -pmap_tmp.stride()); - - const unsigned char *src_start = src->row_ptr(m_flip_y ? y : y + h - 1); - const unsigned int pix_width = m_bpp / 8; - row_accessor_ro<unsigned char> src_box(src_start + pix_width * x, w, h, src->stride()); - - convert_pmap(&rbuf_tmp, &src_box, m_format, true); - - unsigned int wh = m_pmap_window.height(); - RECT wrect; - wrect.left = x; - wrect.right = x + w; - wrect.bottom = wh - y; - wrect.top = wh - (y+h); - - RECT brect; - brect.left = 0; - brect.right = w; - brect.bottom = h; - brect.top = 0; - - pmap_tmp.draw(dc, &wrect, &brect); + try + { + pixel_map pmap_tmp; + pmap_tmp.create(w, h, org_e(m_sys_bpp)); + + rendering_buffer rbuf_tmp; + rbuf_tmp.attach(pmap_tmp.buf(), + pmap_tmp.width(), + pmap_tmp.height(), + m_flip_y ? + pmap_tmp.stride() : + -pmap_tmp.stride()); + + const unsigned char *src_start = src->row_ptr(m_flip_y ? y : y + h - 1); + const unsigned int pix_width = m_bpp / 8; + row_accessor_ro<unsigned char> src_box(src_start + pix_width * x, w, h, src->stride()); + + convert_pmap(&rbuf_tmp, &src_box, m_format, true); + + unsigned int wh = m_pmap_window.height(); + RECT wrect; + wrect.left = x; + wrect.right = x + w; + wrect.bottom = wh - y; + wrect.top = wh - (y+h); + + RECT brect; + brect.left = 0; + brect.right = w; + brect.bottom = h; + brect.top = 0; + + pmap_tmp.draw(dc, &wrect, &brect); + } + catch (std::bad_alloc&) + { } } } diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp index b107af10..f6c7e4b4 100644 --- a/agg-plot/window.cpp +++ b/agg-plot/window.cpp @@ -117,31 +117,31 @@ window::ref* window::ref_lookup (ref::node *p, int slot_id) return NULL; } -void window::draw_slot_by_ref(window::ref& ref, bool dirty) +void window::draw_slot_by_ref(window::ref& ref, bool update_req) { if (! ref.plot) return; + agg::rect_base<int> r; agg::trans_affine mtx(ref.matrix); this->scale(mtx); - if (dirty) + if (update_req) { - agg::rect_base<int> r = rect_of_slot_matrix(mtx); + r = rect_of_slot_matrix(mtx); m_canvas->clear_box(r); - AGG_LOCK(); - try - { - ref.plot->draw(*m_canvas, mtx); - } - catch (std::bad_alloc&) { } - AGG_UNLOCK(); - platform_support_update_region (this, r); } - else + + AGG_LOCK(); + try { ref.plot->draw(*m_canvas, mtx); - } + } + catch (std::bad_alloc&) { } + AGG_UNLOCK(); + + if (update_req) + platform_support_update_region (this, r); } void |