Revision: 76999
http://sourceforge.net/p/brlcad/code/76999
Author: starseeker
Date: 2020-08-31 21:06:49 +0000 (Mon, 31 Aug 2020)
Log Message:
-----------
Start trying to figure out how updating the image will hook into the rest of
the drawing flow. No luck yet.
Modified Paths:
--------------
brlcad/branches/swrast/src/libdm/tk/dm-tk.c
brlcad/branches/swrast/src/libdm/tk/dm-tk.h
Modified: brlcad/branches/swrast/src/libdm/tk/dm-tk.c
===================================================================
--- brlcad/branches/swrast/src/libdm/tk/dm-tk.c 2020-08-31 20:43:16 UTC (rev
76998)
+++ brlcad/branches/swrast/src/libdm/tk/dm-tk.c 2020-08-31 21:06:49 UTC (rev
76999)
@@ -335,6 +335,7 @@
{
struct modifiable_tk_vars *mvars = (struct modifiable_tk_vars
*)dmp->i->m_vars;
struct dm_tkvars *pubvars = (struct dm_tkvars *)dmp->i->dm_vars.pub_vars;
+ struct tk_vars *privvars = (struct tk_vars *)dmp->i->dm_vars.priv_vars;
// Set the Tcl/Tk pathname for this window
if (bu_vls_strlen(&dmp->i->dm_pathName) == 0) {
@@ -418,9 +419,9 @@
bu_vls_free(&tcl_cmd);
bu_vls_sprintf(&tcl_cmd, "%s.canvas.photo",
bu_vls_cstr(&dmp->i->dm_pathName));
- Tk_PhotoHandle dm_img = Tk_FindPhoto(interp, bu_vls_cstr(&tcl_cmd));
- Tk_PhotoBlank(dm_img);
- Tk_PhotoSetSize(interp, dm_img, dmp->i->dm_width, dmp->i->dm_height);
+ privvars->dm_img = Tk_FindPhoto(interp, bu_vls_cstr(&tcl_cmd));
+ Tk_PhotoBlank(privvars->dm_img);
+ Tk_PhotoSetSize(interp, privvars->dm_img, dmp->i->dm_width,
dmp->i->dm_height);
// Initialize the PhotoImageBlock information
Tk_PhotoImageBlock dm_data;
@@ -454,7 +455,7 @@
}
// Let Tk_Photo know we have data
- Tk_PhotoPutBlock(interp, dm_img, &dm_data, 0, 0, dm_data.width,
dm_data.height, TK_PHOTO_COMPOSITE_SET);
+ Tk_PhotoPutBlock(interp, privvars->dm_img, &dm_data, 0, 0, dm_data.width,
dm_data.height, TK_PHOTO_COMPOSITE_SET);
// Define a canvas widget, pack it into the root window, and associate the
image with it
bu_vls_sprintf(&tcl_cmd, "canvas %s.canvas -width %d -height %d
-borderwidth 0",
@@ -482,6 +483,7 @@
pubvars->win = Tk_WindowId(pubvars->xtkwin);
dmp->i->dm_id = pubvars->win;
+ dmp->i->dm_interp = (void *)interp;
return 0;
}
@@ -890,6 +892,8 @@
HIDDEN int
tk_drawEnd(struct dm *dmp)
{
+ struct tk_vars *privvars = (struct tk_vars *)dmp->i->dm_vars.priv_vars;
+
if (dmp->i->dm_debugLevel)
bu_log("tk_drawEnd\n");
@@ -940,7 +944,19 @@
bu_vls_free(&tmp_vls);
}
+ // Tk_Photo is the output of the draw, and that's an image as far
+ // as this logic is concerned.
+ tk_getDisplayImage(dmp, (unsigned char **)&privvars->buf);
+ Tk_PhotoImageBlock dm_data;
+ Tk_PhotoGetImage(privvars->dm_img, &dm_data);
+ if (dm_data.width != dmp->i->dm_width || dm_data.height !=
dmp->i->dm_height) {
+ Tk_PhotoSetSize((Tcl_Interp *)dmp->i->dm_interp, privvars->dm_img,
dmp->i->dm_width, dmp->i->dm_height);
+ Tk_PhotoGetImage(privvars->dm_img, &dm_data);
+ }
+ dm_data.pixelPtr = (unsigned char *)privvars->buf;
+ Tk_PhotoPutBlock((Tcl_Interp *)dmp->i->dm_interp, privvars->dm_img,
&dm_data, 0, 0, dm_data.width, dm_data.height, TK_PHOTO_COMPOSITE_SET);
+
return BRLCAD_OK;
}
Modified: brlcad/branches/swrast/src/libdm/tk/dm-tk.h
===================================================================
--- brlcad/branches/swrast/src/libdm/tk/dm-tk.h 2020-08-31 20:43:16 UTC (rev
76998)
+++ brlcad/branches/swrast/src/libdm/tk/dm-tk.h 2020-08-31 21:06:49 UTC (rev
76999)
@@ -84,6 +84,7 @@
struct tk_vars {
OSMesaContext glxc;
+ Tk_PhotoHandle dm_img;
void *buf;
GLdouble faceplate_mat[16];
int face_flag;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits