Skip to content

Commit 17a3629

Browse files
committed
Rebase and address review comments.
1 parent bb53fab commit 17a3629

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

webrender/src/resource_cache.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,16 @@ impl ResourceCache {
263263
}
264264

265265
pub fn update_webgl_texture(&mut self, id: WebGLContextId, texture_id: TextureId, size: Size2D<i32>) {
266-
let prev_texture_id = *self.webgl_textures.get(&id).unwrap();
266+
let webgl_texture = self.webgl_textures.get_mut(&id).unwrap();
267267

268268
// Remove existing cache if texture id has changed
269-
if prev_texture_id != texture_id {
270-
self.texture_cache.add_raw_remove(prev_texture_id);
269+
if webgl_texture.id != texture_id {
270+
self.texture_cache.add_raw_remove(webgl_texture.id);
271271
}
272272
// Update new texture id and size
273-
self.webgl_textures.insert(id, texture_id);
273+
webgl_texture.id = texture_id;
274+
webgl_texture.size = size;
275+
274276
self.texture_cache.add_raw_update(texture_id, size);
275277
}
276278

@@ -380,6 +382,8 @@ impl ResourceCache {
380382
let uv1 = Point2D::new(cache_item.pixel_rect.bottom_right.x as f32,
381383
cache_item.pixel_rect.bottom_right.y as f32);
382384
f(loop_index, uv0, uv1);
385+
debug_assert!(texture_id == TextureId::invalid() ||
386+
texture_id == cache_item.texture_id);
383387
texture_id = cache_item.texture_id;
384388
}
385389
}

0 commit comments

Comments
 (0)