gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/window.cpp
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2011年12月18日 00:02:19 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2011年12月18日 00:02:19 +0100
commitee563973094a8235631d5208bd672f8cbbe15fdc (patch)
tree6a72a6e6ece3cb9a96fc221f3e04922e63f42f00 /agg-plot/window.cpp
parentef0f158b491b4211c392ce4c4c50891b6d5631de (diff)
downloadgsl-shell-ee563973094a8235631d5208bd672f8cbbe15fdc.tar.gz
Eliminate C++ exceptions from graphical system implementation
The rationale is that everything is simpler without C++ exceptions. No exceptions are raised in the C++ code and errors are handler in the tradition C fashion. lua_error is not directly called from C++ functions that may allocate a non POD object on the stack. If the C++ "new" operator raise an exception the program will abort. The idea is that handle such an improbable occurrence greatly complicates the code. Where big chunks of memory are allocated the nothrow variant of "new" is used, the returned pointer is verified and an error is raised if the allocation failed. In the Windows code the bitmap allocation for image may raise an unhandled exception in there is not enough memory. The memory allocation is done inside the AGG library so it difficult to change its behavior.
Diffstat (limited to 'agg-plot/window.cpp')
-rw-r--r--agg-plot/window.cpp 17
1 files changed, 5 insertions, 12 deletions
diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp
index 02aeab85..7625b73e 100644
--- a/agg-plot/window.cpp
+++ b/agg-plot/window.cpp
@@ -159,11 +159,7 @@ void window::draw_slot_by_ref(window::ref& ref, bool draw_image)
if (ref.plot)
{
AGG_LOCK();
- try
- {
ref.plot->draw(*m_canvas, mtx);
- }
- catch (std::bad_alloc&) { }
AGG_UNLOCK();
}
@@ -242,14 +238,11 @@ window::refresh_slot_by_ref(ref& ref, bool draw_all)
rect.set(rect_of_slot_matrix<double>(mtx));
AGG_LOCK();
- try {
- opt_rect<double> draw_rect;
- ref.plot->draw_queue(*m_canvas, mtx, draw_rect);
- rect.add<rect_union>(draw_rect);
- rect.add<rect_union>(ref.dirty_rect);
- ref.dirty_rect = draw_rect;
- }
- catch (std::bad_alloc&) { }
+ opt_rect<double> draw_rect;
+ ref.plot->draw_queue(*m_canvas, mtx, draw_rect);
+ rect.add<rect_union>(draw_rect);
+ rect.add<rect_union>(ref.dirty_rect);
+ ref.dirty_rect = draw_rect;
AGG_UNLOCK();
if (rect.is_defined())
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月13日 23:17:32 +0000

AltStyle によって変換されたページ (->オリジナル) /