Skip to content

Commit

Permalink
canvas: Deallocate WebRender images on canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Jul 11, 2016
1 parent 68aca87 commit b7d45fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/canvas/canvas_paint_thread.rs
Expand Up @@ -706,6 +706,14 @@ impl<'a> CanvasPaintThread<'a> {
}
}

impl<'a> Drop for CanvasPaintThread<'a> {
fn drop(&mut self) {
if let Some(ref mut wr) = self.webrender_api {
wr.delete_image(self.webrender_image_key.unwrap());
}
}
}

/// Used by drawImage to get rid of the extra pixels of the image data that
/// won't be copied to the canvas
/// image_data: Color pixel data of the image
Expand Down
8 changes: 8 additions & 0 deletions components/canvas/webgl_paint_thread.rs
Expand Up @@ -195,3 +195,11 @@ impl WebGLPaintThread {
}
}
}

impl Drop for WebGLPaintThread {
fn drop(&mut self) {
if let WebGLPaintTaskData::Readback(_, Some((ref mut wr, image_key))) = self.data {
wr.delete_image(image_key);
}
}
}

0 comments on commit b7d45fe

Please sign in to comment.