Revision: 75638
http://sourceforge.net/p/brlcad/code/75638
Author: starseeker
Date: 2020-04-29 20:10:08 +0000 (Wed, 29 Apr 2020)
Log Message:
-----------
add a couple of fb specific pieces
Modified Paths:
--------------
brlcad/trunk/src/libdm/tests/tcl_img.cpp
Modified: brlcad/trunk/src/libdm/tests/tcl_img.cpp
===================================================================
--- brlcad/trunk/src/libdm/tests/tcl_img.cpp 2020-04-29 18:42:02 UTC (rev
75637)
+++ brlcad/trunk/src/libdm/tests/tcl_img.cpp 2020-04-29 20:10:08 UTC (rev
75638)
@@ -40,6 +40,7 @@
const char *DM_CANVAS = ".dm0";
TCL_DECLARE_MUTEX(dilock)
+TCL_DECLARE_MUTEX(fblock)
TCL_DECLARE_MUTEX(threadMutex)
/* Container holding image generation information - need to be able
@@ -104,6 +105,12 @@
struct img_data *idata;
};
+// Event container passed to routines triggered by events.
+struct FbRenderEvent {
+ Tcl_Event event; /* Must be first */
+ struct img_data *idata;
+};
+
// Even for events where we don't intend to actually run a proc,
// we need to tell Tcl it successfully processed them. For that
// we define a no-op callback proc.
@@ -134,6 +141,9 @@
return 1;
}
+ Tcl_MutexLock(&dilock);
+ Tcl_MutexLock(&fblock);
+
// Let Tcl/Tk know the photo data has changed, so it can update the visuals
// accordingly
Tk_PhotoImageBlock dm_data;
@@ -144,7 +154,6 @@
Tk_PhotoGetImage(dm_img, &dm_data);
}
- Tcl_MutexLock(&dilock);
// Tk_PhotoPutBlock appears to be making a copy of the data, so we should
// be able to point to our thread's rendered data to feed it in for
@@ -152,9 +161,19 @@
dm_data.pixelPtr = idata->pixelPtr;
Tk_PhotoPutBlock(interp, dm_img, &dm_data, 0, 0, dm_data.width,
dm_data.height, TK_PHOTO_COMPOSITE_SET);
+
+ // Now overlay the framebuffer. We're done with dm_data, so just reuse it
for
+ // this purpose
+ dm_data.width = idata->fb_width;
+ dm_data.height = idata->fb_height;
+ dm_data.pixelPtr = idata->fbpixel;
+ Tk_PhotoPutBlock(interp, dm_img, &dm_data, 0, 0, idata->fb_width,
idata->fb_height, TK_PHOTO_COMPOSITE_OVERLAY);
+
// Render processed - reset the ready flag
idata->render_ready = 0;
+
Tcl_MutexUnlock(&dilock);
+ Tcl_MutexUnlock(&fblock);
// Return one to signify a successful completion of the process execution
return 1;
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