mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
servo: Merge #17278 - Clear webrender image id when resizing a canvas (from asajeffrey:canvas-clear-webrender-image-key-when-resizing); r=emilio
<!-- Please describe your changes on the following line: --> Webrender isn't very happy if images change size, so clear the webrender image key when resizing a canvas. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #17277 - [X] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 8c2a7d6787ba6cc1be699643e7a99021f08fe56b --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 5e42dde44ba721287fd88b3f3d0f6984d4904b0a
This commit is contained in:
parent
8cdb7a2290
commit
d120c10d49
@ -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…
Reference in New Issue
Block a user