@@ -44,18 +44,17 @@ macro_rules! clone {
44
44
// | 2 | 3 |
45
45
// +---+---+
46
46
//
47
- // Each worker thread waits for a buffer (Box<[u8]>) to render into, wraps
48
- // it into ImageSurface, sleeps for a while, does the drawing, then sends the
49
- // underlying buffer back and waits for the next one.
47
+ // Each worker thread waits for an image (cairo::ImageSurface) to render into, sleeps for a while,
48
+ // does the drawing, then sends the image back and waits for the next one.
50
49
//
51
50
// The GUI thread holds an ImageSurface per image part at all times, these
52
51
// surfaces are painted on a DrawingArea in its 'draw' signal handler. This
53
- // thread periodically checks if any worker has sent a freshly rendered buffer .
52
+ // thread periodically checks if any worker has sent a freshly rendered image .
54
53
// Upon receipt it's wrapped in ImageSurface and swapped with the previously
55
- // held surface, whose buffer is sent to the worker thread again. Then the
54
+ // held surface, whose image is sent to the worker thread again. Then the
56
55
// appropriate part of the DrawingArea is invalidated prompting a redraw.
57
56
//
58
- // The two buffers per thread are allocated and initialized once and sent back
57
+ // The two images per thread are allocated and initialized once and sent back
59
58
// and forth repeatedly.
60
59
61
60
fn build_ui ( application : & gtk:: Application ) {
@@ -123,10 +122,6 @@ fn build_ui(application: >k::Application) {
123
122
let ( ref images, ref origins, _) = * cell. borrow( ) ;
124
123
for ( image, origin) in images. iter( ) . zip( origins. iter( ) ) {
125
124
draw_image_if_dirty( & cr, image, * origin, ( width, height) ) ;
126
- // if we don't reset the source, the context may hold on to
127
- // the surface indefinitely, the buffer will be stuck there
128
- // and the worker thread will starve
129
- cr. set_source_rgb( 0. , 0. , 0. ) ;
130
125
}
131
126
Inhibit ( false )
132
127
} ) ) ;
0 commit comments