mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Clear webrender image id when resizing a canvas.
This commit is contained in:
parent
07f6e11485
commit
4e04daa9d0
5 changed files with 76 additions and 1 deletions
|
@ -547,6 +547,10 @@ impl<'a> CanvasPaintThread<'a> {
|
|||
|
||||
fn recreate(&mut self, size: Size2D<i32>) {
|
||||
self.drawtarget = CanvasPaintThread::create(size);
|
||||
// Webrender doesn't let images change size, so we clear the webrender image key.
|
||||
if let Some(image_key) = self.image_key.take() {
|
||||
self.webrender_api.delete_image(image_key);
|
||||
}
|
||||
}
|
||||
|
||||
fn send_pixels(&mut self, chan: IpcSender<Option<Vec<u8>>>) {
|
||||
|
|
|
@ -291,7 +291,7 @@ impl WebGLPaintThread {
|
|||
#[allow(unsafe_code)]
|
||||
fn recreate(&mut self, size: Size2D<i32>) -> Result<(), &'static str> {
|
||||
match self.data {
|
||||
WebGLPaintTaskData::Readback(ref mut context, _, _) => {
|
||||
WebGLPaintTaskData::Readback(ref mut context, ref webrender_api, ref mut image_key) => {
|
||||
if size.width > self.size.width ||
|
||||
size.height > self.size.height {
|
||||
self.size = try!(context.resize(size));
|
||||
|
@ -299,6 +299,10 @@ impl WebGLPaintThread {
|
|||
self.size = size;
|
||||
context.gl().scissor(0, 0, size.width, size.height);
|
||||
}
|
||||
// Webrender doesn't let images change size, so we clear the webrender image key.
|
||||
if let Some(image_key) = image_key.take() {
|
||||
webrender_api.delete_image(image_key);
|
||||
}
|
||||
}
|
||||
WebGLPaintTaskData::WebRender(ref api, id) => {
|
||||
let device_size = webrender_traits::DeviceIntSize::from_untyped(&size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue