Optimize plot's show method to avoid double drawing - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/lua-plot.cpp
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年03月28日 13:08:31 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年03月28日 22:19:14 +0200
commita8892c648d7cf5201a5836410fa708f28b539294 (patch)
tree31d5e656b499d7083a65e67fb4f6544841ee6fc9 /agg-plot/lua-plot.cpp
parentc029d0205e36aa6453870f240011a3616eccca77 (diff)
downloadgsl-shell-a8892c648d7cf5201a5836410fa708f28b539294.tar.gz
Optimize plot's show method to avoid double drawing
Diffstat (limited to 'agg-plot/lua-plot.cpp')
-rw-r--r--agg-plot/lua-plot.cpp 19
1 files changed, 14 insertions, 5 deletions
diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp
index 8ba21bbc..0b0f9a19 100644
--- a/agg-plot/lua-plot.cpp
+++ b/agg-plot/lua-plot.cpp
@@ -28,6 +28,7 @@ extern "C" {
#include "lua-cpp-utils.h"
#include "bitmap-plot.h"
#include "window.h"
+#include "window-cpp.h"
#include "gs-types.h"
#include "lua-utils.h"
#include "window_registry.h"
@@ -463,11 +464,19 @@ plot_flush (lua_State *L)
int
plot_show (lua_State *L)
{
- lua_pushcfunction (L, window_attach);
- window_new (L);
- lua_pushvalue (L, 1);
- lua_pushstring (L, "");
- lua_call (L, 3, 0);
+ sg_plot* plot = object_check<sg_plot>(L, 1, GS_PLOT);
+ window* win = push_new_object<window>(L, GS_WINDOW, colors::white);
+
+ int slot_id = win->attach (plot, "");
+ assert(slot_id >= 0);
+ window_refs_add (L, slot_id, -1, 1);
+
+ gslshell::ret_status st;
+ win->start(L, st);
+
+ if (st.error_msg())
+ return luaL_error (L, "%s (reported during %s)", st.error_msg(), st.context());
+
return 0;
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月12日 06:35:24 +0000

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