Skip to content

Commit 86c7767

Browse files
committed
Pass the dirty rect down into the blob image
This lets us know which area of the image has changed and is useful for merging the old blob data and the new blob data.
1 parent 9d502a1 commit 86c7767

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

webrender/examples/blob.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use std::collections::HashMap;
1717
use std::collections::hash_map::Entry;
1818
use std::sync::Arc;
1919
use std::sync::mpsc::{channel, Receiver, Sender};
20-
use webrender::api::{self, DisplayListBuilder, DocumentId, LayoutSize, PipelineId, RenderApi,
21-
ResourceUpdates};
20+
use webrender::api::{self, DeviceUintRect, DisplayListBuilder, DocumentId, LayoutSize, PipelineId,
21+
RenderApi, ResourceUpdates};
2222

2323
// This example shows how to implement a very basic BlobImageRenderer that can only render
2424
// a checkerboard pattern.
@@ -145,7 +145,7 @@ impl api::BlobImageRenderer for CheckerboardRenderer {
145145
.insert(key, Arc::new(deserialize_blob(&cmds[..]).unwrap()));
146146
}
147147

148-
fn update(&mut self, key: api::ImageKey, cmds: api::BlobImageData) {
148+
fn update(&mut self, key: api::ImageKey, cmds: api::BlobImageData, _dirty_rect: Option<DeviceUintRect>) {
149149
// Here, updating is just replacing the current version of the commands with
150150
// the new one (no incremental updates).
151151
self.image_cmds

webrender/src/resource_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ impl ResourceCache {
430430
self.blob_image_renderer
431431
.as_mut()
432432
.unwrap()
433-
.update(image_key, mem::replace(blob, BlobImageData::new()));
433+
.update(image_key, mem::replace(blob, BlobImageData::new()), dirty_rect);
434434
}
435435

436436
ImageResource {

webrender_api/src/image.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pub trait BlobImageResources {
151151
pub trait BlobImageRenderer: Send {
152152
fn add(&mut self, key: ImageKey, data: BlobImageData, tiling: Option<TileSize>);
153153

154-
fn update(&mut self, key: ImageKey, data: BlobImageData);
154+
fn update(&mut self, key: ImageKey, data: BlobImageData, dirty_rect: Option<DeviceUintRect>);
155155

156156
fn delete(&mut self, key: ImageKey);
157157

wrench/src/blob.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl BlobImageRenderer for CheckerboardRenderer {
105105
.insert(key, deserialize_blob(&cmds[..]).unwrap());
106106
}
107107

108-
fn update(&mut self, key: ImageKey, cmds: BlobImageData) {
108+
fn update(&mut self, key: ImageKey, cmds: BlobImageData, _dirty_rect: Option<DeviceUintRect>) {
109109
// Here, updating is just replacing the current version of the commands with
110110
// the new one (no incremental updates).
111111
self.image_cmds

0 commit comments

Comments
 (0)